How to run the Swift application in a Mac OS terminal _swift

Source: Internet
Author: User

After reading the Apple Developer document (Apple Developer Docs), I found that:

"The Xcode debugger includes an interactive version of the Swift language called REPL (read-eval-print-loop) ... can be accessed through the Xcode console or terminal.

Unfortunately, it doesn't tell you how to access from the terminal. Fortunately, this is not a difficult thing.

Enter the following command (whichever beta you use to change the app's name)


Copy Code code as follows:
Alias swift= "/applications/xcode6-beta2.app/contents/developer/toolchains/xcodedefault.x

In the terminal window, you see the following information. Enter Swift now and you will see the Welcome page.

Note: When a new beta is present, you need to update your alias, enter the same command, different app names. For example, Xcode6-beta3.app.

Now you can see your swift code:

Finally, if you type: Help, then the LLDB debugging commands are handy.

Why don't you load Swift playground?

This is a good question. I personally appreciate the ability to program without a syntax error without starting Xcode 6 beta and opening a swift playground. Again, I am sure to comply with NDA, I will not post a screenshot of Xcode 6 until it is finally released.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.