Skip to content

Showing ToastUI on app load #30

@rursache

Description

@rursache

Pre-requisites:

  • Yes, I looked through both open and closed issues looking for what I needed.
  • No, I did not find what I was looking for.

Expected Behavior

Be able to show the ToastUI at app load. Useful when doing initial network requests like auth or other early tasks

Current Behavior

Currently the ToastUI does not appear

Steps to Reproduce

struct TestView: View {
    @State private var isLoading: Bool = false
	
    var body: some View {
        VStack {
            Text(isLoading ? "Please wait..." : "Got auth token")
                .padding()
            Spacer()
        }
        .toast(isPresented: $isLoading) {
            ToastView("Loading").toastViewStyle(.indeterminate)
        }
        .onAppear {
            self.isLoading = true
        }
    }
}

Context

I basically want to open the app and the ToastUI to be visible until some network requests are done in the background
Disclaimer: I'm still new to SwiftUI so i might try to achieve this the wrong way

Your Environment

  • Swift Version: 5.5
  • Xcode Version: 13.4
  • Operating System Version: macOS Monteray 12.4
  • Device or Simulator: Irrelevant

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions