草庐IT

PlayGround

全部标签

Xcode 不断询问我是否要开一个 playground

如果我想打开从互联网上下载的Playground,系统会询问我是否要打开该Playground。我说是,但每次我回到它时它都会问。thisNSHipsterplayground出现问题.不需要其他步骤。Xcode版本为6.3.2(6D2105)有什么办法可以解决这个问题吗?澄清一下:我在我的安全设置中选中了“任何地方”。我也尝试过执行chown和chmod,但没有帮助。 最佳答案 这可能与您的安全设置有关:检查是否检查了任何地方。 关于Xcode不断询问我是否要开一个playground

xcode - Playground 中的鼠标事件 (NSTrackingArea) 不起作用

我有一个NSView的子类,其中包含以下NSTrackingArea代码。但出于某种原因,鼠标事件不会在Playground中触发。正在调用viewWillMoveToWindow,但似乎没有其他任何东西触发。有没有人知道缺少什么?classMyView:NSView{privatevartrackingArea:NSTrackingArea=NSTrackingArea()//Otherstuffomittedhere...//...overridefuncviewWillMoveToWindow(newWindow:NSWindow?){//Setupanewtrackingare

swift - 重复调用函数以在 Swift playground 中产生当前时差

在swiftplayground中,为什么这段代码不更新。我试图让它输出准确的时间(将来会有倒计时),但我无法更新当前时间,它只是重复相同的时差几次。//initializethedateformatterandsetthestyleletformatter=NSDateFormatter()formatter.timeStyle=NSDateFormatterStyle.MediumStyleformatter.dateStyle=NSDateFormatterStyle.ShortStyle//getthedatetimeStringfromthedateobjectletcurr

ios - iPhone 上的 Swift playground

我目前正在学习Swift,我希望用CMMotionManager测试一些想法。具体来说,我想绘制磁力计的输出图形。Playgrounds可以做到这一点吗?即,我能否编写将在实际连接的iPhone或iPad(而非模拟器)上运行的代码,但在我正在开发的Mac上看到显示的图形和结果? 最佳答案 似乎简单的答案是“不”。引用Swift Playgrounds–WWDC 2014 Session 408的文字记录:SoanythingwhichrequiresadevicewillnotbesupportedwithPlaygrounds.不

swift - 为什么 NSBezierPath 的这个简单子(monad)类会使我的 OSX Playground 崩溃?

我正在尝试通过子类化将存储的属性添加到NSBezierPath。但是,以下代码会使Playground崩溃:importCocoaclassMyNSBezierPath:NSBezierPath{privatevarsomeProperty:Booloverrideinit(){someProperty=falsesuper.init()}requiredinit?(coderaDecoder:NSCoder){self.someProperty=falsesuper.init(coder:aDecoder)}}//thefollowinglinecausesthePlayground

swift - 无法在 Swift playground 中向 SKScene 添加滑动识别器?

好吧,我对swiftplayground的工作原理还是有点陌生​​,但我正在尝试将Swift3中的滑动手势识别器添加到我的swiftplayground。按照这个http://www.spritekitlessons.com/gesture-recognizer-with-sprite-kit-and-swift/我现在有:funcswipedRight(sender:UISwipeGestureRecognizer){print("swipedright")}funcswipedLeft(sender:UISwipeGestureRecognizer){print("swipedle

core-data - 可以在 Swift Playground 中使用 Core Data 吗?

我刚开始使用Swift,想知道Playgrounds是否可以访问CoreData。如果是这样,在将数据库放入iOS项目之前预先填充数据库会非常方便。 最佳答案 在iOSPlayground中,您可以成功导入CoreData,然后调用CoreData接口(interface)中定义的函数。 关于core-data-可以在SwiftPlayground中使用CoreData吗?,我们在StackOverflow上找到一个类似的问题: https://stackov

swift - RemoveAtIndex 崩溃 Playground

我正在尝试使用String的removeAtIndex函数从字符串中删除Character。但它会使Playground崩溃。完整代码如下:letstring="SomeString"letstart=advance(string.startIndex,2)letx=string.removeAtIndex(start) 最佳答案 您已使用let声明了string,这使其不可变。由于您只能在mutableString上调用removeAtIndex,因此您可以通过使用声明string来解决此问题var代替:varstring="So

objective-c - 在应用程序中嵌入 Xcode Playground

我想制作一个CocoaOSX应用程序,用户可以在我的应用程序的一个窗口中输入和执行Swift语言代码。我的第一个想法是自己做一个基本的IDE,用系统调用来进行编译和执行;但是,我真的很想拥有交互式Playground功能。我做了研究,发现我可以创建带有嵌入式文档的XcodePlayground文件,但这引发了一个问题:Doesthedocumentationhavetobeplacedaboveandbelowtheplayground,orcanIembedaPlaygroundwithinacontainerinmyHTMLcode?我所说的XcodePlayground嵌入式文档

swift - 是否可以在 Playground 上模拟设备方向?

鉴于这种情况:XCPlaygroundPage.currentPage.liveView=TableViewController()是否可以模拟设备的方向? 最佳答案 基于在here中找到的一些逻辑KIFtestingframework,我想这应该是可能的。链接背后的Objective-C代码如下所示:-(void)simulateDeviceRotationToOrientation:(UIDeviceOrientation)orientation{[[UIDevicecurrentDevice]setValue:[NSNumbe