diff --git a/Nivelir.xcodeproj/project.pbxproj b/Nivelir.xcodeproj/project.pbxproj index 9dd9491f..df0ca21c 100644 --- a/Nivelir.xcodeproj/project.pbxproj +++ b/Nivelir.xcodeproj/project.pbxproj @@ -922,8 +922,8 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 1130; - LastUpgradeCheck = 1130; - ORGANIZATIONNAME = "HeadHunter"; + LastUpgradeCheck = 1240; + ORGANIZATIONNAME = HeadHunter; TargetAttributes = { C057F00D23CB8EEB00C2D895 = { CreatedOnToolsVersion = 11.3; @@ -1295,6 +1295,7 @@ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; @@ -1359,6 +1360,7 @@ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; diff --git a/Sources/Extensions/UIKit/UINavigationController+Extensions.swift b/Sources/Extensions/UIKit/UINavigationController+Extensions.swift index c26b4868..9d2eb388 100644 --- a/Sources/Extensions/UIKit/UINavigationController+Extensions.swift +++ b/Sources/Extensions/UIKit/UINavigationController+Extensions.swift @@ -1,3 +1,4 @@ +#if canImport(UIKit) import UIKit extension UINavigationController { @@ -14,3 +15,4 @@ extension UINavigationController { visibleViewController } } +#endif diff --git a/Sources/Extensions/UIKit/UITabBarController+Extensions.swift b/Sources/Extensions/UIKit/UITabBarController+Extensions.swift index d94dc47b..f9ff1220 100644 --- a/Sources/Extensions/UIKit/UITabBarController+Extensions.swift +++ b/Sources/Extensions/UIKit/UITabBarController+Extensions.swift @@ -1,3 +1,4 @@ +#if canImport(UIKit) import UIKit extension UITabBarController { @@ -7,3 +8,4 @@ extension UITabBarController { set { selectedViewController = newValue } } } +#endif diff --git a/Sources/Extensions/UIKit/UIViewController+Extensions.swift b/Sources/Extensions/UIKit/UIViewController+Extensions.swift index 7c8cc7f7..eb8a4f8a 100644 --- a/Sources/Extensions/UIKit/UIViewController+Extensions.swift +++ b/Sources/Extensions/UIKit/UIViewController+Extensions.swift @@ -1,3 +1,4 @@ +#if canImport(UIKit) import UIKit extension UIViewController { @@ -18,3 +19,4 @@ extension UIViewController { tabBarController } } +#endif diff --git a/Sources/Extensions/UIKit/UIWindow+Extensions.swift b/Sources/Extensions/UIKit/UIWindow+Extensions.swift index 7511ec0c..c18762a7 100644 --- a/Sources/Extensions/UIKit/UIWindow+Extensions.swift +++ b/Sources/Extensions/UIKit/UIWindow+Extensions.swift @@ -1,3 +1,4 @@ +#if canImport(UIKit) import UIKit extension UIWindow { @@ -6,3 +7,4 @@ extension UIWindow { rootViewController } } +#endif diff --git a/Sources/Screen/Actions/Generic/From/ScreenFromAction.swift b/Sources/Screen/Actions/Generic/From/ScreenFromAction.swift index 8501ec91..5dff7bf1 100644 --- a/Sources/Screen/Actions/Generic/From/ScreenFromAction.swift +++ b/Sources/Screen/Actions/Generic/From/ScreenFromAction.swift @@ -49,6 +49,7 @@ extension ScreenRoute { } } +#if canImport(UIKit) extension ScreenNavigator { public func navigate( @@ -77,3 +78,4 @@ extension ScreenNavigator { ) } } +#endif diff --git a/Sources/Screen/Actions/Generic/From/ScreenFromFirstAction.swift b/Sources/Screen/Actions/Generic/From/ScreenFromFirstAction.swift index 7e46aab9..2bd560ca 100644 --- a/Sources/Screen/Actions/Generic/From/ScreenFromFirstAction.swift +++ b/Sources/Screen/Actions/Generic/From/ScreenFromFirstAction.swift @@ -23,7 +23,7 @@ public struct ScreenFromFirstAction< return false } - return predicate(container) + return self.predicate.checkContainer(container) } guard let output = first as? Output else { @@ -57,6 +57,7 @@ extension ScreenRoute { } } +#if canImport(UIKit) extension ScreenNavigator { public func navigate( @@ -85,3 +86,4 @@ extension ScreenNavigator { ) } } +#endif diff --git a/Sources/Screen/Actions/Generic/From/ScreenFromPredicate.swift b/Sources/Screen/Actions/Generic/From/ScreenFromPredicate.swift index c3ffe988..2a6d2fa5 100644 --- a/Sources/Screen/Actions/Generic/From/ScreenFromPredicate.swift +++ b/Sources/Screen/Actions/Generic/From/ScreenFromPredicate.swift @@ -1,4 +1,8 @@ +#if canImport(UIKit) import UIKit +#else +import Foundation +#endif public struct ScreenFromPredicate { @@ -8,7 +12,7 @@ public struct ScreenFromPredicate { self.box = box } - internal func callAsFunction(_ container: Container) -> Bool { + internal func checkContainer(_ container: Container) -> Bool { box(container) } } @@ -30,6 +34,7 @@ extension ScreenFromPredicate { } } +#if canImport(UIKit) extension ScreenFromPredicate where Container == UIViewController { public static var modalContainer: Self { @@ -62,3 +67,4 @@ extension ScreenFromPredicate where Container == UITabBarController { container(of: Container.self, key: key) } } +#endif diff --git a/Sources/Screen/Actions/Generic/From/ScreenFromTopAction.swift b/Sources/Screen/Actions/Generic/From/ScreenFromTopAction.swift index aa0dc460..bf87f243 100644 --- a/Sources/Screen/Actions/Generic/From/ScreenFromTopAction.swift +++ b/Sources/Screen/Actions/Generic/From/ScreenFromTopAction.swift @@ -23,7 +23,7 @@ public struct ScreenFromTopAction< return false } - return predicate(container) + return self.predicate.checkContainer(container) } guard let output = top as? Output else { @@ -57,6 +57,7 @@ extension ScreenRoute { } } +#if canImport(UIKit) extension ScreenNavigator { public func navigate( @@ -85,3 +86,4 @@ extension ScreenNavigator { ) } } +#endif diff --git a/Sources/Screen/Actions/Generic/ScreenJoinAction.swift b/Sources/Screen/Actions/Generic/ScreenJoinAction.swift index 09cb936d..aeadae1d 100644 --- a/Sources/Screen/Actions/Generic/ScreenJoinAction.swift +++ b/Sources/Screen/Actions/Generic/ScreenJoinAction.swift @@ -24,7 +24,7 @@ public struct ScreenJoinAction< first.perform(container: container, navigation: navigation) { result in switch result { case let .success(container): - second.perform( + self.second.perform( container: container, navigation: navigation, completion: completion diff --git a/Sources/Screen/Actions/Generic/ScreenNavigateToAction.swift b/Sources/Screen/Actions/Generic/ScreenNavigateToAction.swift index e2bb8176..62313d28 100644 --- a/Sources/Screen/Actions/Generic/ScreenNavigateToAction.swift +++ b/Sources/Screen/Actions/Generic/ScreenNavigateToAction.swift @@ -56,6 +56,7 @@ public struct ScreenNavigateToAction: ScreenAction { } } +#if canImport(UIKit) extension ScreenNavigator { public func navigate( @@ -78,3 +79,4 @@ extension ScreenNavigator { ) } } +#endif diff --git a/Sources/Screen/Actions/Modal/ScreenDismissAction.swift b/Sources/Screen/Actions/Modal/ScreenDismissAction.swift index 6b3486cd..cb055604 100644 --- a/Sources/Screen/Actions/Modal/ScreenDismissAction.swift +++ b/Sources/Screen/Actions/Modal/ScreenDismissAction.swift @@ -1,3 +1,4 @@ +#if canImport(UIKit) import UIKit public struct ScreenDismissAction: ScreenAction { @@ -33,3 +34,4 @@ extension ScreenRoute where Container: UIViewController { then(action: ScreenDismissAction(animated: animated)) } } +#endif diff --git a/Sources/Screen/Actions/Modal/ScreenPresentAction.swift b/Sources/Screen/Actions/Modal/ScreenPresentAction.swift index bd73d596..28463ae2 100644 --- a/Sources/Screen/Actions/Modal/ScreenPresentAction.swift +++ b/Sources/Screen/Actions/Modal/ScreenPresentAction.swift @@ -1,3 +1,4 @@ +#if canImport(UIKit) import UIKit public struct ScreenPresentAction< @@ -58,3 +59,4 @@ extension ScreenRoute where Container: UIViewController { ) } } +#endif diff --git a/Sources/Screen/Actions/Modal/ScreenPresentedAction.swift b/Sources/Screen/Actions/Modal/ScreenPresentedAction.swift index 3db6aaa9..7c622562 100644 --- a/Sources/Screen/Actions/Modal/ScreenPresentedAction.swift +++ b/Sources/Screen/Actions/Modal/ScreenPresentedAction.swift @@ -1,3 +1,4 @@ +#if canImport(UIKit) import UIKit public struct ScreenPresentedAction< @@ -62,3 +63,4 @@ extension ScreenRoute where Container: UIViewController { ) } } +#endif diff --git a/Sources/Screen/Actions/Modal/ScreenPresentingAction.swift b/Sources/Screen/Actions/Modal/ScreenPresentingAction.swift index 7830de32..eecaab66 100644 --- a/Sources/Screen/Actions/Modal/ScreenPresentingAction.swift +++ b/Sources/Screen/Actions/Modal/ScreenPresentingAction.swift @@ -1,3 +1,4 @@ +#if canImport(UIKit) import UIKit public struct ScreenPresentingAction< @@ -62,3 +63,4 @@ extension ScreenRoute where Container: UIViewController { ) } } +#endif diff --git a/Sources/Screen/Actions/Modal/ScreenStackAction.swift b/Sources/Screen/Actions/Modal/ScreenStackAction.swift index 574ceb78..a953bc17 100644 --- a/Sources/Screen/Actions/Modal/ScreenStackAction.swift +++ b/Sources/Screen/Actions/Modal/ScreenStackAction.swift @@ -1,3 +1,4 @@ +#if canImport(UIKit) import UIKit public struct ScreenStackAction< @@ -62,3 +63,4 @@ extension ScreenRoute where Container: UIViewController { ) } } +#endif diff --git a/Sources/Screen/Actions/Modal/ScreenTabsAction.swift b/Sources/Screen/Actions/Modal/ScreenTabsAction.swift index 30ac650d..15d3c2d2 100644 --- a/Sources/Screen/Actions/Modal/ScreenTabsAction.swift +++ b/Sources/Screen/Actions/Modal/ScreenTabsAction.swift @@ -1,3 +1,4 @@ +#if canImport(UIKit) import UIKit public struct ScreenTabsAction< @@ -62,3 +63,4 @@ extension ScreenRoute where Container: UIViewController { ) } } +#endif diff --git a/Sources/Screen/Actions/Stack/ScreenStackTopAction.swift b/Sources/Screen/Actions/Stack/ScreenStackTopAction.swift index 35d14f65..afe8e53f 100644 --- a/Sources/Screen/Actions/Stack/ScreenStackTopAction.swift +++ b/Sources/Screen/Actions/Stack/ScreenStackTopAction.swift @@ -1,3 +1,4 @@ +#if canImport(UIKit) import UIKit public struct ScreenStackTopAction< @@ -60,3 +61,4 @@ extension ScreenRoute where Container: UINavigationController { ) } } +#endif diff --git a/Sources/Screen/Actions/Stack/ScreenStackVisibleAction.swift b/Sources/Screen/Actions/Stack/ScreenStackVisibleAction.swift index 41cf1b0b..4ed55552 100644 --- a/Sources/Screen/Actions/Stack/ScreenStackVisibleAction.swift +++ b/Sources/Screen/Actions/Stack/ScreenStackVisibleAction.swift @@ -1,3 +1,4 @@ +#if canImport(UIKit) import UIKit public struct ScreenStackVisibleAction< @@ -60,3 +61,4 @@ extension ScreenRoute where Container: UINavigationController { ) } } +#endif diff --git a/Sources/Screen/Actions/Stack/SetStack/Animations/ScreenStackAnimation.swift b/Sources/Screen/Actions/Stack/SetStack/Animations/ScreenStackAnimation.swift index 7bd594cb..050579ab 100644 --- a/Sources/Screen/Actions/Stack/SetStack/Animations/ScreenStackAnimation.swift +++ b/Sources/Screen/Actions/Stack/SetStack/Animations/ScreenStackAnimation.swift @@ -1,3 +1,4 @@ +#if canImport(UIKit) import UIKit public enum ScreenStackAnimation { @@ -55,3 +56,4 @@ extension ScreenStackAnimation: Equatable { } } } +#endif diff --git a/Sources/Screen/Actions/Stack/SetStack/Animations/ScreenStackCustomAnimation.swift b/Sources/Screen/Actions/Stack/SetStack/Animations/ScreenStackCustomAnimation.swift index c0e4b032..134b911e 100644 --- a/Sources/Screen/Actions/Stack/SetStack/Animations/ScreenStackCustomAnimation.swift +++ b/Sources/Screen/Actions/Stack/SetStack/Animations/ScreenStackCustomAnimation.swift @@ -1,3 +1,4 @@ +#if canImport(UIKit) import UIKit public protocol ScreenStackCustomAnimation { @@ -20,3 +21,4 @@ extension ScreenStackCustomAnimation where Self: Equatable { return self == other } } +#endif diff --git a/Sources/Screen/Actions/Stack/SetStack/Animations/ScreenStackTransitionAnimation.swift b/Sources/Screen/Actions/Stack/SetStack/Animations/ScreenStackTransitionAnimation.swift index 21aa5fb4..b57d1702 100644 --- a/Sources/Screen/Actions/Stack/SetStack/Animations/ScreenStackTransitionAnimation.swift +++ b/Sources/Screen/Actions/Stack/SetStack/Animations/ScreenStackTransitionAnimation.swift @@ -1,3 +1,4 @@ +#if canImport(UIKit) import UIKit public struct ScreenStackTransitionAnimation: ScreenStackCustomAnimation, Equatable { @@ -44,3 +45,4 @@ extension ScreenStackAnimation { ScreenStackTransitionAnimation.crossDissolve ) } +#endif diff --git a/Sources/Screen/Actions/Stack/SetStack/Modifiers/PopTo/ScreenStackPopToModifier.swift b/Sources/Screen/Actions/Stack/SetStack/Modifiers/PopTo/ScreenStackPopToModifier.swift index d37066cc..03e7c0ba 100644 --- a/Sources/Screen/Actions/Stack/SetStack/Modifiers/PopTo/ScreenStackPopToModifier.swift +++ b/Sources/Screen/Actions/Stack/SetStack/Modifiers/PopTo/ScreenStackPopToModifier.swift @@ -1,3 +1,4 @@ +#if canImport(UIKit) import UIKit public struct ScreenStackPopToModifier: ScreenStackModifier { @@ -16,7 +17,7 @@ public struct ScreenStackPopToModifier: ScreenStackModifier { in stack: [UIViewController], navigation: ScreenNavigation ) throws -> [UIViewController] { - guard let stackIndex = predicate(stack) else { + guard let stackIndex = predicate.containerIndex(in: stack) else { throw ScreenContainerNotFoundError(for: self) } @@ -36,3 +37,4 @@ extension ScreenRoute where Container: UINavigationController { ) } } +#endif diff --git a/Sources/Screen/Actions/Stack/SetStack/Modifiers/PopTo/ScreenStackPopToPredicate.swift b/Sources/Screen/Actions/Stack/SetStack/Modifiers/PopTo/ScreenStackPopToPredicate.swift index a2817aee..19802d43 100644 --- a/Sources/Screen/Actions/Stack/SetStack/Modifiers/PopTo/ScreenStackPopToPredicate.swift +++ b/Sources/Screen/Actions/Stack/SetStack/Modifiers/PopTo/ScreenStackPopToPredicate.swift @@ -1,3 +1,4 @@ +#if canImport(UIKit) import UIKit public struct ScreenStackPopToPredicate { @@ -8,7 +9,7 @@ public struct ScreenStackPopToPredicate { self.box = box } - internal func callAsFunction(_ stack: [UIViewController]) -> Int? { + internal func containerIndex(in stack: [UIViewController]) -> Int? { box(stack) } } @@ -29,3 +30,4 @@ extension ScreenStackPopToPredicate { } } } +#endif diff --git a/Sources/Screen/Actions/Stack/SetStack/Modifiers/ScreenStackClearModifier.swift b/Sources/Screen/Actions/Stack/SetStack/Modifiers/ScreenStackClearModifier.swift index f188bc99..3ea90960 100644 --- a/Sources/Screen/Actions/Stack/SetStack/Modifiers/ScreenStackClearModifier.swift +++ b/Sources/Screen/Actions/Stack/SetStack/Modifiers/ScreenStackClearModifier.swift @@ -1,3 +1,4 @@ +#if canImport(UIKit) import UIKit public struct ScreenStackClearModifier: ScreenStackModifier { @@ -25,3 +26,4 @@ extension ScreenRoute where Container: UINavigationController { ) } } +#endif diff --git a/Sources/Screen/Actions/Stack/SetStack/Modifiers/ScreenStackModifier.swift b/Sources/Screen/Actions/Stack/SetStack/Modifiers/ScreenStackModifier.swift index 44f07fff..6fd73a5c 100644 --- a/Sources/Screen/Actions/Stack/SetStack/Modifiers/ScreenStackModifier.swift +++ b/Sources/Screen/Actions/Stack/SetStack/Modifiers/ScreenStackModifier.swift @@ -1,3 +1,4 @@ +#if canImport(UIKit) import UIKit public protocol ScreenStackModifier: CustomStringConvertible { @@ -6,3 +7,4 @@ public protocol ScreenStackModifier: CustomStringConvertible { navigation: ScreenNavigation ) throws -> [UIViewController] } +#endif diff --git a/Sources/Screen/Actions/Stack/SetStack/Modifiers/ScreenStackPopModifier.swift b/Sources/Screen/Actions/Stack/SetStack/Modifiers/ScreenStackPopModifier.swift index 85e574a2..cbaffa6a 100644 --- a/Sources/Screen/Actions/Stack/SetStack/Modifiers/ScreenStackPopModifier.swift +++ b/Sources/Screen/Actions/Stack/SetStack/Modifiers/ScreenStackPopModifier.swift @@ -1,3 +1,4 @@ +#if canImport(UIKit) import UIKit public struct ScreenStackPopModifier: ScreenStackModifier { @@ -29,3 +30,4 @@ extension ScreenRoute where Container: UINavigationController { ) } } +#endif diff --git a/Sources/Screen/Actions/Stack/SetStack/Modifiers/ScreenStackPopToRootModifier.swift b/Sources/Screen/Actions/Stack/SetStack/Modifiers/ScreenStackPopToRootModifier.swift index 08919be9..c6c67f5e 100644 --- a/Sources/Screen/Actions/Stack/SetStack/Modifiers/ScreenStackPopToRootModifier.swift +++ b/Sources/Screen/Actions/Stack/SetStack/Modifiers/ScreenStackPopToRootModifier.swift @@ -1,3 +1,4 @@ +#if canImport(UIKit) import UIKit public struct ScreenStackPopToRootModifier: ScreenStackModifier { @@ -29,3 +30,4 @@ extension ScreenRoute where Container: UINavigationController { ) } } +#endif diff --git a/Sources/Screen/Actions/Stack/SetStack/Modifiers/ScreenStackPushModifier.swift b/Sources/Screen/Actions/Stack/SetStack/Modifiers/ScreenStackPushModifier.swift index 9fa717cf..35078978 100644 --- a/Sources/Screen/Actions/Stack/SetStack/Modifiers/ScreenStackPushModifier.swift +++ b/Sources/Screen/Actions/Stack/SetStack/Modifiers/ScreenStackPushModifier.swift @@ -1,3 +1,4 @@ +#if canImport(UIKit) import UIKit public struct ScreenStackPushModifier< @@ -58,3 +59,4 @@ extension ScreenRoute where Container: UINavigationController { ) } } +#endif diff --git a/Sources/Screen/Actions/Stack/SetStack/Modifiers/ScreenStackReplaceModifier.swift b/Sources/Screen/Actions/Stack/SetStack/Modifiers/ScreenStackReplaceModifier.swift index c22fc0a3..384e6a2f 100644 --- a/Sources/Screen/Actions/Stack/SetStack/Modifiers/ScreenStackReplaceModifier.swift +++ b/Sources/Screen/Actions/Stack/SetStack/Modifiers/ScreenStackReplaceModifier.swift @@ -1,3 +1,4 @@ +#if canImport(UIKit) import UIKit public struct ScreenStackReplaceModifier< @@ -60,3 +61,4 @@ extension ScreenRoute where Container: UINavigationController { ) } } +#endif diff --git a/Sources/Screen/Actions/Stack/SetStack/ScreenSetStackAction.swift b/Sources/Screen/Actions/Stack/SetStack/ScreenSetStackAction.swift index 4803010f..d2f6ef37 100644 --- a/Sources/Screen/Actions/Stack/SetStack/ScreenSetStackAction.swift +++ b/Sources/Screen/Actions/Stack/SetStack/ScreenSetStackAction.swift @@ -1,3 +1,4 @@ +#if canImport(UIKit) import UIKit public struct ScreenSetStackAction: ScreenAction { @@ -144,3 +145,4 @@ extension ScreenRoute where Container: UINavigationController { ) } } +#endif diff --git a/Sources/Screen/Actions/Tabs/ScreenSelectedTabAction.swift b/Sources/Screen/Actions/Tabs/ScreenSelectedTabAction.swift index 9328e26a..a1cb3d47 100644 --- a/Sources/Screen/Actions/Tabs/ScreenSelectedTabAction.swift +++ b/Sources/Screen/Actions/Tabs/ScreenSelectedTabAction.swift @@ -1,3 +1,4 @@ +#if canImport(UIKit) import UIKit public struct ScreenSelectedTabAction< @@ -62,3 +63,4 @@ extension ScreenRoute where Container: UITabBarController { ) } } +#endif diff --git a/Sources/Screen/Actions/Tabs/ScreenSetupTabAction.swift b/Sources/Screen/Actions/Tabs/ScreenSetupTabAction.swift index 9e4ae1ab..0810f2e2 100644 --- a/Sources/Screen/Actions/Tabs/ScreenSetupTabAction.swift +++ b/Sources/Screen/Actions/Tabs/ScreenSetupTabAction.swift @@ -1,3 +1,4 @@ +#if canImport(UIKit) import UIKit public struct ScreenSetupTabAction< @@ -51,3 +52,4 @@ extension ScreenRoute where Container: UITabBarController { ) } } +#endif diff --git a/Sources/Screen/Actions/Tabs/SelectTab/Animations/ScreenSelectTabAnimation.swift b/Sources/Screen/Actions/Tabs/SelectTab/Animations/ScreenSelectTabAnimation.swift index 821f293b..dd446fb4 100644 --- a/Sources/Screen/Actions/Tabs/SelectTab/Animations/ScreenSelectTabAnimation.swift +++ b/Sources/Screen/Actions/Tabs/SelectTab/Animations/ScreenSelectTabAnimation.swift @@ -1,3 +1,4 @@ +#if canImport(UIKit) import UIKit public enum ScreenSelectTabAnimation { @@ -21,3 +22,4 @@ public enum ScreenSelectTabAnimation { } } } +#endif diff --git a/Sources/Screen/Actions/Tabs/SelectTab/Animations/ScreenSelectTabCustomAnimation.swift b/Sources/Screen/Actions/Tabs/SelectTab/Animations/ScreenSelectTabCustomAnimation.swift index c313fe88..21305106 100644 --- a/Sources/Screen/Actions/Tabs/SelectTab/Animations/ScreenSelectTabCustomAnimation.swift +++ b/Sources/Screen/Actions/Tabs/SelectTab/Animations/ScreenSelectTabCustomAnimation.swift @@ -1,3 +1,4 @@ +#if canImport(UIKit) import UIKit public protocol ScreenSelectTabCustomAnimation { @@ -8,3 +9,4 @@ public protocol ScreenSelectTabCustomAnimation { completion: @escaping () -> Void ) } +#endif diff --git a/Sources/Screen/Actions/Tabs/SelectTab/Animations/ScreenSelectTabTransitionAnimation.swift b/Sources/Screen/Actions/Tabs/SelectTab/Animations/ScreenSelectTabTransitionAnimation.swift index c0aaa133..4017b9b5 100644 --- a/Sources/Screen/Actions/Tabs/SelectTab/Animations/ScreenSelectTabTransitionAnimation.swift +++ b/Sources/Screen/Actions/Tabs/SelectTab/Animations/ScreenSelectTabTransitionAnimation.swift @@ -1,3 +1,4 @@ +#if canImport(UIKit) import UIKit public struct ScreenSelectTabTransitionAnimation: ScreenSelectTabCustomAnimation { @@ -44,3 +45,4 @@ extension ScreenSelectTabAnimation { ScreenSelectTabTransitionAnimation.crossDissolve ) } +#endif diff --git a/Sources/Screen/Actions/Tabs/SelectTab/ScreenSelectTabAction.swift b/Sources/Screen/Actions/Tabs/SelectTab/ScreenSelectTabAction.swift index 9600ba8d..5949d947 100644 --- a/Sources/Screen/Actions/Tabs/SelectTab/ScreenSelectTabAction.swift +++ b/Sources/Screen/Actions/Tabs/SelectTab/ScreenSelectTabAction.swift @@ -1,3 +1,4 @@ +#if canImport(UIKit) import UIKit public struct ScreenSelectTabAction< @@ -47,7 +48,7 @@ public struct ScreenSelectTabAction< let selectedTab = container.selectedTab - guard let newSelectedTabIndex = predicate(container.viewControllers ?? []) else { + guard let newSelectedTabIndex = predicate.tabIndex(in: container.viewControllers ?? []) else { return completion(.failure(ScreenContainerNotFoundError(for: self))) } @@ -128,3 +129,4 @@ extension ScreenRoute where Container: UITabBarController { ) } } +#endif diff --git a/Sources/Screen/Actions/Tabs/SelectTab/ScreenSelectTabPredicate.swift b/Sources/Screen/Actions/Tabs/SelectTab/ScreenSelectTabPredicate.swift index 00f3c57e..1604c90b 100644 --- a/Sources/Screen/Actions/Tabs/SelectTab/ScreenSelectTabPredicate.swift +++ b/Sources/Screen/Actions/Tabs/SelectTab/ScreenSelectTabPredicate.swift @@ -1,3 +1,4 @@ +#if canImport(UIKit) import UIKit public struct ScreenSelectTabPredicate { @@ -8,7 +9,7 @@ public struct ScreenSelectTabPredicate { self.box = box } - public func callAsFunction(_ tabs: [UIViewController]) -> Int? { + public func tabIndex(in tabs: [UIViewController]) -> Int? { box(tabs) } } @@ -33,3 +34,4 @@ extension ScreenSelectTabPredicate { } } } +#endif diff --git a/Sources/Screen/Actions/Window/ScreenRootAction.swift b/Sources/Screen/Actions/Window/ScreenRootAction.swift index 1b9efede..44904ac3 100644 --- a/Sources/Screen/Actions/Window/ScreenRootAction.swift +++ b/Sources/Screen/Actions/Window/ScreenRootAction.swift @@ -1,3 +1,4 @@ +#if canImport(UIKit) import UIKit public struct ScreenRootAction< @@ -60,3 +61,4 @@ extension ScreenRoute where Container: UIWindow { ) } } +#endif diff --git a/Sources/Screen/Actions/Window/SetRoot/Animations/ScreenSetRootAnimation.swift b/Sources/Screen/Actions/Window/SetRoot/Animations/ScreenSetRootAnimation.swift index 51f5dd66..b6c6ba8b 100644 --- a/Sources/Screen/Actions/Window/SetRoot/Animations/ScreenSetRootAnimation.swift +++ b/Sources/Screen/Actions/Window/SetRoot/Animations/ScreenSetRootAnimation.swift @@ -1,3 +1,4 @@ +#if canImport(UIKit) import UIKit public enum ScreenSetRootAnimation { @@ -21,3 +22,4 @@ public enum ScreenSetRootAnimation { } } } +#endif diff --git a/Sources/Screen/Actions/Window/SetRoot/Animations/ScreenSetRootCustomAnimation.swift b/Sources/Screen/Actions/Window/SetRoot/Animations/ScreenSetRootCustomAnimation.swift index 60e905e0..0249351a 100644 --- a/Sources/Screen/Actions/Window/SetRoot/Animations/ScreenSetRootCustomAnimation.swift +++ b/Sources/Screen/Actions/Window/SetRoot/Animations/ScreenSetRootCustomAnimation.swift @@ -1,3 +1,4 @@ +#if canImport(UIKit) import UIKit public protocol ScreenSetRootCustomAnimation { @@ -9,3 +10,4 @@ public protocol ScreenSetRootCustomAnimation { completion: @escaping () -> Void ) } +#endif diff --git a/Sources/Screen/Actions/Window/SetRoot/Animations/ScreenSetRootTransitionAnimation.swift b/Sources/Screen/Actions/Window/SetRoot/Animations/ScreenSetRootTransitionAnimation.swift index c427f450..0bab9ad2 100644 --- a/Sources/Screen/Actions/Window/SetRoot/Animations/ScreenSetRootTransitionAnimation.swift +++ b/Sources/Screen/Actions/Window/SetRoot/Animations/ScreenSetRootTransitionAnimation.swift @@ -1,3 +1,4 @@ +#if canImport(UIKit) import UIKit public struct ScreenSetRootTransitionAnimation: ScreenSetRootCustomAnimation { @@ -45,3 +46,4 @@ extension ScreenSetRootAnimation { ScreenSetRootTransitionAnimation.crossDissolve ) } +#endif diff --git a/Sources/Screen/Actions/Window/SetRoot/ScreenSetRootAction.swift b/Sources/Screen/Actions/Window/SetRoot/ScreenSetRootAction.swift index 96ab25c1..5c966895 100644 --- a/Sources/Screen/Actions/Window/SetRoot/ScreenSetRootAction.swift +++ b/Sources/Screen/Actions/Window/SetRoot/ScreenSetRootAction.swift @@ -1,3 +1,4 @@ +#if canImport(UIKit) import UIKit public struct ScreenSetRootAction< @@ -69,3 +70,4 @@ extension ScreenRoute where Container: UIWindow { ) } } +#endif diff --git a/Sources/Screen/Any/AnyModalScreen.swift b/Sources/Screen/Any/AnyModalScreen.swift index d84176bf..fd795c99 100644 --- a/Sources/Screen/Any/AnyModalScreen.swift +++ b/Sources/Screen/Any/AnyModalScreen.swift @@ -1,3 +1,4 @@ +#if canImport(UIKit) import UIKit public typealias AnyModalScreen = AnyScreen @@ -25,3 +26,4 @@ extension Screen where Container: UIViewController { AnyModalScreen(self) } } +#endif diff --git a/Sources/Screen/Any/AnyStackScreen.swift b/Sources/Screen/Any/AnyStackScreen.swift index 52638e2e..4082c1b6 100644 --- a/Sources/Screen/Any/AnyStackScreen.swift +++ b/Sources/Screen/Any/AnyStackScreen.swift @@ -1,3 +1,4 @@ +#if canImport(UIKit) import UIKit public typealias AnyStackScreen = AnyScreen @@ -28,3 +29,4 @@ extension Screen where Container: UINavigationController { AnyStackScreen(self) } } +#endif diff --git a/Sources/Screen/Any/AnyTabsScreen.swift b/Sources/Screen/Any/AnyTabsScreen.swift index 8f9b88ea..bba8c001 100644 --- a/Sources/Screen/Any/AnyTabsScreen.swift +++ b/Sources/Screen/Any/AnyTabsScreen.swift @@ -1,3 +1,4 @@ +#if canImport(UIKit) import UIKit public typealias AnyTabsScreen = AnyScreen @@ -28,3 +29,4 @@ extension Screen where Container: UITabBarController { AnyTabsScreen(self) } } +#endif diff --git a/Sources/Screen/Container/Extensions/UIViewController+ScreenModalContainer.swift b/Sources/Screen/Container/Extensions/UIViewController+ScreenModalContainer.swift index ba68cd5a..ce173455 100644 --- a/Sources/Screen/Container/Extensions/UIViewController+ScreenModalContainer.swift +++ b/Sources/Screen/Container/Extensions/UIViewController+ScreenModalContainer.swift @@ -1,4 +1,5 @@ +#if canImport(UIKit) import UIKit -extension UIViewController: ScreenContainer { -} +extension UIViewController: ScreenContainer { } +#endif diff --git a/Sources/Screen/Container/Extensions/UIWindow+ScreenWindowContainer.swift b/Sources/Screen/Container/Extensions/UIWindow+ScreenWindowContainer.swift index a290adbf..64eb423a 100644 --- a/Sources/Screen/Container/Extensions/UIWindow+ScreenWindowContainer.swift +++ b/Sources/Screen/Container/Extensions/UIWindow+ScreenWindowContainer.swift @@ -1,3 +1,5 @@ +#if canImport(UIKit) import UIKit extension UIWindow: ScreenContainer { } +#endif diff --git a/Sources/Screen/Decorators/Modal/ModalStyle/ScreenModalStyle.swift b/Sources/Screen/Decorators/Modal/ModalStyle/ScreenModalStyle.swift index 03006519..49e6c1fb 100644 --- a/Sources/Screen/Decorators/Modal/ModalStyle/ScreenModalStyle.swift +++ b/Sources/Screen/Decorators/Modal/ModalStyle/ScreenModalStyle.swift @@ -1,3 +1,4 @@ +#if canImport(UIKit) import UIKit public enum ScreenModalStyle { @@ -9,3 +10,4 @@ public enum ScreenModalStyle { case custom(delegate: UIViewControllerTransitioningDelegate) } +#endif diff --git a/Sources/Screen/Decorators/Modal/ModalStyle/ScreenModalStyleDecorator.swift b/Sources/Screen/Decorators/Modal/ModalStyle/ScreenModalStyleDecorator.swift index dad59d2b..65033542 100644 --- a/Sources/Screen/Decorators/Modal/ModalStyle/ScreenModalStyleDecorator.swift +++ b/Sources/Screen/Decorators/Modal/ModalStyle/ScreenModalStyleDecorator.swift @@ -1,3 +1,4 @@ +#if canImport(UIKit) import UIKit public struct ScreenModalStyleDecorator: ScreenDecorator { @@ -67,3 +68,4 @@ extension Screen where Container: UIViewController { withModalStyle(.custom(delegate: delegate)) } } +#endif diff --git a/Sources/Screen/Decorators/Modal/ScreenLeftBarButtonDecorator.swift b/Sources/Screen/Decorators/Modal/ScreenLeftBarButtonDecorator.swift index 68b62e90..da33ab40 100644 --- a/Sources/Screen/Decorators/Modal/ScreenLeftBarButtonDecorator.swift +++ b/Sources/Screen/Decorators/Modal/ScreenLeftBarButtonDecorator.swift @@ -1,3 +1,4 @@ +#if canImport(UIKit) import UIKit public struct ScreenLeftBarButtonDecorator: ScreenDecorator { @@ -34,3 +35,4 @@ extension Screen where Container: UIViewController { decorated(by: ScreenLeftBarButtonDecorator(item: item)) } } +#endif diff --git a/Sources/Screen/Decorators/Modal/ScreenRightBarButtonDecorator.swift b/Sources/Screen/Decorators/Modal/ScreenRightBarButtonDecorator.swift index 30f24dfc..c6879691 100644 --- a/Sources/Screen/Decorators/Modal/ScreenRightBarButtonDecorator.swift +++ b/Sources/Screen/Decorators/Modal/ScreenRightBarButtonDecorator.swift @@ -1,3 +1,4 @@ +#if canImport(UIKit) import UIKit public struct ScreenRightBarButtonDecorator: ScreenDecorator { @@ -34,3 +35,4 @@ extension Screen where Container: UIViewController { decorated(by: ScreenRightBarButtonDecorator(item: item)) } } +#endif diff --git a/Sources/Screen/Decorators/Modal/ScreenStackContainerDecorator.swift b/Sources/Screen/Decorators/Modal/ScreenStackContainerDecorator.swift index bd670569..313ba2a4 100644 --- a/Sources/Screen/Decorators/Modal/ScreenStackContainerDecorator.swift +++ b/Sources/Screen/Decorators/Modal/ScreenStackContainerDecorator.swift @@ -1,3 +1,4 @@ +#if canImport(UIKit) import UIKit public struct ScreenStackContainerDecorator< @@ -37,3 +38,4 @@ extension Screen where Container: UIViewController { withStackContainer(of: UINavigationController.self) } } +#endif diff --git a/Sources/Screen/Decorators/Modal/ScreenTabBarItemDecorator.swift b/Sources/Screen/Decorators/Modal/ScreenTabBarItemDecorator.swift index eb722f75..ae762f77 100644 --- a/Sources/Screen/Decorators/Modal/ScreenTabBarItemDecorator.swift +++ b/Sources/Screen/Decorators/Modal/ScreenTabBarItemDecorator.swift @@ -1,3 +1,4 @@ +#if canImport(UIKit) import UIKit public struct ScreenTabBarItemDecorator: ScreenDecorator { @@ -34,3 +35,4 @@ extension Screen where Container: UIViewController { decorated(by: ScreenTabBarItemDecorator(item: item)) } } +#endif diff --git a/Sources/Screen/Decorators/Stack/ScreenStackDecorator.swift b/Sources/Screen/Decorators/Stack/ScreenStackDecorator.swift index 8834c48c..53323abe 100644 --- a/Sources/Screen/Decorators/Stack/ScreenStackDecorator.swift +++ b/Sources/Screen/Decorators/Stack/ScreenStackDecorator.swift @@ -1,3 +1,4 @@ +#if canImport(UIKit) import UIKit public struct ScreenStackDecorator: ScreenDecorator { @@ -116,3 +117,4 @@ extension Screen where Container: UINavigationController { ) } } +#endif diff --git a/Sources/Screen/Decorators/Tabs/ScreenTabsDecorator.swift b/Sources/Screen/Decorators/Tabs/ScreenTabsDecorator.swift index 09fec36a..ca616732 100644 --- a/Sources/Screen/Decorators/Tabs/ScreenTabsDecorator.swift +++ b/Sources/Screen/Decorators/Tabs/ScreenTabsDecorator.swift @@ -1,3 +1,4 @@ +#if canImport(UIKit) import UIKit public struct ScreenTabsDecorator: ScreenDecorator { @@ -116,3 +117,4 @@ extension Screen where Container: UITabBarController { ) } } +#endif diff --git a/Sources/Screen/Navigation/Iterator/DefaultScreenIterator.swift b/Sources/Screen/Navigation/Iterator/DefaultScreenIterator.swift index 8c982f09..cce635e4 100644 --- a/Sources/Screen/Navigation/Iterator/DefaultScreenIterator.swift +++ b/Sources/Screen/Navigation/Iterator/DefaultScreenIterator.swift @@ -1,3 +1,4 @@ +#if canImport(UIKit) import UIKit public final class DefaultScreenIterator: ScreenIterator { @@ -12,7 +13,7 @@ public final class DefaultScreenIterator: ScreenIterator { var recentContainer = fallbackContainer for container in containers { - switch predicate(container) { + switch predicate.checkContainer(container) { case let .shouldContinue(matchingContainer): recentContainer = matchingContainer ?? recentContainer @@ -96,7 +97,7 @@ public final class DefaultScreenIterator: ScreenIterator { let recentContainer: ScreenContainer? - switch predicate(presentedContainer) { + switch predicate.checkContainer(presentedContainer) { case let .shouldContinue(matchingContainer): recentContainer = matchingContainer ?? localRecentContainer @@ -122,7 +123,7 @@ public final class DefaultScreenIterator: ScreenIterator { let recentContainer: ScreenContainer? - switch predicate(rootContainer) { + switch predicate.checkContainer(rootContainer) { case let .shouldContinue(matchingContainer): recentContainer = matchingContainer ?? fallbackContainer @@ -143,7 +144,7 @@ public final class DefaultScreenIterator: ScreenIterator { ) -> ScreenContainer? { let recentContainer: ScreenContainer? - switch predicate(container) { + switch predicate.checkContainer(container) { case let .shouldContinue(matchingContainer): recentContainer = matchingContainer @@ -197,3 +198,4 @@ public final class DefaultScreenIterator: ScreenIterator { ) } } +#endif diff --git a/Sources/Screen/Navigation/Iterator/ScreenIterationPredicate.swift b/Sources/Screen/Navigation/Iterator/ScreenIterationPredicate.swift index 34942e0b..96247f8e 100644 --- a/Sources/Screen/Navigation/Iterator/ScreenIterationPredicate.swift +++ b/Sources/Screen/Navigation/Iterator/ScreenIterationPredicate.swift @@ -8,7 +8,7 @@ public struct ScreenIterationPredicate { self.box = box } - public func callAsFunction(_ container: ScreenContainer) -> ScreenIterationResult { + public func checkContainer(_ container: ScreenContainer) -> ScreenIterationResult { box(container) } } diff --git a/Sources/Screen/Navigation/Navigator/DefaultScreenNavigator.swift b/Sources/Screen/Navigation/Navigator/DefaultScreenNavigator.swift index c0c3d603..9172c292 100644 --- a/Sources/Screen/Navigation/Navigator/DefaultScreenNavigator.swift +++ b/Sources/Screen/Navigation/Navigator/DefaultScreenNavigator.swift @@ -1,3 +1,4 @@ +#if canImport(UIKit) import UIKit public final class DefaultScreenNavigator: ScreenNavigator { @@ -53,3 +54,4 @@ public final class DefaultScreenNavigator: ScreenNavigator { } } } +#endif diff --git a/Sources/Screen/Navigation/Navigator/ScreenNavigator.swift b/Sources/Screen/Navigation/Navigator/ScreenNavigator.swift index e4278de3..1232cb85 100644 --- a/Sources/Screen/Navigation/Navigator/ScreenNavigator.swift +++ b/Sources/Screen/Navigation/Navigator/ScreenNavigator.swift @@ -1,11 +1,16 @@ +#if canImport(UIKit) import UIKit +#else +import Foundation +#endif public protocol ScreenNavigator { - typealias Completion = (Result) -> Void + #if canImport(UIKit) func perform( action: Action, completion: Completion? ) where Action.Container == UIWindow + #endif } diff --git a/Sources/Screen/Navigation/WindowProvider/ScreenCustomWindowProvider.swift b/Sources/Screen/Navigation/WindowProvider/ScreenCustomWindowProvider.swift index b8b62d3b..b15c9696 100644 --- a/Sources/Screen/Navigation/WindowProvider/ScreenCustomWindowProvider.swift +++ b/Sources/Screen/Navigation/WindowProvider/ScreenCustomWindowProvider.swift @@ -1,3 +1,4 @@ +#if canImport(UIKit) import UIKit public struct ScreenCustomWindowProvider: ScreenWindowProvider { @@ -8,3 +9,4 @@ public struct ScreenCustomWindowProvider: ScreenWindowProvider { self.window = window } } +#endif diff --git a/Sources/Screen/Navigation/WindowProvider/ScreenKeyWindowProvider.swift b/Sources/Screen/Navigation/WindowProvider/ScreenKeyWindowProvider.swift index 9429755b..fff90f80 100644 --- a/Sources/Screen/Navigation/WindowProvider/ScreenKeyWindowProvider.swift +++ b/Sources/Screen/Navigation/WindowProvider/ScreenKeyWindowProvider.swift @@ -1,3 +1,4 @@ +#if canImport(UIKit) import UIKit public struct ScreenKeyWindowProvider: ScreenWindowProvider { @@ -16,3 +17,4 @@ public struct ScreenKeyWindowProvider: ScreenWindowProvider { self.application = application } } +#endif diff --git a/Sources/Screen/Navigation/WindowProvider/ScreenWindowProvider.swift b/Sources/Screen/Navigation/WindowProvider/ScreenWindowProvider.swift index 4a3e5875..1397e1c9 100644 --- a/Sources/Screen/Navigation/WindowProvider/ScreenWindowProvider.swift +++ b/Sources/Screen/Navigation/WindowProvider/ScreenWindowProvider.swift @@ -1,5 +1,7 @@ +#if canImport(UIKit) import UIKit public protocol ScreenWindowProvider { var window: UIWindow? { get } } +#endif diff --git a/Sources/Screen/Route/Aliases/ScreenModalRoute.swift b/Sources/Screen/Route/Aliases/ScreenModalRoute.swift index efe03f7a..4b792fbe 100644 --- a/Sources/Screen/Route/Aliases/ScreenModalRoute.swift +++ b/Sources/Screen/Route/Aliases/ScreenModalRoute.swift @@ -1,3 +1,5 @@ +#if canImport(UIKit) import UIKit public typealias ScreenModalRoute = ScreenRoute +#endif diff --git a/Sources/Screen/Route/Aliases/ScreenStackRoute.swift b/Sources/Screen/Route/Aliases/ScreenStackRoute.swift index d0ab1863..55888055 100644 --- a/Sources/Screen/Route/Aliases/ScreenStackRoute.swift +++ b/Sources/Screen/Route/Aliases/ScreenStackRoute.swift @@ -1,3 +1,5 @@ +#if canImport(UIKit) import UIKit public typealias ScreenStackRoute = ScreenRoute +#endif diff --git a/Sources/Screen/Route/Aliases/ScreenTabsRoute.swift b/Sources/Screen/Route/Aliases/ScreenTabsRoute.swift index d79e2659..65d7b8b7 100644 --- a/Sources/Screen/Route/Aliases/ScreenTabsRoute.swift +++ b/Sources/Screen/Route/Aliases/ScreenTabsRoute.swift @@ -1,3 +1,5 @@ +#if canImport(UIKit) import UIKit public typealias ScreenTabsRoute = ScreenRoute +#endif diff --git a/Sources/Screen/Route/Aliases/ScreenWindowRoute.swift b/Sources/Screen/Route/Aliases/ScreenWindowRoute.swift index ad20dc61..e99dbe4b 100644 --- a/Sources/Screen/Route/Aliases/ScreenWindowRoute.swift +++ b/Sources/Screen/Route/Aliases/ScreenWindowRoute.swift @@ -1,3 +1,5 @@ +#if canImport(UIKit) import UIKit public typealias ScreenWindowRoute = ScreenRoute +#endif diff --git a/Tests/NivelirTests.swift b/Tests/NivelirTests.swift index 42d9bafe..83ae13e2 100644 --- a/Tests/NivelirTests.swift +++ b/Tests/NivelirTests.swift @@ -1,4 +1,4 @@ -import UIKit +import Foundation import XCTest import Nivelir