Sami Almalki
Sami Almalki

Reputation: 628

Onboarding screen at launch of SwiftUI document-based app

Is there anyway at all, to show an onboarding screen at the launch of a SwiftUI document-based app, before the file picker screen appears?

What I can do now, is to show the onboarding screen AFTER user creates a new file, or opens an existing file, using UserDefaults:

import SwiftUI

struct ContentView: View {
    @Binding var document: AnyDocument
    @State var onboarding: Bool
    
    var body: some View {
        if onboarding {
            OnBoarding(showOnboarding: $onboarding)
        } else {
            // Normal document view
            ...
        }
    }
}

Upvotes: 6

Views: 393

Answers (0)

Related Questions