In the last 24 hours I've tried to consume two different 3rd party Swift libraries: Swiftz and Sleipnir. I assume it should be fairly easy as both projects simply provide a sketch of how to consume them. However, neither provide enough detail for me to follow. I've tried all of the following: add the projects to my workspace, drag/drop the compiled frameworks into my project navigator, add the frameworks to the "Link Binary with Libraries" phase. In all cases, I get a linker error informing me that the framework can't be found.
I just need a link to the actual documentation that explains how to do this. I haven't been able to find it.
Edit: Forget about 3rd party libraries even. How do you consume your own libraries? I have a Cocoa Framework library I've written. Now I've added a command line project to the same workspace. Sure would be nice if I could access my new framework from my command line app. I clicked on my command line project. Clicked on Build Phases and dragged my custom framework to the Link Binary with Libraries section. Everything compiles fine. When running my app I get the following error:
dyld: Library not loaded: @rpath/libswiftAppKit.dylib
Referenced from: /Users/mgwelch/Library/Developer/Xcode/DerivedData/SwiftParsing-
btkaoklayoffujgrkklfyffpipih/Build/Products/Debug/Parsing.framework/Versions/A/
Parsing
Reason: image not foundI
In general, to use an external framework in Xcode, you need to: Add a some kind of synchronised link to the external repository and download it. Add the . xcodeproj (Xcode project) file from the external repo as a sub-project to your own project, in Xcode's File Navigator.
In order to create an iOS Framework you need to click on File -> New -> Project (Shift + Cmd + N) -> Framework (under iOS tab, Framework & Library section). Framework under Framework & Library section.
Ok, not many users are familiar with Swift frameworks yet, I guess.
Well, I'm getting some assistance from a framework developer over on an issue I raised on how to consumer their framework. I still have issues, but others may be interested in following the conversation to see some of the steps involved
https://github.com/typelift/swiftz/issues/114
Detailed instructions are provided at this issue. Feel free to try them. I'll mark this as closed.
UPDATE I stated this in a comment but it might not be seen. I was trying to write a command line tool. At this time with XCode 6.1 it does not appear possible to use a third party framework in a command line tool. As a matter of fact I've written up an issue against another project stating that their command line targets no longer run: https://github.com/railsware/Sleipnir/issues/17
Perhaps this worked in a previous beta version, but it no longer seems possible.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With