Xcode同一个项目多个target相互依赖的配置方法

e.g. we have 2 targets:

  1. framework: MOJiAppStorePay
  2. debug: DebugMOJiAppStore

if we want to use MOJiAppStorePay in DebugMOJiAppStore, we should config it as follows:

  1. open DebugMOJiAppStore’s settings
  2. under build settings, add MOJiAppStorePay as DebugMOJiAppStore’s dependency
  3. under build settings, unfold Link Binary With Libraries, add MOJiAppStorePay and drag it after its own dependencies (MOJiBase.xc here)

How to import Swift code into Objective-C Module or Framework?

  • Import Swift files into the module you want.
  • Modify all swift declarations of classes, properties or methods you want to use in your module with @objc public in front of each declaration. Whereas classes don’t need @objc, just put public in front of it would be OK.
  • And for the left, do as what apple said here.

OK, there you go now 🙂