Onboarding screen at launch of SwiftUI document-based app
Asked Answered
D

0

6

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
            ...
        }
    }
}
Deoxygenate answered 5/7, 2021 at 2:5 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.