最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

How to configure Swift framework to works in Objective-c app? - Stack Overflow

programmeradmin5浏览0评论

Here's my sample project:

I'm trying to create a Swift framework to use in an Objective-C app, build works fine, configuration all keep to default, added the framework in the app, imported ok, but I cannot access the class written in Swift, which already marked with @objc and public, not sure if anyone have an idea where I did wrong

Framework:

@objc(TVNFoo) @objcMembers public class Foo: NSObject {
    public static let shared = Foo()
    
    public func foo() {
        print("foo")
    }
}

App:

@import TestFramework;

[TVNFoo shared]; // Error undeclared identifier
发布评论

评论列表(0)

  1. 暂无评论