---
title: "#138: Using CocoaPods in Xcode Playgrounds  🍩🎪"
url: https://littlebitesofcocoa.com/138-using-cocoapods-in-xcode-playgrounds
author: Jake Marsh
date: 2015-12-02
published: 2015-12-02
topics: ["Playgrounds","Libraries"]
description: "We're continuing our look at Xcode Playgrounds today with CocoaPods. Let's see what it takes to import a CocoaPod into a Playground."
---

# #138: Using CocoaPods in Xcode Playgrounds  🍩🎪

By Jake Marsh, December 2, 2015. HTML: https://littlebitesofcocoa.com/138-using-cocoapods-in-xcode-playgrounds

We're continuing our look at _Xcode Playgrounds_ today with _CocoaPods_. Let's see what it takes to import a _CocoaPod_ into a _Playground_.

We'll begin by creating a new **Xcode Project**. Next, we'll head into our **project's** directory and run `pod init` to generate our `Podfile`. We'll open it up and configure it just as we usually would:

``` ruby
platform :ios, '9.0'
use_frameworks!  
link_with 'Spaceships'
 
pod 'Alamofire'
```

Then we'll run `pod install` to generate the **Workspace** file for our project and install our pods. We're almost done, next we need create a new _Playground_ and add it to our project. 

Finally, we need to add our _Playground_ to our **Podfile's** `link_with` directive (<i>only its name, not the .playground extension</i>):

``` ruby
link_with 'Spaceships', 'scratch-pad'
```

We'll run `pod install` one more time and we're done. We can now import the pod we installed into our _Playground_ and try it out. Neat!

<img src='https://media.littlebitesofcocoa.com/bite-assets/138-using-cocoapods-in-xcode-playgrounds-example.png' style='max-width: 516px;' />
