0

I'm trying to import the SwiftBond framework into Xcode: https://github.com/SwiftBond/Bond

I've never imported a 3rd party framework (except Parse, but that is very easy to do), and am fairly lost. Any idea on how to do it? I downloaded the zip file but don't know what to do from there.

thanks

  • There's an "Installation" section on the main SwiftBond github page. Did you look at that already? – Michael Dautermann Jul 11 '15 at 08:32
  • I tried that first, and I used the "standalone" method. I imported all the .swift files to my project. I got the message "No such Module "Bond." I cleaned the project and rebuilt, but the message was still there. – Joey Bodnar Jul 11 '15 at 08:50

1 Answers1

2

I would recommend that you setup CocoaPods and learn how to use this. Mainly because there are so many 3rd party frameworks which support CocoaPods, but also because Google announced at this year's Google I/O that they will use CocoaPods as their main tool for distributing their iOS frameworks (such as Google Maps or Google Analytics).


You can read the official CocoaPods Guide - Getting Started to setup CocoaPods on your computer. It's actually quite simply since it's possible to install with Ruby with the command:

sudo gem install cocoapods

Afterwards you will need to create a Podfile in the same folder as your Xcode project (the *.xcodeproj file) with the following content:

use_frameworks!
pod 'Bond'
pod 'Parse'

And then run the command pod install in your terminal when located in the same folder.

Kumuluzz
  • 2,012
  • 1
  • 13
  • 17
  • FYI, this will also install `Parse` because of the line `pod 'Parse'`. Feel free to either remove this line from the `Podfile` or remove the framework that you had already integrated. – Kumuluzz Jul 11 '15 at 11:38
  • thanks, that worked. However, in my Xcode project (the new one created by pods), when I type "import Bond" I receive the error message "Cannot load underlying module for Bond." Is there something else I must do? All the files for Bond the framework im importing) are in swift, like my project is. – Joey Bodnar Jul 11 '15 at 12:34
  • Try to clean your project: shift + command + K. Also, make sure that you have the workspace open (the `*.xcworkspace` file) and not the individual project. – Kumuluzz Jul 11 '15 at 12:37
  • that did not work. Just to make sure it wasn't a problem elsewhere in the project, I created a clean, black Xcode project and installed it there too, and received the same error message.I tried cleaning the new one and restarting Xcode, and when i restarted it the error message changed to "no such module Bond" – Joey Bodnar Jul 11 '15 at 13:05
  • Try to see if this post can help you out? http://stackoverflow.com/questions/29994331/no-such-module-restkit-with-cocoapods-and-swift – Kumuluzz Jul 11 '15 at 13:08
  • And you are completely sure that you have the workspace open? You should close Xcode, run `pod install` and then open the newly created workspace http://stackoverflow.com/questions/30174838/cocoapods-not-installing-alamofire-in-swift-parse-chat-app – Kumuluzz Jul 11 '15 at 13:11
  • The new workspace is open, I'm sure. I know because it has a new "pods" folder on the side panel. The link you gave me said this--------- If everything is setup correctly, errors such as No such Module 'Alamofire' occur when you build your project from .xcodeproj. By default you need to build project integrating CocoaPods from .xcworkspace. -------I know this may be a dumb question, but is it possible to have the new workspace be open but BUILD from the old project? I'm sort of new to this stuff so maybe there is some technical difference I'm not aware of. – Joey Bodnar Jul 11 '15 at 13:25
  • No, that shouldn't be an issue. Could you confirm that `Pods.framework` is added in the section `Linked Frameworks and Libraries` under `General` in the target? And also in `Link Binary With Libraries` under `Build Phases`? – Kumuluzz Jul 11 '15 at 13:55
  • I just tried, that. Pods.framework was not added in the Linked Frameworks and Libraries under General. I added it, and then went to Link Binary with Libraries under Build phases, and it was there. That still didn't work. I cleaned, that didn't work, and then restarted Xcode and I still get "no such module Bond." – Joey Bodnar Jul 12 '15 at 14:37
  • Since you've tried to create a completely new and blank project, installing the frameworks with CocoaPods and it would still fail, then it leads me to believe that it might be something with your CocoaPods setup. Try to review this troubleshooting guide to make sure that everything is setup correctly. https://guides.cocoapods.org/using/troubleshooting#installing-cocoapods – Kumuluzz Jul 13 '15 at 10:15