| |

How to Create a Hello World iOS app using Swift

This tutorial is for absolute beginners who are about to start iOS app development. Here, I create a simple Hello World iOS mobile app which shows the text hello world. By creating this, you will know how to get started with iOS app development.

Make sure that your Mac has the latest Xcode installed. Open Xcode and choose Create a new Xcode project.

xcode hello world

Then select iOS from the top menu and click on the App option. Proceed to click on Next button.

ios hello world app

The next step is to give a name to your app. The Interface should be SwiftUI and Language should be Swift. Then click on the Next button.

xcode hello world app

Proceed to choose your project location. Then Xcode shows the code editor and app preview. The ContentView.swift file is the entry point to the app.

Open ContentView.swift and clear the already existing code. Copy and paste the below code to the file.

import SwiftUI

struct ContentView: View {
    var body: some View {
        Text("Hello World!")

struct ContentView_Previews: PreviewProvider {
    static var previews: some View {

There are two structures where the first one returns a View with Text. The second structure shows a preview of the ContentView.

You can see the preview of your code instantly. Try changing the text and see how the preview changes.

swiftui hello world app

You can build your app and run it on the iOS simulator by pressing the Play button.

That’s how you create a Hello World iOS application using Xcode and Swift. I hope this beginner tutorial is helpful for you.

Similar Posts