草庐IT

PlayGround

全部标签

swift - 从未调用 Deinit 方法 - Swift playground

在接下来的代码中,我尝试调用deinit方法来释放对PersonClass实例Mark的所有引用,但从未调用deinit。为什么?classPerson{letname:Stringinit(name:String){self.name=nameprintln("Personcreated")}deinit{println("Person\(name)deinit")}}varMark:Person?=Person(name:"Mark")Mark=nil//Shouldn'tthepersondeinitmethodbecalledhere?Itdoesn't.

swift - iOS/tvOS playground 失败并显示 "Unable to find execution service for selected run destination"

迁移到XCode7.1后,我无法在iOS和tvOS平台上使用playground。只有OSX有效。最简单的Playground代码会产生错误消息:Unabletofindexecutionserviceforselectedrundestination我怀疑这与XCode没有找到合适的模拟器有关,但是我不知道在哪里以及如何配置它。我在现有项目中尝试了playground,也尝试了从启动画面新建的playground。任何想法可能是错误的?更新:检查控制台可以提供更多信息,但仍不清楚如何修复:24/10/201510:16:10,193lsd[279]:LaunchServices:Co

swift - 在 Swift playground 中使用 MapKit 显示 map 以快速查看?

很高兴看到swift-playground的标签-很高兴看到它继续。我一直在研究Swift,并且想知道MapKit是否可以在playground中使用,以便您可以使用QuickLook功能,这样我就可以通过预览来迭代和尝试我的工作。我还没有弄清楚语法所以我想问一下是否有人在Playground环境中探索过这个。我想我需要一些代码来将其建立为ViewController。importUIKitimportMapKit//SampleUIViewcodewhichworksgreatintheplayground.//varmyView:UIView=UIView();//myView.f

swift - 在 Swift Playground 中使用 SceneKit

我到处都在寻找这个,但我一无所获。您如何复制ChrisLattner在WWDC上使用Playgrounds和SceneKit演示的内容?我想在Playgrounds中有一个SceneKit场景,动画。我尝试从SceneKit项目模板中剪切和粘贴设置代码,以为它会神奇地开始渲染,但事实并非如此。我尝试观看主旨演讲并在Lattner的屏幕上暂停并放大以寻找有关源代码的提示,但他似乎是从他项目的其他地方导入他的所有代码,所以我没有得到任何线索。文档中似乎没有任何内容,或者我遗漏了它。 最佳答案 由于Swift在版本之间不具有源代码兼容性,

swift - Swift Playground 中没有这样的模块 'Cocoa'

我正在尝试遵循WWDCPlaygroundsession中使用的一些代码,我正在尝试导入Cocoa框架:importCocoa但是我在助理编辑器中得到以下错误Playgroundexecutionfailed:error::3:8:error:nosuchmodule'Cocoa'如果有帮助的话,我在视频的41:20。 最佳答案 您使用的是iOSplayground(基于UIKit),而不是OSXplayground(基于Cocoa)。尝试创建一个新的Playground并选择“OSX”而不是“iOS”作为类型。之后它应该可以正常工

xcode - Playground 导入 : No Such Module 'Foo'

我已认真按照Apple说明将自定义模块导入playground,包括说明here.然而我得到:Playgroundexecutionfailed:/var/folders/z3/kd0nj4ln1rgcpm8bdz7067wh0000gs/T/./lldb/1874/playground1.swift:7:8:error:nosuchmodule'Foo'importFoo如何恢复到正常运行的Playground导入?[编辑:请注意,有两个答案提供了将Playground与框架相关联的详细说明;我已按照这些说明进行操作,但没有运气。解决方案需要在Xcode中重新配置一些东西;我的安装显

ios - 如何在 playground 中使用 cocoapods?

在我的主要项目中实现它之前,我正在尝试一些pod我想确保它能正常工作以满足我的要求。最简单的方法是在playground上尝试。我在playground上尝试了podinit,但它不起作用[!]Noxcodeprojectfound,pleasespecifyone非常感谢您的帮助。 最佳答案 这是一个老问题,但出现在谷歌的顶部。ThisCouldBeUsButYouPlaying是一个命令行工具,它使用集成的cocoapod创建一个新的Xcodeplayground。它还支持一次集成多个cocoapods。这是一个单一的命令。安装

swift - 我如何在快速的 Playground 中读取文件

我正在尝试使用Swiftplayground读取文本文件letdirs:String[]?=NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory.DocumentDirectory,NSSearchPathDomainMask.UserDomainMask,true)as?String[]if(dirs!=nil){letdirectories:String[]=dirs!;letdir=directories[0];//documentsdirectoryletpath=dir.stringByAppendingPathC

swift - 在 Swift Playground 中调试断点?

我试图在#gutter行中添加一个断点,但是当我在playground中执行此操作时没有添加任何断点。这是可能的还是有其他方法可以在Playground上设置断点? 最佳答案 没有调试器,因此您无法添加任何断点。 关于swift-在SwiftPlayground中调试断点?,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com/questions/29710286/

ios - 如何将 3rd 方框架导入 Xcode Playground?

如何将第3部分框架导入XcodePlayground?SwiftPlayground显然有一个框架导入机制,因为我们可以导入Cocoa、SpriteKit,并且在OSXPlayground中,XCPlayground(XCPlayground似乎从iOS中丢失了,很奇怪)我真正想做的是在我的playground中隐藏代码,并能够展示一个最小的示例。关于如何将框架加载到Swiftplayground有什么想法吗?另见:HowtoimportownclassesfromyourownprojectintoaPlaygroundIsitpossibletoimportthird-partyO