草庐IT

PlayGround

全部标签

swift - 无法在 Xcode Playground 中为 Swift 导入 TensorFlow

我正在尝试将Swift用于TensorFlow,并已按照此处的说明进行操作:https://github.com/tensorflow/swift/blob/master/Installation.md当我继续在SwiftPlayground文件中导入TensorFlow时:importTensorFlow我收到此错误:“事件工具链与Playground不兼容。无法加载libswiftCore.dylib”我能够在REPL中使用SwiftforTensorFlow,所以我知道它应该可以工作。有人对如何解决此问题有任何想法吗?它清楚地工作,如本演示所示:https://www.youtu

xcode - In Xcode 7 playground is not showing is markup format 的评论

我正在尝试将注释格式更改为Xcode7Playground中引入的标记格式。我在“编辑器->显示渲染标记”中单击了渲染标记。它确实显示了已经在Playground上以标记格式编写的评论,但不会同时转换我在其中创建的评论。为了将其转换为标记格式,我要么必须关闭playground文件,要么将其更改为原始标记,然后再返回到呈现的标记。它不应该在我输入新评论的同时将其转换为标记格式吗?提前致谢。 最佳答案 不,这不是playgroundmarkdown的意图。它更像是您在stackoverflow中键入的消息:markdown旨在以纯文本

ios - XCode 8 奇怪的 Playground 错误,无法查找符号

我试图在Xcode8的Playground中使用自动布局。但是,一旦我添加了这一行,我就开始收到此错误:Playgroundexecutionfailed:error:Couldn'tlookupsymbols:__TWPCSo6UIView17PlaygroundSupport22PlaygroundLiveViewableS0___swift_FORCE_LOAD_$_swiftCoreGraphics__swift_FORCE_LOAD_$_swiftDarwin__TMaC17PlaygroundSupport14PlaygroundPage__swift_FORCE_LOAD

xcode - 在 Playground 中导入框架时出错

我正在按照ImportingCustomFrameworksintoPlayground的说明进行操作,但我仍然不断收到“没有这样的模块”错误。我尝试在工作区中添加所有内容;一个只有框架目标的项目,一个带有框架的Cocoa应用程序项目,只有框架。我还尝试在导入框架的应用程序中创建一个Playground,我什至可以毫无问题地将它导入其他swift文件;但我似乎无法在Playground上导入它。有人可以告诉我我可能做错了什么吗? 最佳答案 尝试使用模拟器构建您的框架目标!我只使用不适用于Playground的通用设备构建了我的!

swift - 如何正确使用 UIView 和 drawRect() 在 playground 中自定义它?

为什么在playground函数drawRect()中当我想覆盖它并显示View时不起作用?我尝试这样做:classCustomView:UIView{overridefuncdrawRect(rect:CGRect){//somecodetochangeselfproperties}}letrect=CGRect(x:0.0,y:0.0,width:300.0,height:300.0)letview=CustomView(frame:rect)view然后我尝试更改一些属性(例如:backgroundColor)。但它们并未应用。 最佳答案

swift - 非强引用在 Playground 上不起作用

我正在阅读swift编程指南,在初始化器章节中我遇到了这段代码:classCustomer{letname:Stringvarcard:CreditCard?init(name:String){self.name=name}deinit{println("\(name)isbeingdeinitialized")}}classCreditCard{letnumber:Intunownedletcustomer:Customerinit(number:Int,customer:Customer){self.number=numberself.customer=customer}deini

swift - Xcode 8.2 Playground 不显示 UIKit 结果

我尝试运行一些UIKitplayground示例,但在查看图形结果时遇到问题。什么有效:我可以在灰色的右侧编辑器Pane中预览任何字符串分配。我可以点击“眼睛”(快速预览)或“小矩形”图标并查看正确的UIKit结果,尽管是在临时弹出窗口或代码行之间的Pane中(均较小)。我可以打印内容,它会显示在编辑器下方的Pane中(在带有时间轴和开始/停止按钮的栏下方)。什么不起作用:我无法以大型图形方式显示我的代码结果。下面是我尝试使用的一些示例代码:importUIKitimportPlaygroundSupportletcontainerView=UIView(frame:CGRect(x:

ios - Xcode 6 Beta 5 swift Playground : Cannot find symbol for CGRectMake()

自从更新到Xcode6beta5后,我的Playground代码将不再编译/运行和记录:Playgroundexecutionfailed:error:Couldn'tlookupsymbols:_CGRectMake它应该足够简单并且在以前的版本上运行良好。到目前为止,我唯一运行的代码如下:importFoundationimportUIKitimportXCPlaygroundimportQuartzCoreletframeRect:CGRect=CGRectMake(0,0,500,500)varcustomView=UIView(frame:frameRect)只是想知道是否有

swift - Playground 内的类(class)扩展

我的playground源文件夹中有一个UIVIew子类(它是一个公共(public)类),我试图只将这个类的一部分作为扩展放入我的主playground文件中。当我在Playground上声明以下内容时publicextensionSortingAlgorithmView{publicfunctypeTest(){print("dfasfndjasfasfdasfdasftest")}}然后在我的子类中调用typeTest()它告诉我没有名为typeTest的函数。 最佳答案 交互式页面不会与源文件一起运行;源文件首先被编译,然后

macos - Swift:deinit 方法中没有 println 的输出(不使用 playground)

这是我的测试代码(在终端中运行):#!/usr/bin/xcrunswiftvarcount=0;//forreferencecountingclassA{init(){count++;}deinit{println("Adeinit")count--;}}vara:A?=A()println(count)a=nil//nooutputifIcommentoutthisstatementprintln(count)输出:1Adeinit0如果上面提到的行被注释掉,则没有输出“Adeinit”。输出将是:11我已经使用swiftc编译了代码,但结果还是一样。(xcrunswiftc-ot