本文介绍了如何将第 3 方框架导入 Xcode Playground?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将第 3 部分框架导入 Xcode Playground?

How do I import 3rd part frameworks into Xcode Playground?

Swift Playground 显然有框架导入机制,因为我们可以导入 CocoaSpriteKit,并且在 OSX Playground 中,XCPlayground(XCPlayground 似乎从 iOS 中消失了,奇怪的是)

Swift Playground obviously has a framework import mechanism because we can import Cocoa, SpriteKit, and in an OSX Playground, XCPlayground (XCPlayground seems missing from iOS, oddly)

我真正想做的是在我的操场上隐藏代码并能够展示一个最小的例子.关于如何将框架加载到 Swift Playground 的任何想法?

What I'd really like to do is hide code from my playground and be able to show a minimal example. Any thoughts on how to load a Framework into Swift playground?

另见:

(这个问题不同,因为请求是在 Playground 中使用 framework 而不是简单的常规 swift 文件)

(This question is different because the request is to use a framework in Playground rather than simply regular swift files)

推荐答案

已从 Beta5 开始,当 Playground 是将框架构建为目标的工作区的一部分时,现在支持此功能.Apple 开发者论坛网站上有更多详细信息,但希望 @Rick Ballard 将它们添加到他的答案中,这应该成为这个问题的最终答案.

Edited: As of Beta5 this is now supported when the playground is part of the workspace that builds the framework as a target. There are more details on the Apple dev forums site, but hopefully @Rick Ballard will add them to his answer here and that should becoke the definitive answer for this question.

不要再做下面的事情了!

Don't do the below anymore!

就短期而言,虽然没有支持的解决方案,但如果您正在生成模块/框架,您可以将其复制到 SDKs System/Library/Frameworks 目录中,然后只需 import<#Module#> 与导入系统框架的方式相同.

For the short term, while there's no supported solution, if you're producing a Module/Framework you can copy it into the SDKs System/Library/Frameworks directory and then just import <#Module#> the same way as you import system Frameworks.

对于 OS X Playground:/Applications/Xcode6-Beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks

For an OS X Playground: /Applications/Xcode6-Beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks

对于 iOS:/Applications/Xcode6-Beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.0.sdk/System/Library/Frameworks/

但在你这样做之前......按照@Rick 在他的回答中所说的那样提交雷达.

But before you do that... go file a radar as @Rick says in his answer.

这篇关于如何将第 3 方框架导入 Xcode Playground?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 07:20