I am referring to the following SKCloudServiceController.requestAuthorization
method. Once the status is authorized, I would like to update @State var showStart = false
so that the view can be pushed to the next one.
if (showStart) {
NavigationLink(destination: Main(), isActive: $showStart) {
EmptyView()
}.hidden()
}
SKCloudServiceController.requestAuthorization { (status) in
if status == .authorized {
print(AppleMusicAPI().fetchStorefrontID())
showStart = true
}
}
But after this runs and the status is authorized, the app freezes and does not change showStart.
Fixed by implementing the following function instead. It allows
SKCloudServiceController.requestAuthorization
to finish and then upon completion, setshowStart
to true.