启动iOS与OSX的Swift REPL(Starting Swift REPL for iOS vs OSX)

编程入门 行业动态 更新时间:2024-10-24 12:25:14
启动iOS与OSX的Swift REPL(Starting Swift REPL for iOS vs OSX)

如何调用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简介。

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.

repl

更多推荐

本文发布于:2023-08-04 11:56:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1416101.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:OSX   iOS   Swift   Starting   REPL

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!