diff --git a/Sources/CombineNavigation/Destinations/DestinationInitializableController.swift b/Sources/CombineNavigation/Destinations/DestinationInitializableController.swift index 8227ac3..23b12fa 100644 --- a/Sources/CombineNavigation/Destinations/DestinationInitializableController.swift +++ b/Sources/CombineNavigation/Destinations/DestinationInitializableController.swift @@ -3,6 +3,6 @@ import SwiftUI import CocoaAliases public protocol DestinationInitializableControllerProtocol: CocoaViewController { - init() + static func _init_for_destination() -> CocoaViewController } #endif diff --git a/Sources/CombineNavigation/Destinations/StackDestination.swift b/Sources/CombineNavigation/Destinations/StackDestination.swift index 662ba15..3b27a94 100644 --- a/Sources/CombineNavigation/Destinations/StackDestination.swift +++ b/Sources/CombineNavigation/Destinations/StackDestination.swift @@ -71,7 +71,7 @@ open class StackDestination< ) -> Controller { if let controllerType = (Controller.self as? DestinationInitializableControllerProtocol.Type), - let controller = controllerType.init() as? Controller + let controller = controllerType._init_for_destination() as? Controller { return controller } else { diff --git a/Sources/CombineNavigation/Destinations/TreeDestination.swift b/Sources/CombineNavigation/Destinations/TreeDestination.swift index 6b7e36d..a7722c5 100644 --- a/Sources/CombineNavigation/Destinations/TreeDestination.swift +++ b/Sources/CombineNavigation/Destinations/TreeDestination.swift @@ -63,7 +63,7 @@ open class TreeDestination: open class func initController() -> Controller { if let controllerType = (Controller.self as? DestinationInitializableControllerProtocol.Type), - let controller = controllerType.init() as? Controller + let controller = controllerType._init_for_destination() as? Controller { return controller } else {