Skip to content

Commit 3c4e4ba

Browse files
committed
refactor: rename new methods
1 parent 363a455 commit 3c4e4ba

1 file changed

Lines changed: 32 additions & 24 deletions

File tree

Sources/LinkNavigator/Core/LinkNavigator.swift

Lines changed: 32 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public protocol LinkNavigatorType {
6464
/// ```
6565
///
6666
/// - Parameters:
67-
/// - paths: An array of ``RouteBuilder/matchPath`` for the specific page.
67+
/// - paths: An array of ``RouteBuilder/matchPath`` for some specific pages.
6868
/// - items: A dictionary of `String` type key-value pairs.
6969
/// - isAnimated: makes the transition to be animated.
7070
func next(paths: [String], items: [String: String], isAnimated: Bool)
@@ -75,7 +75,7 @@ public protocol LinkNavigatorType {
7575
/// - Note: If the modal is inactive, this method does same thing as ``next(paths:items:isAnimated:)``.
7676
///
7777
/// - Parameters:
78-
/// - paths: An array of ``RouteBuilder/matchPath`` for the specific page.
78+
/// - paths: An array of ``RouteBuilder/matchPath`` for some specific pages.
7979
/// - items: A dictionary of `String` type key-value pairs.
8080
/// - isAnimated: makes the transition to be animated.
8181
func rootNext(paths: [String], items: [String: String], isAnimated: Bool)
@@ -86,7 +86,7 @@ public protocol LinkNavigatorType {
8686
/// ``sheet(paths:items:isAnimated:)`` will dismiss that modal and present a new one.
8787
///
8888
/// - Parameters:
89-
/// - paths: An array of ``RouteBuilder/matchPath`` for the specific page.
89+
/// - paths: An array of ``RouteBuilder/matchPath`` for some specific pages.
9090
/// - items: A dictionary of `String` type key-value pairs.
9191
/// - isAnimated: makes the transition to be animated.
9292
func sheet(paths: [String], items: [String: String], isAnimated: Bool)
@@ -97,7 +97,7 @@ public protocol LinkNavigatorType {
9797
/// ``fullSheet(paths:items:isAnimated:)`` will dismiss that modal and present a new one.
9898
///
9999
/// - Parameters:
100-
/// - paths: An array of ``RouteBuilder/matchPath`` for the specific page.
100+
/// - paths: An array of ``RouteBuilder/matchPath`` for some specific pages.
101101
/// - items: A dictionary of `String` type key-value pairs.
102102
/// - isAnimated: makes the transition to be animated.
103103
func fullSheet(paths: [String], items: [String: String], isAnimated: Bool)
@@ -120,7 +120,7 @@ public protocol LinkNavigatorType {
120120
/// will dismiss that modal and present a new one.
121121
///
122122
/// - Parameters:
123-
/// - paths: An array of ``RouteBuilder/matchPath`` for the specific page.
123+
/// - paths: An array of ``RouteBuilder/matchPath`` for some specific pages.
124124
/// - items: A dictionary of `String` type key-value pairs.
125125
/// - isAnimated: makes the transition to be animated.
126126
func customSheet(
@@ -145,7 +145,7 @@ public protocol LinkNavigatorType {
145145
/// ```
146146
///
147147
/// - Parameters:
148-
/// - paths: An array of ``RouteBuilder/matchPath`` for the specific page.
148+
/// - paths: An array of ``RouteBuilder/matchPath`` for some specific pages.
149149
/// - items: A dictionary of `String` type key-value pairs.
150150
/// - isAnimated: makes the transition to be animated.
151151
func replace(paths: [String], items: [String: String], isAnimated: Bool)
@@ -203,7 +203,7 @@ public protocol LinkNavigatorType {
203203
/// - Note: If the modal is inactive, this method does same thing as ``backOrNext(path:items:isAnimated:)``.
204204
///
205205
/// - Parameters:
206-
/// - path: A string of ``RouteBuilder/matchPath`` for the specific page.
206+
/// - path: A string of ``RouteBuilder/matchPath`` for a specific page.
207207
/// - items: A dictionary of `String` type key-value pairs.
208208
/// - isAnimated: makes the transition to be animated.
209209
func rootBackOrNext(path: String, items: [String: String], isAnimated: Bool)
@@ -230,7 +230,7 @@ public protocol LinkNavigatorType {
230230
/// Use ``back(isAnimated:)`` method instead.
231231
///
232232
/// - Parameters:
233-
/// - paths: An array of ``RouteBuilder/matchPath`` for the specific page.
233+
/// - paths: An array of ``RouteBuilder/matchPath`` for some specific pages.
234234
func remove(paths: [String])
235235

236236
/// Removes one or many pages on the `rootNavigationController`'s current
@@ -251,37 +251,45 @@ public protocol LinkNavigatorType {
251251
/// - Note: If the modal is inactive, this method does same thing as ``remove(paths:)``.
252252
///
253253
/// - Parameters:
254-
/// - paths: An array of ``RouteBuilder/matchPath`` for the specific page.
254+
/// - paths: An array of ``RouteBuilder/matchPath`` for some specific pages.
255255
func rootRemove(paths: [String])
256256

257-
/// Remove last page in pages.
257+
/// Rewinds a specific page.
258+
///
259+
/// If you have a duplicated pages in the current navigation stack,
260+
/// `navigator` rewinds to the last page of stack.
258261
///
259262
/// ```swift
260-
/// // current navigation stack == ["pageA", "pageB", "pageA", "pageC"]
263+
/// // current navigation stack == ["pageA", "pageA", "pageB", "pageC"]
261264
///
262-
/// navigator.removeLast(paths: "pageA", isAnimated: true)
263-
/// // then, you will have this stack, ["pageA", "pageB"]
265+
/// navigator.backToLast(path: "pageA", isAnimated: true)
266+
/// // then, you will have this stack, ["pageA", "pageA"]
264267
/// ```
265268
///
266269
/// - Parameters:
267-
/// - path: A string of ``RouteBuilder/matchPath`` for the specific page.
270+
/// - path: A string of ``RouteBuilder/matchPath`` for a specific page.
268271
/// - isAnimated: makes the transition to be animated.
269-
func removeLast(path: String, isAnimated: Bool)
272+
func backToLast(path: String, isAnimated: Bool)
270273

271-
/// Remove last page in pages.
274+
/// Rewinds a specific page on the `rootNavigationController`'s current
275+
/// navigation stack, especially when the modal is active.
276+
///
277+
/// If you have a duplicated pages in the root navigation stack,
278+
/// `navigator` rewinds to the last page of stack.
272279
///
273280
/// ```swift
274-
/// // current navigation stack == ["pageA", "pageB", "pageA", "pageC"]
281+
/// // current `root` navigation stack == ["pageA", "pageA", "pageB", "pageC"]
282+
/// // current `sub` navigation stack == ["pageD"]
275283
///
276-
/// navigator.removeLastRoot(paths: "pageA", isAnimated: true)
277-
/// // then, you will have this stack, ["pageA", "pageB"]
284+
/// navigator.rootBackToLast(path: "pageA", isAnimated: true)
285+
/// // then, current `root` stack == ["pageA", "pageA"]
278286
/// ```
279-
/// - Note: If the modal is inactive, this method does same thing as ``remove(paths:)``.
287+
/// - Note: If the modal is inactive, this method does same thing as ``backToLast(path:isAnimated:)``.
280288
///
281289
/// - Parameters:
282-
/// - path: A string of ``RouteBuilder/matchPath`` for the specific page.
290+
/// - path: A string of ``RouteBuilder/matchPath`` for a specific page.
283291
/// - isAnimated: makes the transition to be animated.
284-
func removeLastRoot(path: String, isAnimated: Bool)
292+
func rootBackToLast(path: String, isAnimated: Bool)
285293

286294
/// Dismisses the modal and calls completion closure.
287295
///
@@ -524,12 +532,12 @@ extension LinkNavigator: LinkNavigatorType {
524532
rootNavigationController.setViewControllers(new, animated: false)
525533
}
526534

527-
public func removeLast(path: String, isAnimated: Bool) {
535+
public func backToLast(path: String, isAnimated: Bool) {
528536
guard let pick = findLastViewController(path: path) else { return }
529537
currentActivityNavigationController.popToViewController(pick, animated: isAnimated)
530538
}
531539

532-
public func removeLastRoot(path: String, isAnimated: Bool) {
540+
public func rootBackToLast(path: String, isAnimated: Bool) {
533541
guard let pick = findLastViewControllerRootView(path: path) else { return }
534542
rootNavigationController.popToViewController(pick, animated: isAnimated)
535543
}

0 commit comments

Comments
 (0)