Component

Progress Bars

Learn to add Progress Bars to your iOS App (Supports Xcode 16 and iOS 18)

Progress Bars

Just copy the below code and modify according to your needs.

import SwiftUI

struct ContentView: View {
    @State private var progress = 0.0 // State variable to track progress

    var body: some View {
        VStack {
            ProgressView("Loading...", value: progress, total: 100) // Progress bar
                .progressViewStyle(LinearProgressViewStyle()) // Style of the progress bar
                .padding()

            Button("Start Loading") {
                startLoading() // Start the loading process
            }
            .padding()
        }
        .padding()
    }

    func startLoading() {
        progress = 0.0 // Reset progress
        for i in 1...100 {
            DispatchQueue.main.asyncAfter(deadline: .now() + Double(i) * 0.1) {
                progress = Double(i) // Update progress
            }
        }
    }
}

@main
struct ProgressIndicatorApp: App {
    var body: some Scene {
        WindowGroup {
            ContentView() // Main content view
        }
    }
}

Time to build your iOS App?

ShipiOS provides you SwiftUI boilerplate, How-to Guides, Components Library and extra rewards!

Get ShipiOS Package
ShipiOS.App

I told you it's more than just a boilerplate :)

Made with ❤️ on 🌍

Need help? Reach out on:

© Copyright 2024 ShipiOS.App - All rights reserved.