如何调用Swift REPL for iOS? 我尝试了swift -sdk ...的命令行参数,并且通过swift -h查看了其他调用参数,但是没有一个跳到我身上。
$ swift Welcome to Swift! Type :help for assistance. 1> import UIKit <REPL>:1:8: error: no such module 'UIKit' import UIKit ^Swift REPL在Mac上以“iOS”模式在Playground上运行; 只是希望从命令行获得相同的结果。
How does one invoke the Swift REPL for iOS? I tried the command line argument of swift -sdk ... and have looked, via swift -h, at the other invocation arguments but none jumps out at me.
$ swift Welcome to Swift! Type :help for assistance. 1> import UIKit <REPL>:1:8: error: no such module 'UIKit' import UIKit ^The Swift REPL runs in a Playground in 'iOS' mode on a Mac; just looking to get the same from the command line.
最满意答案
一种方法是创建一个iOS / OS X项目并设置一个断点来中断流程。 然后,输入repl到lldb控制台并享受。
有关这方面的更多信息,请参阅WWDC 2014会话409 - LLDB和Swift REPL简介。
One way to do this is to create an iOS/OS X project and set a break point to interrupt the flow. Then, enter repl into the lldb console and enjoy.
For more on this one, watch WWDC 2014 session 409 - Introduction to LLDB and the Swift REPL.
更多推荐
发布评论