From da9d838b737e8e782896007cb106b1e63c927102 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arkadiusz=20Marsza=C5=82ek?= Date: Wed, 8 Mar 2023 14:55:23 +0100 Subject: [PATCH] Expose coordinator's children in protocol --- Sources/XCoordinator/AnyCoordinator.swift | 6 ++++++ Sources/XCoordinator/BaseCoordinator.swift | 5 ----- Sources/XCoordinator/Coordinator.swift | 7 +++++++ 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/Sources/XCoordinator/AnyCoordinator.swift b/Sources/XCoordinator/AnyCoordinator.swift index 905ac917..53707cee 100755 --- a/Sources/XCoordinator/AnyCoordinator.swift +++ b/Sources/XCoordinator/AnyCoordinator.swift @@ -34,6 +34,7 @@ public class AnyCoordinator TransitionType private let _viewController: () -> UIViewController? private let _rootViewController: () -> TransitionType.RootViewController + private let _children: () -> [Presentable] private let _presented: (Presentable?) -> Void private let _setRoot: (UIWindow) -> Void private let _addChild: (Presentable) -> Void @@ -55,6 +56,7 @@ public class AnyCoordinator private var removeParentChildren: () -> Void = {} private var gestureRecognizerTargets = [GestureRecognizerTarget]() - /// - /// The child coordinators that are currently in the view hierarchy. - /// When performing a transition, children are automatically added and removed from this array - /// depending on whether they are in the view hierarchy. - /// public private(set) var children = [Presentable]() // MARK: Computed properties diff --git a/Sources/XCoordinator/Coordinator.swift b/Sources/XCoordinator/Coordinator.swift index 59acc646..1ce76425 100755 --- a/Sources/XCoordinator/Coordinator.swift +++ b/Sources/XCoordinator/Coordinator.swift @@ -22,6 +22,13 @@ public typealias ContextPresentationHandler = (TransitionContext) -> Void /// public protocol Coordinator: Router, TransitionPerformer { + /// + /// The child coordinators that are currently in the view hierarchy. + /// When performing a transition, children are automatically added and removed from this array + /// depending on whether they are in the view hierarchy. + /// + var children: [Presentable] { get } + /// /// This method prepares transitions for routes. /// It especially decides, which transitions are performed for the triggered routes.