I would recommend starting with making an app that just says, "Hello World"!
It was really easy in UIKit, but it's even easier with SwiftUI.
Download Xcode - https://apps.apple.com/us/app/xcode/id497799835?mt=12
Wait an hour for it to download
Open Xcode and the Welcome Screen will pop up. Click "Create a new Xcode project"
Choose "Single View App"
Enter the "Product Name" (name of your app). For "Organization Name", enter your name. For "Organization Identifier", it's formatted in reverse domain name notation, which is basically "com" followed by your domain name, and then your product name. It's ok if you don't own a domain, just make one up. Example: com.myfirstappdomain.FirstApp. Also, make sure "SwiftUI" is selected for the User Interface.
Press "Next" and choose the location where you want to save your app. Don't worry about Source Control for now.
Press "Create"!
Once Xcode finishes generating the project, you should see the following lines of code inside the editor:
/*
// ContentView.swift
// FirstApp
//
// Created by Your Name on 6/19/20.
// Copyright © 2020 Your Name. All rights reserved./
import SwiftUI
struct ContentView: View {
var body: some View {
Text("Hello, World!")
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
Here's the above code explained:
First, you import SwiftUI, which loads the framework. SwiftUI lets you make apps by writing out what you want to see.
To write out the user interface, your code goes in a struct, which is building block that you can add properties and store values in. body is a property, and inside is a Text object (which comes from SwiftUI). What the code says is, Here's a struct that contains some text that says "Hello World!"
In our case, we want to see "Hello World!" (no comma) so you can remove the comma that Xcode auto-generated. Or you can keep it if you want 😁.
Underneath all the code is another struct, ContentView_Previews. This is for Xcode to know what you want to display in the live preview. You don't need to worry about this.
Now all that's left is to run the app! In the upper-left corner of the screen, first make sure you select an iOS device to simulate on (<Your App's Name> → iPhone 8). Then, press Command + r to run! You may be asked to sign in to your Apple ID, and if there's any errors, try signing in.
A simulated device will appear on your screen after a while, and it says, "Hello World"! Here's a screenshot - https://github.com/zjohnzheng/DeveloperAssets/blob/master/helloWorldFirstApp.png. That's it! Your first app!
To get more advanced, you can make use of resources on the internet. Hacking With Swift and Ray Wenderlich are both free resources that are great places to start (search them on Google, I couldn't put the links because they weren't allowed on the Forums). You can also go on Udemy and buy a course, like what I did (usually around $10) -- I would recommend following more tutorials before you start making your own apps (it'll be much easier once you know the basics). And if you're ever stuck, you can post questions on Stack Overflow - https://stackoverflow.com/, or do what you just did, ask on the Forums!
Happy coding!