4

I want to add a cocoapod to Swift Playground but I tried to run the pod init but I'm getting this error:

[!] No Xcode project found, please specify one

I tried the solution on this thread

  1. gem install cocoapods-playgrounds
  2. pod playgrounds Alamofire

But I'm getting this error:

Errno::ENOENT - No such file or directory @ dir_initialize - /Applications/Xcode.app/Contents/Developer/Library/Xcode/Templates/File Templates/Source/Playground with Platform Choice.xctemplate
/Library/Ruby/Gems/2.3.0/gems/cocoapods-playgrounds-1.2.2/lib/cocoapods-playgrounds/generate.rb:43:in `open'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-playgrounds-1.2.2/lib/cocoapods-playgrounds/generate.rb:43:in `foreach'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-playgrounds-1.2.2/lib/cocoapods-playgrounds/generate.rb:43:in `dir_for_platform'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-playgrounds-1.2.2/lib/cocoapods-playgrounds/generate.rb:10:in `initialize'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-playgrounds-1.2.2/lib/cocoapods-playgrounds/workspace.rb:26:in `new'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-playgrounds-1.2.2/lib/cocoapods-playgrounds/workspace.rb:26:in `block in generate'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-playgrounds-1.2.2/lib/cocoapods-playgrounds/workspace.rb:23:in `chdir'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-playgrounds-1.2.2/lib/cocoapods-playgrounds/workspace.rb:23:in `generate'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-playgrounds-1.2.2/lib/cocoapods-playgrounds/command/playgrounds.rb:46:in `run'
/Library/Ruby/Gems/2.3.0/gems/claide-1.0.2/lib/claide/command.rb:334:in `run'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.0/lib/cocoapods/command.rb:52:in `run'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.0/bin/pod:55:in `<top (required)>'
/usr/local/bin/pod:22:in `load'
/usr/local/bin/pod:22:in `<main>'

Any of you knows a work around this error?

user2924482
  • 8,380
  • 23
  • 89
  • 173
  • Take a look at this thread: https://stackoverflow.com/questions/33367609/how-to-use-cocoapods-with-playground – JaredH May 20 '18 at 00:05
  • Possible duplicate of [How to use cocoapods with playground?](https://stackoverflow.com/questions/33367609/how-to-use-cocoapods-with-playground) – Anton Belousov May 20 '18 at 00:20
  • Update ruby and then update gem `cocoapods-playgrounds`. – Pranav Kasetti May 20 '18 at 08:48
  • @PranavKasetti there's a year old comment under that thread saying that framework doesn't work with Xcode9 and its git repo has also been archived, so have you actually tested it with Xcode9 and did it work for you? – Dávid Pásztor May 20 '18 at 10:36
  • Ah, didn't check that. That would explain a lot! In that case I recommend you post an answer to get some credit. :) – Pranav Kasetti May 20 '18 at 10:39
  • @PranavKasetti, I updated ruby and the gem and didn't work . – user2924482 May 20 '18 at 20:39
  • If the need is to quickly test the Cocoapod, many times using the provided github example/demo project for the Cocoapod is a quick starting point to try out the pod. – Marcy May 21 '18 at 00:57
  • @Marcy, can you post and example – user2924482 May 21 '18 at 01:07
  • Absolutely. Alamofire was mentioned so if you look at their Github site at https://github.com/Alamofire/Alamofire there is a folder called "Example" which contains a project called "iOS Example" for creating a demo app using Alamofire. Some Cocoapods call the folder Demo. Sometimes they include projects for iOS, MacOS or both. – Marcy May 21 '18 at 21:05
  • @Marcy that's still way more complicated and time consuming than using a Playground. Have a look at [Realm](https://realm.io/docs/swift/latest/), who actually provide a Playground with an embedded framework if you download the framework directly from their website instead of using CocoaPods/Carthage to install it. This enables much faster testing than having to build and run a complete app all the time you want to test some little things with a framework. – Dávid Pásztor May 22 '18 at 10:22

0 Answers0