I am trying out some pods before I implement it with my main project I want to make sure it works properly for my requirement. Easiest way is to try it with playground.
在我用我的主要项目来实现它之前,我正在尝试一些pods,我想确保它能够满足我的需求。最简单的方法是在操场上试试。
I tried pod init
with playground which doesn't work
我试过用不工作的操场。
[!] No xcode project found, please specify one
[!没有找到xcode项目,请指定一个
Help is much appreciated.
感谢帮助。
3 个解决方案
#1
50
This is an old question but shows up at the top of Google.
这是一个老问题,但出现在谷歌的顶部。
This Could Be Us But You Playing is a command line tool that creates a new Xcode playground with an integrated cocoapod. It also supports integrating multiple cocoapods at once. It's a single command.
这可能是我们,但您正在玩的是一个命令行工具,它创建了一个新的Xcode游乐场,并集成了cocoapod。它还支持同时集成多个茧类。这是一个命令。
- To Install:
gem install cocoapods-playgrounds
- 安装:宝石安装椰子树-游乐场
- To Use:
pod playgrounds Alamofire
- 使用:豆荚运动场
- Wait for playground to open then build it.
- 等待游乐场开放,然后建造它。
#2
16
For those using the pre-release 1.0 version of CocoaPods, the 'link_with' directive that @samuel used is deprecated. I tried simply adding my playground as a target in my Podfile, but CocoaPods doesn't recognize it as a valid target.
对于使用CocoaPods的1.0版本的用户来说,@samuel使用的“link_with”指令是不可取的。我试着在我的播客中添加我的操场作为目标,但是茧蜂不承认它是一个有效的目标。
I found that adding a scheme for the pod I need to use and building it manually works as discussed here.
我发现为我需要使用的pod添加一个方案,然后手工构建它,就像这里讨论的那样。
To demonstrate this in action, I have created a sample project with Alamofire integrated into a Playground here.
为了在实践中演示这一点,我创建了一个示例项目,将Alamofire集成到这里的一个游乐场中。
I also came across this library. I haven't had a chance to use it yet, but it looks promising.
我也遇到了这个图书馆。我还没有机会使用它,但它看起来很有前途。
Aside: if you'd like to make asynchronous requests in a Playground (e.g. with Alamofire), you'll need to enable indefinite execution as described here.
旁白:如果您想在一个游乐场(例如使用Alamofire)中进行异步请求,您需要按照这里描述的那样启用无限期执行。
I hope this helps.
我希望这可以帮助。
#3
6
There is an issue of "Little bites of cocoa" explaining how to do this: https://littlebitesofcocoa.com/138-using-cocoapods-in-xcode-playgrounds
有一个关于“小可可一口”的问题解释了如何做到这一点:https://littlebitesofcocoa.com/138- use - cocoapods-inxcode -playgrounds
- Create project
- 创建项目
- Pod init
- 圆荚体初始化
- Add dependency
- 添加依赖关系
- Add playground to your workspace
- 在你的工作空间里增加游乐场
- Add 'link_with' directive for your playground
- 在你的操场上添加“link_with”指令。
#1
50
This is an old question but shows up at the top of Google.
这是一个老问题,但出现在谷歌的顶部。
This Could Be Us But You Playing is a command line tool that creates a new Xcode playground with an integrated cocoapod. It also supports integrating multiple cocoapods at once. It's a single command.
这可能是我们,但您正在玩的是一个命令行工具,它创建了一个新的Xcode游乐场,并集成了cocoapod。它还支持同时集成多个茧类。这是一个命令。
- To Install:
gem install cocoapods-playgrounds
- 安装:宝石安装椰子树-游乐场
- To Use:
pod playgrounds Alamofire
- 使用:豆荚运动场
- Wait for playground to open then build it.
- 等待游乐场开放,然后建造它。
#2
16
For those using the pre-release 1.0 version of CocoaPods, the 'link_with' directive that @samuel used is deprecated. I tried simply adding my playground as a target in my Podfile, but CocoaPods doesn't recognize it as a valid target.
对于使用CocoaPods的1.0版本的用户来说,@samuel使用的“link_with”指令是不可取的。我试着在我的播客中添加我的操场作为目标,但是茧蜂不承认它是一个有效的目标。
I found that adding a scheme for the pod I need to use and building it manually works as discussed here.
我发现为我需要使用的pod添加一个方案,然后手工构建它,就像这里讨论的那样。
To demonstrate this in action, I have created a sample project with Alamofire integrated into a Playground here.
为了在实践中演示这一点,我创建了一个示例项目,将Alamofire集成到这里的一个游乐场中。
I also came across this library. I haven't had a chance to use it yet, but it looks promising.
我也遇到了这个图书馆。我还没有机会使用它,但它看起来很有前途。
Aside: if you'd like to make asynchronous requests in a Playground (e.g. with Alamofire), you'll need to enable indefinite execution as described here.
旁白:如果您想在一个游乐场(例如使用Alamofire)中进行异步请求,您需要按照这里描述的那样启用无限期执行。
I hope this helps.
我希望这可以帮助。
#3
6
There is an issue of "Little bites of cocoa" explaining how to do this: https://littlebitesofcocoa.com/138-using-cocoapods-in-xcode-playgrounds
有一个关于“小可可一口”的问题解释了如何做到这一点:https://littlebitesofcocoa.com/138- use - cocoapods-inxcode -playgrounds
- Create project
- 创建项目
- Pod init
- 圆荚体初始化
- Add dependency
- 添加依赖关系
- Add playground to your workspace
- 在你的工作空间里增加游乐场
- Add 'link_with' directive for your playground
- 在你的操场上添加“link_with”指令。