Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Starting Swift REPL for iOS vs OSX

Tags:

macos

ios

swift

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.

like image 601
GoZoner Avatar asked Jun 24 '14 11:06

GoZoner


1 Answers

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

like image 111
Cezar Avatar answered Nov 11 '22 10:11

Cezar