Shared Album Permission to indicate which view to display

Have a simple, or what I think is simple view, that includes the below code

struct ContentView: View {
   
@StateObject var coordinator = Coordinator()

var body: some View {
     
  if coordinator.sharedAlbumPermission {
    sharedAlbumView()
  } else {
    permissionToAlbumView()
  }

}

My app has permission already for "All Photos".

The issue I am running into is that the "permissionToAlbumView()" displays for about 5 seconds before "sharedAlbumView()" displays.

When I change permission to "None" I only see "permissionToAlbumView()". When I update in settings then switch to my app the "sharedAlbumView()" displays right away.

Not sure why "permissionToAlbumView()" would display when permission is already given. I think the issue that the .sharedAlbumPermission is giving wrong value first and then updating but I could be wrong. If there is another and better way to code this I would greatly appreciate as new to Swift.

Have tried onAppear and onDisappear but does not seem to work either.

Shared Album Permission to indicate which view to display
 
 
Q