@@ -216,16 +216,11 @@ extension SingleLinkNavigator {
216216 /// - linkItem: The link item containing the `ItemValue` to define the navigation endpoint.
217217 /// - isAnimated: A flag indicating whether the navigation should be animated.
218218 private func _backOrNext( linkItem: LinkItem , isAnimated: Bool ) {
219- guard let activeController else { return }
220-
221- guard let pick = navigationBuilder. firstPick ( controller: activeController, item: linkItem) else {
222- activeController. push (
223- viewController: navigationBuilder. pickBuild ( item: linkItem) ,
224- isAnimated: isAnimated)
219+ guard let pick = navigationBuilder. lastPick ( controller: activeController, item: linkItem) else {
220+ activeController? . merge ( new: navigationBuilder. build ( item: linkItem) , isAnimated: isAnimated)
225221 return
226222 }
227-
228- activeController. popToViewController ( pick, animated: isAnimated)
223+ activeController? . popToViewController ( pick, animated: isAnimated)
229224 }
230225
231226 /// Navigates backwards or forwards from the root controller based on the first pick from the navigation builder.
@@ -234,16 +229,11 @@ extension SingleLinkNavigator {
234229 /// - linkItem: The link item containing the `ItemValue` to define the navigation endpoint.
235230 /// - isAnimated: A flag indicating whether the navigation should be animated.
236231 private func _rootBackOrNext( linkItem: LinkItem , isAnimated: Bool ) {
237- guard let rootController else { return }
238-
239- guard let pick = navigationBuilder. firstPick ( controller: rootController, item: linkItem) else {
240- rootController. push (
241- viewController: navigationBuilder. pickBuild ( item: linkItem) ,
242- isAnimated: isAnimated)
232+ guard let pick = navigationBuilder. lastPick ( controller: rootController, item: linkItem) else {
233+ rootController? . merge ( new: navigationBuilder. build ( item: linkItem) , isAnimated: isAnimated)
243234 return
244235 }
245-
246- rootController. popToViewController ( pick, animated: isAnimated)
236+ rootController? . popToViewController ( pick, animated: isAnimated)
247237 }
248238
249239 // 다시
0 commit comments