I read What's new in Xcode 6. The article introduces some new feature about Xcode 6, and it says:
Command Line
Xcode’s debugger includes an interactive version of the Swift language, known as the REPL (Read-Eval-Print-Loop). Use Swift syntax to evaluate and interact with your running app or write new code in a script-like environment. The REPL is available from within LLDB in Xcode’s console, or from Terminal.
I want to know how to get the REPL?
If you've installed the latest version of Xcode you should have a swift command available in your terminal, which launches a Swift REPL 1. You can run the Swift REPL from the command line and enter Swift code directly into it. Whenever you enter valid Swift code in the REPL, it will immediately compile and run it.
A Logical Terminal is the entity through which users send and receive FIN messages.
Go to the Swift website and download the recommended toolchain for your version of Linux. As of this writing, Apple only supports Ubuntu, so the tutorial will use that distribution. This step installs the required dependencies and unpacks the toolchain to ~/swift . This will build and run the project.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With