Swift Playgrounds are amazing for testing out code and playing with new ideas. When they first came out it was a pain to add external dependencies to them and test new frameworks. You had to copy entire sources to them and it wasn’t really quick and easy to use them.
Thankfully Boris solved the problem with his CocoaPods plugin lovingly called ThisCouldBeUsButYouPlaying.
You can follow the setup instructions on the github repo page. In following posts we’ll be using Alamofire, SnapKit, and others so it would be beneficial to setup a playground where you can follow along with the code examples.
The most basic playground I use is:
import XCPlayground
XCPlaygroundPage.currentPage.needsIndefiniteExecution = true
import SnapKit
let view = UIView()
view.frame = CGRect(x: 0, y: 0, width: 375, height: 667)
view.backgroundColor = UIColor.whiteColor()
XCPlaygroundPage.currentPage.liveView = view
Also make sure to turn on the assistant editor so you can see the live view :)
tl;dr:
pod playgrounds SnapKit
Build Project
Edit Playground
???
Win