为iOS和OSX启动Swift REPL [英] Starting Swift REPL for iOS vs OSX

查看:253
本文介绍了为iOS和OSX启动Swift REPL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何调用适用于iOS的Swift REPL?我尝试了 swift -sdk ... 的命令行参数,并通过 swift -h 查看了其他的调用参数,但没有一个跳出来。

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
       ^

Swift REPL在Mac上以iOS模式运行在Playground中;只是希望从命令行获得相同的结果。

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项目并设置一个断点来中断流程。然后,在lldb控制台中输入 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.

有关此内容的更多信息,请观看WWDC 2014会话409 - LLDB和Swift REPL简介。

For more on this one, watch WWDC 2014 session 409 - Introduction to LLDB and the Swift REPL.

这篇关于为iOS和OSX启动Swift REPL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆