Releases: SwiftfulThinking/SwiftfulRouting
4.0.2
New Feature
Add ability to open safari for a URL
router.showSafari {
URL("https://www.google.com")!
}
4.0.1
Updated for iOS 17
- Fix NavigationStack dismissal bugs.
- Drop support for iOS 13 due to StateObject problem on Xcode 14.3.
- UITests are in the SwiftfulRoutingExample sample project
- 🚨 Version 4.0.1 & 2.0.2 are stable. Do not use version 3.0.0 -> 3.0.3.
Full Changelog: 4.0.0...4.0.1
2.0.2
Same build as 2.0.1, but drops support for iOS 13 due to StateObject problem on Xcode 14.3.
3.0.3
Another fix related to 3.0.2, now manually tracking screenStack index
- Bug originally introduced in 3.0.0 on iOS 16 only relating to .pushStack support
3.0.2
Fixed a bug where single-dismiss after a .push segue did not clear last item in screenStack
- Bug introduced in 3.0.0 on iOS 16 only relating to .pushStack support
3.0.0
Version 3.0.0 is a major update to the framework, supporting new iOS 16 modifiers, enabling iOS 13 support, and removing Router from the Environment.
1. Breaking Change: Removing Router from the Environment
Version 1.0 < 3.0 added a new Router as an EnvironmentObject to the destination of each View. While this worked, it was not efficient and made it hard to track the view hierarchy. Version 3.0 returns the router back to the segue's call-site, which gives the developer more control and allows for injection of the routing logic into the View.
If you are using a version < 3.0: Version 2.0.1 is a stepping stone to 3.0.0. It contains the previous EnvironmentObject methods as well as the new escaping Router.
// Version 1.0, 2.0
router.showScreen(.push) {
MyView()
}
// Version 2.0.1
router.showScreen(.push) { router in
MyView()
}
// Version 3.0
router.showScreen(.push) { router in
MyView(router: router)
}
2. NavigationStack support
As of iOS 16, NavigationStack allows multiple views to be pushed onto the view stack at one time. Use .pushScreens() to push onto the stack and .popToRoot() to dismiss the entire stack.
let screen1 = { router in
MyView1(router: router)
}
let screen2 = { router in
MyView2(router: router)
}
let screen3 = { router in
MyView3(router: router)
}
Button("Push Stack (3x)") {
router.pushScreens(destinations: [screen1, screen2, screen3])
}
iOS 16 also added .sheetDetents modifiers for resizable Sheets. Use .showResizableSheet().
// Sheet can be dragged between .medium and .large sizes by user.
router.showResizableSheet(
sheetDetents: [.medium, .large],
selection: nil,
showDragIndicator: true) { router in
MyView(router: router)
}
// Bind to selection to programmatically resize sheet.
router.showResizableSheet(
sheetDetents: Set(detents),
selection: $sheetSelection,
showDragIndicator: false) { router in
MyView(router: router)
}
3. iOS 13 support
Previous versions did not support iOS 13. Version 3.0 does, however, some features are not compatible, such as .fullScreenCover.
If you are using Alert on iOS 13, you MUST include the 'buttonsiOS13' parameter.
router.showAlert(.alert, title: "Title goes here", subtitle: "Subtitle goes here!", alert: {
alertButtonsiOS15
}, buttonsiOS13: alertButtonsiOS13)
2.0.1
Version 2.0.1
1. Breaking change: Updates to segues that make Router @escaping
Previously written code...
router.showScreen(.push) {
Text("")
}
now requires contextual closure:
router.showScreen(.push) { router in
Text("")
}
This is a step toward version 3.0, which will deprecate the EnvironmentObject pattern for this method, where we manually pass Router to the next view. This will give developer more control over the hierarchy and allow routing logic to be injected into the views.
2. Support subtitle on Alert and ConfirmationDialog.
.showAlert(.alert, title: String, subtitle: String?) {
alertButtons
}
2.0.0
Version 2.0.0 adds TopRouter as an additional @EnviromentObject
1.0.0
Version 1.0 introduces Router