How do I access Swift's REPL?
After installing the Xcode6 beta, do
$ sudo xcode-select -s /Applications/Xcode6-Beta.app/Contents/Developer/
$ xcrun swift
is a Swift REPL
EDITED:
For XCode 6, use:
xcrun swift -sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk
Starting Swift REPL for iOS vs OSX
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.
Can one embed the Swift REPL inside macOS or iOS app?
No. You can talk to the REPL from within Xcode while paused in your app (running from Xcode) at a breakpoint, but that's as close as you can come.
How can I use swift in Terminal?
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
then you can do one of these:
xcrun swift
lldb --repl
As of Xcode 6.1 - typing swift
in the terminal launches the REPL as well.
Related Topics
Uicollectionview Scrolling in Both Directions
Ios: Differencebetween -Init and -Viewload of a Viewcontroller
Open Target="_Blank" Links Outside of Uiwebview in Safari
iOS Find Color at Point Between Two Colors
Does Non-Renewing Subscription Requires a Restore Button
Using Collectionview in Uiview with Xib File
iOS - How to Make an Animation Track Touches
Can an iOS App Switch to Safari Without Opening a Page
What Does Inherit! :Search_Paths Do
Uialertcontroller Text Alignment
Expand and Collapse Tableview Cells
How to Schedule Local Notification for the Following Scenario
Will iOS Wake Up the Terminated App If It's Registered with Location for Uibackgroundmodes
Using Tint Color on Uiimageview
Implementing Auto Layout for Views Generated Programmatically