jjzjj

Playgrounds

全部标签

xml - 使用 XML 解析 Swift 库时,Playgrounds 崩溃并显示 "unknown error"

我正在开发一个涉及一些XML解析的自定义框架,使用Kanna框架。每当我尝试将我的框架导入playground时,playground就会崩溃并出现以下错误:Playgroundexecutionfailed:expressionfailedtoparse,unknownerror*thread#1:tid=0x4e9448,0x00000001074bf360com.apple.dt.Xcode.PlaygroundStub-macosx`executePlayground,queue='com.apple.main-thread',stopreason=breakpoint1.1*

ios - Swift Playgrounds 中的 JavaScriptCore

我目前正在开发一个应该可以在我的iPad上运行的SwiftPlayground。它使用的是关于Apple应该可用的JavaScriptCore:https://developer.apple.com/library/content/documentation/Xcode/Conceptual/swift_playgrounds_doc_format/AvailableSDKs.html#//apple_ref/doc/uid/TP40017343-CH5-SW2有谁知道如何导入和使用它?我的iPad总是说找不到模块。我使用的是最新的iOS版本10.3。 最佳

ios - 以编程方式在 Xcode Playgrounds 中创建 UIView 子类

XcodePlaygrounds中的UIViewController和UIView类我想弄清楚如何在XcodePlaygrounds中创建UIViewController并将UIView子类附加到它。我对swift和编码还很陌生,所以遇到了一些麻烦。classmyView:UIView{varlabel:UIButton!vartopHeader:UIImageView!varnameText:UITextField!varpassword:UITextField!overrideinit(frame:CGRect){super.init(frame:CGRect(x:10,y:10,

swift - 实例化子类在 Swift playgrounds 中有效,但使用类本身却不行

我更新了AudioKit的代码,现在playgrounds(在develop分支上)不能正常工作,在研究中我发现了一个奇怪的情况varoscillator=AKOscillator()产生崩溃,但只是使用该类的一个普通子类:classAKSubclassOfOscillator:AKOscillator{}varoscillator=AKSubclassOfOscillator()工作得很好。有人可以阐明这怎么可能发生吗?这个SwiftPlayground在Xcode10中运行/崩溃。应用程序中的类似代码不会崩溃,只会在playground内崩溃。这是日志Playgroundexecu

ios - 无法在 Playgrounds 中使用 Alamofire 查找符号错误

我正在使用Playgrounds并通过Podfile安装了Alamofire和SwiftSoup。我可以使用URLSession从URL中检索HTML,但希望使用Alamofire这样做。我的代码如下。leturl="https://www.nba.com/warriors/stats"Alamofire.request(url,method:.post,parameters:nil,encoding:URLEncoding.default).validate(contentType:["application/x-www-form-urlencoded"]).response{(re

ios - UITableViewCell 不显示数据 - Swift Playgrounds

我一直在尝试在我在swiftplaygroundsiPad应用程序的ViewController中创建的TableView中实现一些自定义单元格。请注意,我已经看到很多其他处理类似问题的堆栈溢出帖子,但未能找到解决我的问题的解决方案。这是我的CustomCell类:classCustomCell:UITableViewCell{letprojectImage=UIImageView()//letprojectDivider=UIView()letprojectTitle=UILabel()overridefuncawakeFromNib(){projectImage.frame=CGR

ios - iPad 上的 Swift Playground 可以包含多个源文件吗?

我只是想知道这是否可能:我在Xcode上打开了一个playground,其中包含多个.swift源文件,可通过public访问器访问。在iPad的SwiftPlaygrounds上也能实现同样的效果吗? 最佳答案 是的,这是可能的。在Apple的网站上,他们声明:Becauseyou’reworkingwithrealcode,youcanimportandexportdirectlybetweenSwiftPlaygroundsandXcode.Soyoucantryoutyourideaswiththetoolprosuseto

ios - Swift playgrounds ios 10 文字转语音命令代码

我在iOSiPad上使用swiftplaygrounds创建文本转语音命令。下面是代码。importAVFoundationletsynthesizer=AVSpeechSynthesizer()letutterance=AVSpeechUtterance(string:"SayHello")utterance.rate=1synthesizer.speak(utterance:AVSpeechUtterance)//当我点击“运行我的代码”时。我收到错误消息“尝试评估编辑器占位符”我不知道这个错误是什么意思。希望有人能提供帮助。谢谢你。 最佳答案

swift - Playgrounds "Collect, Toggle, Repeat"包含 10 个或更少的基本命令?

iPadPlaygroundsapp,很早的挑战:你正在学习编程,你对变量、循环等一无所知。你唯一知道的关键字是func。游戏建议您第一次构建自己的功能。基本上,您只会使用屏幕上显示的内容:collectGem()、moveForward()、name()、toggleSwitch(),turnLeft(),turnRight()。你不会意外摔倒(所以额外的Action是可以接受的),目标是收集4颗gem并切换4个开关。我的第一次尝试是:谜题解决了,但告诉我:butyouused11commands!Trydefiningyourownfunction[...]Youwon'tneed

swift - 如何在 Playgrounds 中设置 ViewController?

在swiftplaygrounds中,如何设置和使用ViewController?我以前用UIView做过,但是当方向不同时UI会被切断,所以我想尝试使用viewcontroller。我有letview=UIViewController()但在那之后我如何设置它来添加背景和东西? 最佳答案 要在Swiftplayground中创建ViewController,您需要以下代码:importUIKitimportPlaygroundSupportclassViewController:UIViewController{overridef