How to start with SwiftUI
Published by @SoNiceInfo at 6/24/2020
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.swiftis a main page. (Like
BuildYou need to build an app first.
⌘ + Bto build
Or pushing play button on top left of Xcode.
RunYou can run your app on the simulator and iPhone.
1. Select to run on the simulator or iPhoneYou can select it by changing the name of the iPhone model to the right of the project name at the top left of Xcode.
⌘ + R to run
3. Check the result
If you're using macOS 10.15 or higher, you can use
Canvasto verify the display.