【问题标题】:How to expose your project code to a Xcode playground when using cocoapods?使用 cocoapods 时如何将项目代码公开到 Xcode 游乐场?
【发布时间】:2018-05-15 08:24:28
【问题描述】:

https://useyourloaf.com/blog/adding-playgrounds-to-xcode-projects/ 之类的博文或kickstarter 源代码http://github.com/kickstarter/ios-oss 中,他们将playground 添​​加到xcode 项目中,以便对应用程序中的不同视图控制器和视图组件进行文档和可视化测试。

他们推荐的典型做法是:

  • 创建一个新的框架目标
  • 将您的代码添加到框架目标(具有正确的访问级别)
  • 将 Playground 文件添加到工作区
  • 构建您的框架
  • 然后框架将在 Playground 中可用。

这在不使用 cocoapods 的情况下有效,但我发现当您确实使用 cocoapods 时情况并非如此。

将 Playground 添​​加到 Xcode 工作区后,Pod 在 Playground 中可用,但不是我的自定义框架。

我不明白 cocoapods 如何在操场上提供豆荚

我不明白操场内部如何决定哪些框架可用于导入等。

你们中有人做到了吗?有指点吗?

谢谢

【问题讨论】:

    标签: ios swift xcode cocoapods swift-playground


    【解决方案1】:

    这是可行的。在您的Podfile 中,您需要为您的应用程序和框架声明目标,以便 CocoaPods 可以向两者添加 pod。这是一个例子。你可以查看教程Using Playgrounddemo和Medium帖子https://medium.com/flawless-app-stories/playground-driven-development-in-swift-cf167489fe7b

    platform :ios, '9.0'
    
    use_frameworks!
    
    pod 'Cheers'
    
    target 'UsingPlayground'
    target 'AppFramework'
    

    【讨论】:

      猜你喜欢
      • 2016-01-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-08-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多