问题描述
如何将第三方框架导入Xcode Playground?
How do I import 3rd part frameworks into Xcode Playground?
Swift Playground显然有一个框架导入机制,因为我们可以导入 Cocoa
, SpriteKit
,并且在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游乐场的任何想法?
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?
参见:
- How to import own classes from your own project into a Playground
- Is it possible to import third-party Objective-C code into a Swift playground?
(这个问题不同,因为请求是在Playground中使用框架而不是简单的常规 swift
文件)
(This question is different because the request is to use a framework in Playground rather than simply regular swift
files)
推荐答案
编辑:从Beta5开始,当操场是构建框架作为目标的工作空间的一部分时,现在支持此功能。 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再做下面的事了!
Don't do the below anymore!
从短期来看,虽然没有支持的解决方案,但如果你正在制作一个您可以将模块/框架复制到SDK 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/开发人员/平台/ 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在他的ans中所说的那样提交雷达wer。
But before you do that... go file a radar as @Rick says in his answer.
这篇关于如何将第三方框架导入Xcode Playground?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!