iOS8: Custom Swift Framework accessing external framework written in Objective-C

前端 未结 3 1253
天涯浪人
天涯浪人 2021-01-05 00:58

I\'m trying to create a custom framework called CouchbaseKit (a new target in Xcode) in Swift. Inside my CouchbaseKit, I need to access Couc

3条回答
  •  长情又很酷
    2021-01-05 01:21

    If you still want to use Cocoapods you can follow this

    Steps:

    • Create a folder called the name of your Framework you want to use in that case CouchbaseLite and inside it create module map. The file name will be module.map and its content will be

    module CouchbaseLite { header "../Pods/couchbase-lite-ios/CouchbaseLite.framework/Headers/CouchbaseLite.h" export * }

    Important Note: Don't add that folder to the project, I don't know why not when done it will not work.

    • Import Paths under Swift Compiler – Search Paths in your project settings. Use ${SRCROOT} in the module path (e.g. ${SRCROOT}/CouchbaseLite) .

    • Then you can import it like any swift module.

    Update: It will work nicely in Xcode, but when I have tried to validate the pod with the pod lint it still give error and I still don't know why.

提交回复
热议问题