0

Is there some console interface for Swift?

For example with Ruby, Python(or even Scala) I can run a REPL and check something. Like this(example from Python REPL):

>>> [1] + [2] 
[1, 2]

I know about playgrounds but they are slow(Interface is slow) and annoying if you want to check something

kharandziuk
  • 12,020
  • 17
  • 63
  • 121
  • Right from the main Swift page https://developer.apple.com/swift/: "**Read-Eval-Print-Loop (REPL).** The LLDB debugging console in Xcode includes an interactive version of the Swift language built right in. Use Swift syntax to evaluate and interact with your running app, or write new code to see how it works in a script-like environment. Available from within the Xcode console **or in Terminal.**" – Martin R Nov 05 '15 at 10:04
  • @MartinR Ok, so how should I run it? – kharandziuk Nov 05 '15 at 10:07
  • [Introduction to the Swift REPL](https://developer.apple.com/swift/blog/?id=18) from the Swift blog. Also answered in the referenced thread. – Martin R Nov 05 '15 at 10:09

1 Answers1

2

Try in the terminal:

xcrun swift
Kirell
  • 9,228
  • 4
  • 46
  • 61