How to start with SwiftUI
Published by @SoNiceInfo at 6/24/2020
Download Xcode
You need the latest Xcode to build iOS apps with SwiftUI.
If you don't have it, you can download it from the App Store.
「Xcode」- Mac App Store
Create a new project
1. Open Xcode and select Create a new Xcode project
2. Select a template simillar to your vision.
I select Single View App for this page.
3. Input about Projects
- You can change Team/Organization after the dialog.
- Choose SwiftUI for User Interface.
- Choose save place pressing Next button.
4. Hello World
Now you can start a SwiftUI project.
ContentView.swift
is a main page. (Like index.html
)Build
You need to build an app first.⌘ + B
to buildOr pushing play button on top left of Xcode.
Run
You can run your app on the simulator and iPhone.1. Select to run on the simulator or iPhone
You can select it by changing the name of the iPhone model to the right of the project name at the top left of Xcode.2. ⌘ + R
to run
3. Check the result
Note
If you're using macOS 10.15 or higher, you can use
Canvas
to verify the display.