Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Alamofire within a Playground

I'm new to iOS development and using Xcode and I'm having trouble getting Alamofire to work within a Playground. There's some functionality I'd like to test out for proof of concept but the library is not linked to the Playground and I've tried getting it to play nicely. I have Alamofire set up to work within an iOS (not in a Playground) project before the installation instructions in the Github Alamofire repo were recently updated.

Any suggestions on how to get Alamofire to import properly in the Playground?

like image 689
Petesta Avatar asked Sep 25 '14 22:09

Petesta


2 Answers

Here is what I consider to be the simplest straight line path:

Download and build Alamofire:

brew install carthage
echo "github \"Alamofire/Alamofire\"" > Cartfile
carthage update

Configure the workspace with a playground file and Alamofire.

  1. From the Carthage/Build/{iOS / OSX} directory, drag the Alamofire.framework file into your link library list: {Project Name} -> {Target Name} -> Build Phases -> Link Binary With Libraries
  2. Command-N (create file) -> {Platform} -> Source -> Playground
  3. If not already in a Workspace file, File -> Save as Workspace. To be paranoid, I close the project / workspace and (re)open the workspace.
  4. Click on the playground file created in #2, and add the import import Alamofire
like image 111
Chris Conover Avatar answered Nov 18 '22 08:11

Chris Conover


Apple provides excellent step-by-step instruction to do so here: Importing Custom Frameworks Into a Playground

like image 36
Canucklesandwich Avatar answered Nov 18 '22 10:11

Canucklesandwich