"no such module" 在 swift 操场上导入 pods 时

"no such module" when Importing pods in swift playground

使用Xcode 7.2.1。

我正在按照本教程学习 pods 在操场上工作。我已将 playground 添​​加到工作区中,并且 podfile 正在链接到 playground。

但是导入还是不行 - "no such module"

https://littlebitesofcocoa.com/138-using-cocoapods-in-xcode-playgrounds

// 导入不起作用

// Podfile
target 'spaceships' do
end

platform :ios, '9.0'
use_frameworks!
link_with 'spaceships', 'imports', 'test'

https://github.com/mingyeow/ImportToPlaygroundDoesNotWork

这不是您从本教程中遇到的问题的直接答案,但有一个新工具可以自动生成我经常使用的 pods Playgrounds。

名为 ThisCouldBeUsButYouPlaying 来源为 on GitHub.

基本上它扩展了 CocoaPods 安装程序,然后可以生成 Playgrounds。

安装:

$ gem install cocoapods-playgrounds

使用 Alamofire 创建游乐场:

$ pod playgrounds Alamofire

创建一个包含多个pods的游乐场:

$ pod playgrounds RxSwift,RxCocoa

新游乐场会自动打开。

您必须首先构建项目,以启用pods,然后 Playground 才可用。