10

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.

Cezar
  • 55,636
  • 19
  • 86
  • 87
GoZoner
  • 67,920
  • 20
  • 95
  • 145

1 Answers1

11

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

Cezar
  • 55,636
  • 19
  • 86
  • 87