Built your first app using the terminal.
check tools:
swift --version-
create a folder for the project (optional)
- the name of the folder is
HelloSwift
mkdir HelloSwift cd HelloSwift - the name of the folder is
-
init
swift package init --type executable
-
run your project
swift run
expected output:
Hello, World!
-
open your project(name: HelloSwift) in Xcode
-
find the
main.swiftinSources -
edit the content and then save it(command +
s)from:
print("Hello, World!")
to:
print("Hello, Swift!")
-
go back to the terminal and run your project again
swift run
expected output:
Hello, Swift!