简体   繁体   中英

Include Pods from Swift Sources in iOS7 Swift Project

I have a iOS7 Swift project and want to use a pod like this which is based on Swift code.

In my pod file I can include the pod like this:

platform :ios, "7.0"
pod "Timepiece"

Assume that the project runs on iOS.How can I include pods from Swift sources?

Your only choice is to manually insert source code into your project, because:

  1. It is not possible to build static libraries from Swift code.
  2. Thus Pods written in Swift can only be integrated as dynamic frameworks
  3. You cannot have dynamic frameworks before iOS 8.

I think you should do same as iOS pod , just #import all .h files in bridge.h file and Use Objective-C bridging header by selecting your Target - >Build Setting -> Swift compiler - code generation .

Just drag you bridge.h file from your project to Swift compiler - code generation section.

Check out THIS standard tutorial for more details. May this help you !!

I am not sure this is what you are trying to. Cocoapod is a dependency manager. When you create a pod file in the same folder of your .xcodeproj, and run "pod install" at the the folder through the terminal, an .xcworkspace will be crated. Then you can use the pod project with your project by opening the .xcworkspace file instead of .xcodeproj

reference: https://guides.cocoapods.org/using/using-cocoapods.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM