"No member "snp" on type "UIView!" when trying to use imported SnapKit framework

(wdb) #1

IDE: Fire
Version: Version (develop) built on talax, 20190426-155608. Commit f04dec1.
Target (If relevant): iOS
I am wondering if it’s possible to use a Swift-based framework like SnapKit (see: https://github.com/SnapKit/SnapKit) within a Silver-based project? Should it work when I compile the library into a .framework file and then import it into Fire?

I have tried to import the framework but I am getting the compiler error and now I am not sure if what I am trying to do is actually supported by the compiler. I am not sure if the framework should be Objective-C based ones. My gut feeling thinks it should be :innocent:

Expected Behavior:
I would expect that the code will compile without any compiler errors and the constraints are working

Actual Behavior:
Compiler error: No member "snp" on type "UIView!" [/Users/x/Desktop/Bug/SnapKit/SnapKit/RootViewController.swift (16)]

You can download my project code at: https://www.dropbox.com/s/fev5qjzt3sk4ucc/SnapKit.zip?dl=0

  1. Checked out the SnapKit project
  2. Build the framework for Generic iOS device and the iPhone XS-simulator device
  3. Navigated to the derived data directory and copied the .framework of each build to Frameworks/SnapKit directory in my Fire project
  4. Created a iOS and iOS Simulator directory inside and moved the respective framework file in each directory

Note: Here I am getting confused I am not sure which file I supposed to drag into the references section of my iOS project. The documentation suggests the tool will pickup the right .framework when you use the above structure. Only does this only refer when you use FXGen-tool or in general?

  1. Create a simple iOS project in Fire
  2. Drag the iOS's framework to the project
  3. Use some simple code to use the framework listed below
  4. Compile the project
  5. Notice the compiler error

Used RootViewController.swift

import UIKit
import SnapKit

@IBObject class RootViewController : UIViewController {

    public override func viewDidLoad() {

        // Do any additional setup after loading the view.
        let box = UIView()
        let container = UIView()


        box.snp.makeConstraints { (make) -> Void in

    public override func didReceiveMemoryWarning() {

        // Dispose of any resources that can be recreated.

(marc hoffman) #2

no. until Swift 5.2 has Module Stability, we cannot support importing or linking against Apple-Swift compiler frameworks.

1 Like
(RemObjects) #3

Thanks, logged as bugs://82475

(marc hoffman) #4

that said, can you send me framework, for reference?

(wdb) #5

It’s this project: https://github.com/SnapKit/SnapKit (I used master-branch) and it’s being leveraged in the project at: https://www.dropbox.com/s/fev5qjzt3sk4ucc/SnapKit.zip?dl=0

(marc hoffman) #6

Dan you do me a favor and send me the compiled .framework, zipped up?

(wdb) #7

It’s part of the Dropbox file:

Would this fulfil your request or do you want it separately?

(marc hoffman) #8

DropBox won’t let me download it. can you just attach the zip?

1 Like
(wdb) #9

SnapKit.zip (1.0 MB)

(marc hoffman) #10

Curious, there’s .h files in the .framework, but the one that has any interesting info is surrounded by a huge #if 0.

we’ll need to wait for Swift Module Stability to ship in 5.1 before we can look at importing/using Swift frameworks, but I fixed it to at least detect/warn about not being able to import a Swift framework, until then…

1 Like
(wdb) #11

Awesome, thank you! :slight_smile: