Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add a CocoaPod framework to Xcode 8 Playground

I tried to add some pods to the Playground within an Xcode project. Unfortunately, the only scope supported is targets since the update, and link_with is no longer supported.

ERROR:

[!] Invalid Podfile file: [!] The specification of link_with in the Podfile is now unsupported, please use target blocks instead.

When I use target blocks, I get this error:

[!] Unable to find a target named MyPlayground, did find Target_1, Target_2

OR:

[!] Unable to find a target named MyPlayground.playground, did find Target_1, Target_2

Also tried adding it within Target_1 target scope:

ERROR

[!] Invalid Podfile file: [!] Unsupported options MyPlayground for target Target_1.

What is the simplest way to add a dependency to Playground source?

like image 659
Tal Zion Avatar asked Dec 19 '22 12:12

Tal Zion


1 Answers

UPDATE

As of:

Xcode 8.2

You no longer need to add your pod folder into resources, simply use it as you would in the project.

Example:

Playground


Pre Xcode 8.1

Thanks to Eric Aya, I have found a solution based on his first suggestion.

In order to add a CocoPods framework to Playground, follow these steps:

  1. Add pods to your pod file and hit pod install
  2. Add a new Playground file
  3. Click on the Sources folder in your playground
  4. Click on the + for Add Files to Sources
  5. Add you pod folder, in our case HanakeSwift
  6. Import your project pods framework import Pods_PodsPlayground
  7. Build and access your framework!

Step 3

Step 3

Step 4

Step 4

Step 5

Step 5

Step 6, 7

Step 6, 7

like image 165
Tal Zion Avatar answered Jan 05 '23 08:01

Tal Zion