Skip to content

Commit

Permalink
Set trigger async extensions to be run on MainActor and mark non-objc…
Browse files Browse the repository at this point in the history
… functions in extensions to be public instead of open because they could not be overriden anyways according to Xcode
  • Loading branch information
pauljohanneskraft committed Feb 28, 2023
1 parent 25bfa59 commit 00b0661
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions Sources/XCoordinator/BaseCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ extension BaseCoordinator {
/// The closure to be called whenever the transition completes.
/// Hint: Might be called multiple times but only once per performing the transition.
///
open func registerInteractiveTransition<GestureRecognizer: UIGestureRecognizer>(
public func registerInteractiveTransition<GestureRecognizer: UIGestureRecognizer>(
for route: RouteType,
triggeredBy recognizer: GestureRecognizer,
handler: @escaping (_ handlerRecognizer: GestureRecognizer, _ transition: () -> TransitionAnimation?) -> Void,
Expand Down Expand Up @@ -238,7 +238,7 @@ extension BaseCoordinator {
/// The closure to be called whenever the transition completes.
/// Hint: Might be called multiple times but only once per performing the transition.
///
open func registerInteractiveTransition<GestureRecognizer: UIGestureRecognizer>(
public func registerInteractiveTransition<GestureRecognizer: UIGestureRecognizer>(
for route: RouteType,
triggeredBy recognizer: GestureRecognizer,
progress: @escaping (GestureRecognizer) -> CGFloat,
Expand Down Expand Up @@ -287,7 +287,7 @@ extension BaseCoordinator {
/// The recognizer to unregister interactive transitions for.
/// This method will unregister all interactive transitions with that gesture recognizer.
///
open func unregisterInteractiveTransitions(triggeredBy recognizer: UIGestureRecognizer) {
public func unregisterInteractiveTransitions(triggeredBy recognizer: UIGestureRecognizer) {
gestureRecognizerTargets.removeAll { target in
guard target.gestureRecognizer === recognizer else { return false }
recognizer.removeTarget(target, action: nil)
Expand Down
2 changes: 1 addition & 1 deletion Sources/XCoordinator/NavigationAnimationDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ extension NavigationAnimationDelegate: UIGestureRecognizerDelegate {
///
/// - Parameter navigationController: The navigation controller to be set up.
///
open func setupPopGestureRecognizer(for navigationController: UINavigationController) {
public func setupPopGestureRecognizer(for navigationController: UINavigationController) {
self.navigationController = navigationController
guard let popRecognizer = navigationController.interactivePopGestureRecognizer,
popRecognizer.delegate !== self else {
Expand Down
6 changes: 3 additions & 3 deletions Sources/XCoordinator/Router.swift
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ extension Router {
/// - Parameters:
/// - route: The route to be triggered.
///
public func trigger(_ route: RouteType) async {
@MainActor public func trigger(_ route: RouteType) async {
await trigger(route, with: .default)
}

Expand All @@ -138,7 +138,7 @@ extension Router {
/// - route: The route to be triggered.
/// - options: Transition options for performing the transition, e.g. whether it should be animated.
///
public func trigger(_ route: RouteType, with options: TransitionOptions) async {
@MainActor public func trigger(_ route: RouteType, with options: TransitionOptions) async {
_ = await contextTrigger(route, with: options)
}

Expand All @@ -159,7 +159,7 @@ extension Router {
/// The transition context of the performed transition(s).
/// If the context is not needed, use `trigger` instead.
///
public func contextTrigger(_ route: RouteType, with options: TransitionOptions) async -> TransitionContext {
@MainActor public func contextTrigger(_ route: RouteType, with options: TransitionOptions) async -> TransitionContext {
await withCheckedContinuation { continuation in
contextTrigger(route, with: options) { context in
continuation.resume(returning: context)
Expand Down

0 comments on commit 00b0661

Please sign in to comment.