草庐IT

playGround

全部标签

ios - 是否可以在 iPad Swift Playground 中使用 Metal 着色器代码?

是否可以在iPadSwiftPlayground中使用自定义Metal着色器代码?如果是这样,如何将*.metal文件或代码(或其预编译对象)放到iPad上以与Playground和Swift代码一起使用?在Mac上使用Xcode是否需要帮助?(这个问题不是关于使用内置性能着色器,也不是关于在Mac上的Playground中运行东西) 最佳答案 你有两个选择:要么在Xcode中创建一个iOSPlayground,然后将它发送到你的iPad,但你不能编辑.metal文件,只能阅读它,就像thisexample中那样。;或者您可以将着色

ios - 如何让 SpriteKit Playgrounds 在 Xcode 8 beta 中工作?

我希望能够在Playgrounds中轻松制作我的SpriteKit代码原型(prototype)。这在Xcode7中工作正常importUIKitimportSpriteKitimportXCPlaygroundletsceneView=SKView(frame:CGRect(x:0,y:0,width:480,height:320))letscene=SKScene(size:CGSize(width:480,height:320))sceneView.showsFPS=truesceneView.presentScene(scene)XCPlaygroundPage.current

ios - 如何修复 Swift Playground 中的 'Couldn' t 查找符号错误

我有一个带有动态框架(称为“VisualKit”)和导入VisualKit的Playground的Xcode工作区。当VisualKit没有自己的外部依赖项时(即当VisualKit不依赖于任何额外的动态框架时),此设置工作正常。但是,当我添加一个动态框架时(在本例中我正在导入SnapKit,尽管它是什么框架并不重要),我收到以下错误:error:Couldn'tlookupsymbols:VisualKit.ItemsLabel.__allocating_init()->VisualKit.ItemsLabeltypemetadataaccessorforVisualKit.Item

ios - 在 iOS playground 中测试本地化

有没有办法将本地化的字符串放入iOSPlayground?我有许多从右到左的语言翻译,其中包括我必须使用十六进制编辑器编辑的格式代码(以确保代码的字节顺序正确),我希望手动检查格式化字符串的输出以确保它有效。顺便说一句,是否有任何MacOS文本编辑器允许您以从左到右的模式显示阿拉伯语和希伯来语? 最佳答案 我可以通过在playground的Resources文件夹中制作一个en.lproj来实现这个功能(注意我的系统是英文的,你可能需要把它放在你的语言的lproj中,让它在你的系统上工作)。需要注意的一件事是,如果您使用复数stri

ios - Xcode Playground 不执行功能

我创建了一个新的Playground并添加了简单的函数,但该函数从未被调用过:varstr="Newplayground"funchello(){print("Hello,World")}你们知道为什么函数没有被调用吗?非常感谢你的帮助 最佳答案 因为你没有调用函数。只需调用它:funchello(){print("Hello,World")}hello() 关于ios-XcodePlayground不执行功能,我们在StackOverflow上找到一个类似的问题:

macos - Playground 中未声明的类型 'NSView'

对于OSXPlayground,我输入以下代码:importCocoaclassPlayView:NSView{overridefuncdrawRect(dirtyRect:NSRect){letblue=NSColor.blueColor()blue.setFill()NSRectFill(self.bounds)}}varview=PlayView(frame:NSRect(x:0,y:0,width:200,height:200))然后我得到这个输出:Playgroundexecutionfailed::12:18:error:useofundeclaredtype'NSView

ios - 了解 Playground 中的输出

为什么下面的代码在Playground中输出如下...classVehicle{funcrun(){println("Running")//outputs---------Running}}varjetta=Vehicle()//outputs------------Vehiclejetta.run()//outputs----------------------Vehicle(whynotrunning?)最后一次调用的输出不应该是“Running”吗?当我在swiftstub.com上尝试相同的代码时或runswiftlang.com我得到了我期望的结果,但在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