Install Xcode and Create Your First iOS App
Step 1: Install Xcode
- Open the Mac App Store and search for Xcode.
- Click Get and wait for the download. It is a very large file.
- Open Xcode once and accept the license. Let it install the extra components.
- On first launch you may also be asked to download the iOS platform and simulator. Allow it.
Version note: Apple requires apps submitted to the App Store to be built with Xcode 26 or later (iOS 26 SDK) since April 28, 2026. So install the newest stable Xcode that your Mac supports. Check developer.apple.com/xcode/system-requirements for macOS requirements.
Step 2: Create a New Project
- Open Xcode and choose Create New Project (or File > New > Project).
- Select the iOS tab and the App template. Click Next.
- Product Name:
HelloApp - Team: choose your Apple ID (or None for the Simulator)
- Organization Identifier: something like
com.yourname - Interface: SwiftUI
- Language: Swift
- Storage: None for now. Testing options can stay as they are.
- Click Next and choose a folder to save the project.
Step 3: Run the App
- At the top of the window choose a simulator, for example iPhone 16 Pro (or the newest one in the list).
- Press the Play button (or Cmd + R).
- Wait while the Simulator starts and shows your app.
You will see a globe icon and the text Hello, world!. Congratulations, that is a real iOS app.
Step 4: Read the Code
swift
import SwiftUI
struct ContentView: View {
var body: some View {
VStack {
Image(systemName: "globe")
.imageScale(.large)
.foregroundStyle(.tint)
Text("Hello, world!")
}
.padding()
}
}
#Preview {
ContentView()
}
| Code | Meaning |
|---|---|
import SwiftUI | Use the SwiftUI framework |
struct ContentView: View | A screen (view). Every view conforms to the View protocol |
var body: some View | Describes what the view looks like. Required by every view |
VStack | Puts its children in a vertical stack |
Image(systemName:) | Shows an SF Symbol, one of thousands of built-in icons |
Text | Shows text |
| .padding() | A modifier that adds space around the view |
#Preview | Shows a live preview in the Xcode canvas |
Step 5: Change It
swift
struct ContentView: View {
var body: some View {
VStack(spacing: 16) {
Image(systemName: "iphone")
.font(.system(size: 60))
.foregroundStyle(.blue)
Text("My first iPhone app")
.font(.title)
.fontWeight(.bold)
Text("Built with SwiftUI")
.foregroundStyle(.secondary)
}
.padding()
}
}
Save with Cmd + S. If the canvas is hidden, open it with Editor > Canvas (or Option + Cmd + Return) and press Resume to see the live preview.
Run on Your Real iPhone (Optional)
- Connect your iPhone with a cable and trust the computer.
- On the iPhone enable Developer Mode in Settings > Privacy & Security.
- In Xcode, open the project settings > Signing & Capabilities, tick Automatically manage signing and choose your Team.
- Select your iPhone as the run destination and press Play.
Common problem: If you see a signing error, make sure a Team (your Apple ID) is selected and the Bundle Identifier is unique, for example
com.yourname.HelloApp.
Conclusion
You installed Xcode, built a SwiftUI app and ran it on the Simulator. The preview canvas lets you see changes instantly while you write code.
Quick Summary: Create an iOS App project with SwiftUI, press Run to start the Simulator and edit ContentView to change the screen.

