Skip to content

Commit 910b4c6

Browse files
Adding random option for HomeCoordinator-picker
1 parent f9095e5 commit 910b4c6

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

XCoordinator-Example/Coordinators/AppCoordinator.swift

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,17 @@ class AppCoordinator: NavigationCoordinator<AppRoute> {
5555
self.trigger(.home(HomePageCoordinator().strongRouter))
5656
}
5757
)
58+
alert.addAction(
59+
.init(title: "Random", style: .default) { [unowned self] _ in
60+
let routers: [() -> StrongRouter<HomeRoute>] = [
61+
{ HomeTabCoordinator().strongRouter },
62+
{ HomeSplitCoordinator().strongRouter },
63+
{ HomeTabCoordinator().strongRouter }
64+
]
65+
let router = routers.randomElement().map { $0() }
66+
self.trigger(.home(router))
67+
}
68+
)
5869
return .present(alert)
5970
case .newsDetail(let news):
6071
return .multiple(

0 commit comments

Comments
 (0)