Skip to content

Latest commit

 

History

History
76 lines (49 loc) · 955 Bytes

File metadata and controls

76 lines (49 loc) · 955 Bytes

first swift app

purpose

Built your first app using the terminal.

prepare

check tools:

swift --version

steps

  1. create a folder for the project (optional)

    • the name of the folder is HelloSwift
    mkdir HelloSwift
    cd HelloSwift
  2. init

    swift package init --type executable
  3. run your project

    swift run

    expected output:

    Hello, World!

test

  1. open your project(name: HelloSwift) in Xcode

  2. find the main.swift in Sources

  3. edit the content and then save it(command + s)

    from:

    print("Hello, World!")

    to:

    print("Hello, Swift!")
  4. go back to the terminal and run your project again

    swift run

    expected output:

    Hello, Swift!

reference

  1. https://www.swift.org/getting-started