Skip to content

Commit

Permalink
Disables entrance animation during restore on iOS 16+ or watchOS 9+.
Browse files Browse the repository at this point in the history
  • Loading branch information
mntone committed Jan 4, 2024
1 parent 1477085 commit 777fd6d
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/App/Views/Navigations/NavigationPathHost.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,23 @@ struct NavigationPathHost<Content: View>: View {
var body: some View {
content($path)
.task {
path = await RouteHelper.load(from: pathString)
await loadPath()
}
.onDisappear {
storePath()
}
.onReceive(NotificationCenter.default.publisher(for: .platformWillResignActiveNotification), perform: storePath(_:))
}

private func loadPath() async {
let path = await RouteHelper.load(from: pathString)
var transaction = Transaction()
transaction.disablesAnimations = true
withTransaction(transaction) {
self.path = path
}
}

private func storePath(_: Notification) {
storePath()
}
Expand Down

0 comments on commit 777fd6d

Please sign in to comment.