Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use cocoapods with playground?

I am trying out some pods before I implement it with my main project I want to make sure it works properly for my requirement. Easiest way is to try it with playground.

I tried pod init with playground which doesn't work

[!] No xcode project found, please specify one

Help is much appreciated.

like image 560
vinbhai4u Avatar asked Oct 27 '15 12:10

vinbhai4u


People also ask

How do I use CocoaPods with my internal IOS frameworks?

If you've used CocoaPods before, you probably know that the usual way to get started using it is by running pod init in the directory that contains the . xcproject file. Running this command creates a workspace that CocoaPods can use to manage the dependencies.


2 Answers

This is an old question but shows up at the top of Google.

This Could Be Us But You Playing is a command line tool that creates a new Xcode playground with an integrated cocoapod. It also supports integrating multiple cocoapods at once. It's a single command.

  1. To Install: gem install cocoapods-playgrounds
  2. To Use: pod playgrounds Alamofire
  3. Wait for playground to open then build it.
like image 84
jkistler Avatar answered Sep 21 '22 04:09

jkistler


For those using the pre-release 1.0 version of CocoaPods, the 'link_with' directive that @samuel used is deprecated. I tried simply adding my playground as a target in my Podfile, but CocoaPods doesn't recognize it as a valid target.

I found that adding a scheme for the pod I need to use and building it manually works as discussed here.

Manage Schemes enter image description here

To demonstrate this in action, I have created a sample project with Alamofire integrated into a Playground here.

I also came across this library. I haven't had a chance to use it yet, but it looks promising.

Aside: if you'd like to make asynchronous requests in a Playground (e.g. with Alamofire), you'll need to enable indefinite execution as described here.

I hope this helps.

like image 43
Paul Van Wieren Avatar answered Sep 20 '22 04:09

Paul Van Wieren