Skip to content

Commit 8f96634

Browse files
committed
refactor: swap the order of rootReloadLast parameters
1 parent 37b9f97 commit 8f96634

4 files changed

Lines changed: 8 additions & 10 deletions

File tree

Examples/MVI-Example/MVI-Example/Feature/Page3/Page3Intent.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ extension Page3Intent: IntentType, Page3IntentType {
5656
case .onTapClose:
5757
navigator.close(isAnimated: true) {
5858
print("modal dismissed!")
59-
self.navigator.rootReloadLast(isAnimated: false, items: [:])
59+
self.navigator.rootReloadLast(items: [:], isAnimated: true)
6060
}
6161
}
6262
}

Examples/TCA-Example/TCA-Example/Feature/Page3/Page3SideEffect.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ extension Page3SideEffectLive: Page3SideEffect {
4747
{
4848
navigator.close(isAnimated: true) {
4949
print("modal dismissed!")
50-
navigator.rootReloadLast(isAnimated: false, items: [:])
50+
navigator.rootReloadLast(items: [:], isAnimated: false)
5151
}
5252
}
5353
}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ If you'd like to contribute a translation, please [open a PR](https://github.com
122122
- forcely reload the last page behind the modal. This is useful when you need to call the [onAppear(perform:)](https://developer.apple.com/documentation/swiftui/view/onappear(perform:)) again.
123123

124124
```swift
125-
navigator.rootReloadLast(isAnimated: false, items: [:])
125+
navigator.rootReloadLast(items: [:], isAnimated: false)
126126
```
127127

128128
<br>

Sources/LinkNavigator/Core/LinkNavigator.swift

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -296,14 +296,14 @@ public protocol LinkNavigatorType {
296296
///
297297
/// case .onTapSignIn:
298298
/// // some signing in process...
299-
/// navigator.rootReloadLast(isAnimated: false, items: [:])
299+
/// navigator.rootReloadLast(items: [:], isAnimated: false)
300300
/// navigator.close(isAnimated: true, completeAction: { })
301301
/// ```
302302
///
303303
/// - Parameters:
304-
/// - isAnimated: makes the transition to be animated.
305304
/// - items: A dictionary of `String` type key-value pairs.
306-
func rootReloadLast(isAnimated: Bool, items: [String: String])
305+
/// - isAnimated: makes the transition to be animated.
306+
func rootReloadLast(items: [String: String], isAnimated: Bool)
307307

308308
/// Presents a system Alert.
309309
///
@@ -496,9 +496,7 @@ extension LinkNavigator: LinkNavigatorType {
496496

497497
public func close(isAnimated: Bool, completeAction: @escaping () -> Void) {
498498
guard isSubNavigationControllerPresented else { return }
499-
rootNavigationController.dismiss(animated: isAnimated, completion: {
500-
completeAction()
501-
})
499+
rootNavigationController.dismiss(animated: isAnimated, completion: completeAction)
502500
}
503501

504502
public func range(path: String) -> [String] {
@@ -507,7 +505,7 @@ extension LinkNavigator: LinkNavigatorType {
507505
return Array(currentPaths[start...max(start, end)])
508506
}
509507

510-
public func rootReloadLast(isAnimated: Bool, items: [String : String]) {
508+
public func rootReloadLast(items: [String : String], isAnimated: Bool) {
511509
guard let lastPath = rootCurrentPaths.last else { return }
512510
guard let new = builders.first(where: { $0.matchPath == lastPath })?.build(self, items, dependency) else { return }
513511
let joinedViewControllers = Array(rootNavigationController.viewControllers.dropLast()) + [new]

0 commit comments

Comments
 (0)