Skip to content

Commit

Permalink
Updated to swift 5.7
Browse files Browse the repository at this point in the history
Minor fix for presented view controller traverse
  • Loading branch information
Eugene Kazaev committed Oct 21, 2022
1 parent ccc41f3 commit 7147af6
Show file tree
Hide file tree
Showing 435 changed files with 7,238 additions and 7,178 deletions.
4 changes: 2 additions & 2 deletions Example/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PODS:
- RouteComposer (2.8.2)
- RouteComposer (2.9.0)
- SwiftFormat/CLI (0.43.5)

DEPENDENCIES:
Expand All @@ -15,7 +15,7 @@ EXTERNAL SOURCES:
:path: "../"

SPEC CHECKSUMS:
RouteComposer: 47a49308cf3f912650ac10f5dd4dd7ee28f5d23c
RouteComposer: de2cc86f4431126953351d01b319c394182fcfe1
SwiftFormat: 352ea545e3e13cfd7a449e621c1f3c2e244d4906

PODFILE CHECKSUM: fc9566202a2f646e3cbb198c10cf157d9dd60f4f
Expand Down
4 changes: 2 additions & 2 deletions Example/Pods/Local Podspecs/RouteComposer.podspec.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Example/Pods/Manifest.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2,946 changes: 1,476 additions & 1,470 deletions Example/Pods/Pods.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Example/RouteComposer/Base.lproj/LaunchScreen.xib
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="18122" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" colorMatched="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="21225" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="18093"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21207"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
Expand All @@ -15,7 +15,7 @@
<subviews>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" minimumFontSize="9" translatesAutoresizingMaskIntoConstraints="NO" id="8ie-xW-0ye">
<rect key="frame" x="20" y="419" width="440" height="41"/>
<string key="text">Created by Eugene Kazaev in 2018-2021
<string key="text">Created by Eugene Kazaev in 2018-2022
Distributed under the MIT license</string>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" systemColor="darkTextColor"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class CitiesTableViewController: UITableViewController, ExampleAnalyticsSupport

@IBAction func goToProductTapped() {
// This is just for demo purposes and to test the last configuration in `ProductConfiguration`
let router = self.router
let router = router
try? router.navigate(to: ConfigurationHolder.configuration.welcomeScreen, animated: true) { _ in
UIApplication.shared.beginIgnoringInteractionEvents()
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + Double(Int64(1 * Double(NSEC_PER_SEC))) / Double(NSEC_PER_SEC)) {
Expand Down
2 changes: 1 addition & 1 deletion Example/RouteComposer_ExampleUITests/ShortUITests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ class ShortUITests: XCTestCase {
XCTAssertTrue(app.otherElements["productViewController+02"].waitForExistence(timeout: 3))

app.buttons.matching(identifier: "Go to Product 01").element(boundBy: 0).tap()
XCTAssertTrue(app.otherElements["productViewController+01"].waitForExistence(timeout: 3))
XCTAssertTrue(app.otherElements["productViewController+01"].waitForExistence(timeout: 5))

app.buttons["Go to next Product from Circle"].tap()
XCTAssertTrue(app.otherElements["productViewController+02"].waitForExistence(timeout: 3))
Expand Down
2 changes: 1 addition & 1 deletion Example/Tests/ExtrasTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class ExtrasTest: XCTestCase {
var globalInterceptorRun = 0
var globalTaskRun = 0
var globalPostTaskRun = 0
var router = self.router
var router = router
router.add(InlineInterceptor(prepare: { (_: Any?) throws in
globalInterceptorPrepared += 1
}, { (_: Any?, completion: @escaping (RoutingResult) -> Void) in
Expand Down
2 changes: 1 addition & 1 deletion Example/Tests/RouterTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ class RouterTests: XCTestCase {
.using(FakePresentModallyAction())
.from(DestinationStep<TestModalPresentableController, TestProtocol>(TestCurrentViewControllerStep(currentViewController: currentViewController)))
.assemble()
var router = self.router
var router = router
router.add(InlineInterceptor(prepare: { (_: Any?) throws in
globalInterceptorPrepared += 1
}, { (_: Any?, completion: @escaping (RoutingResult) -> Void) in
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
[![Swift Package Manager](https://img.shields.io/badge/SwiftPM-compatible-brightgreen.svg?style=flat)](https://github.com/apple/swift-package-manager)
[![SwiftUI](https://img.shields.io/badge/SwiftUI-compatible-0AB42A.svg?style=flat)](https://developer.apple.com/xcode/swiftui/)
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BA51D.svg?style=flat)](https://github.com/Carthage/Carthage)
[![Swift 5.2](https://img.shields.io/badge/language-Swift5.2-orange.svg?style=flat)](https://developer.apple.com/swift)
[![Platform iOS](https://img.shields.io/badge/platform-iOS%209%20—%20iOS%2015-yellow.svg)](https://www.apple.com/ios)
[![Swift 5.7](https://img.shields.io/badge/language-Swift5.7-orange.svg?style=flat)](https://developer.apple.com/swift)
[![Platform iOS](https://img.shields.io/badge/platform-iOS%209%20—%20iOS%2016-yellow.svg)](https://www.apple.com/ios)
[![Documentation](https://ekazaev.github.io/route-composer/badge.svg)](https://ekazaev.github.io/route-composer)
[![Code coverage](https://codecov.io/gh/ekazaev/route-composer/branch/master/graphs/badge.svg?style=flat)](https://ekazaev.github.io/route-composer/tests/index.html)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/d54c6461dab64cc5a3be79734588de52)](https://app.codacy.com/gh/ekazaev/route-composer?utm_source=github.com&utm_medium=referral&utm_content=ekazaev/route-composer&utm_campaign=Badge_Grade_Settings)
Expand Down
2 changes: 1 addition & 1 deletion RouteComposer.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'RouteComposer'
s.version = '2.8.3'
s.version = '2.9.0'
s.summary = 'Protocol oriented library that helps to handle view controllers composition, navigation and deep linking tasks.'
s.swift_version = '5.2'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public struct ActionConnectingAssembly<VC: UIViewController, C> {
/// - Parameter action: `Action` instance to be used with a step.
/// - Returns: `ChainAssembly` to continue building the chain.
public func using<A: Action>(_ action: A) -> StepChainAssembly<VC, C> {
var previousSteps = self.previousSteps
var previousSteps = previousSteps
if let routingStep = stepToFullFill.routingStep(with: action) {
previousSteps.append(routingStep)
}
Expand All @@ -43,7 +43,7 @@ public struct ActionConnectingAssembly<VC: UIViewController, C> {
/// - Parameter action: `Action` instance to be used with a step.
/// - Returns: `ChainAssembly` to continue building the chain.
public func using<A: ContainerAction>(_ action: A) -> ContainerStepChainAssembly<A.ViewController, VC, C> {
var previousSteps = self.previousSteps
var previousSteps = previousSteps
if let routingStep = stepToFullFill.embeddableRoutingStep(with: action) {
previousSteps.append(routingStep)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public final class CompleteFactoryChainAssembly<FC: ContainerFactory, ChildVC: U
private let previousChildFactory: PostponedIntegrationFactory<FC.Context>?

private var integratedChildFactories: [PostponedIntegrationFactory<FC.Context>] {
var childFactories = self.childFactories
var childFactories = childFactories
if let previousChildFactory = previousChildFactory {
childFactories.append(previousChildFactory)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public struct ContainerStepChainAssembly<AcceptableContainer: ContainerViewContr
///
/// - Parameter previousStep: The instance of `DestinationStep`
public func from(_ step: DestinationStep<AcceptableContainer, Context>) -> LastStepInChainAssembly<ViewController, Context> {
var previousSteps = self.previousSteps
var previousSteps = previousSteps
previousSteps.append(step)
return LastStepInChainAssembly(previousSteps: previousSteps)
}
Expand All @@ -44,7 +44,7 @@ public struct ContainerStepChainAssembly<AcceptableContainer: ContainerViewContr
/// - Parameter step: An instance of `DestinationStep` to build a current stack from.
/// - Returns: An instance of `DestinationStep` with all the provided settings inside.
public func assemble(from step: DestinationStep<AcceptableContainer, Context>) -> DestinationStep<ViewController, Context> {
var previousSteps = self.previousSteps
var previousSteps = previousSteps
previousSteps.append(step)
return LastStepInChainAssembly(previousSteps: previousSteps).assemble()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public struct StepChainAssembly<ViewController: UIViewController, Context> {
///
/// - Parameter previousStep: The instance of `DestinationStep`
public func from<VC: UIViewController>(_ step: DestinationStep<VC, Context>) -> LastStepInChainAssembly<ViewController, Context> {
var previousSteps = self.previousSteps
var previousSteps = previousSteps
previousSteps.append(step)
return LastStepInChainAssembly<ViewController, Context>(previousSteps: previousSteps)
}
Expand All @@ -44,7 +44,7 @@ public struct StepChainAssembly<ViewController: UIViewController, Context> {
/// - Parameter step: An instance of `DestinationStep` to start to build a current step from.
/// - Returns: An instance of `DestinationStep` with all the provided settings inside.
public func assemble<VC: UIViewController>(from step: DestinationStep<VC, Context>) -> DestinationStep<ViewController, Context> {
var previousSteps = self.previousSteps
var previousSteps = previousSteps
previousSteps.append(step)
return LastStepInChainAssembly<ViewController, Context>(previousSteps: previousSteps).assemble()
}
Expand Down
16 changes: 8 additions & 8 deletions RouteComposer/Classes/Assemblies/StepAssembly.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public extension StepAssembly where FC: Factory {
///
/// - Parameter action: `Action` instance to be used with a step.
final func using<A: Action>(_ action: A) -> StepChainAssembly<ViewController, Context> {
var previousSteps = self.previousSteps
var previousSteps = previousSteps
let entitiesCollector = BaseEntitiesCollector<FactoryBox<FC>, ActionBox>(finder: finder, factory: factory, action: action)
let step = BaseStep(entitiesProvider: entitiesCollector, taskProvider: taskCollector)
previousSteps.append(step)
Expand All @@ -75,7 +75,7 @@ public extension StepAssembly where FC: Factory {
///
/// - Parameter action: `ContainerAction` instance to be used with a step.
final func using<A: ContainerAction>(_ action: A) -> ContainerStepChainAssembly<A.ViewController, ViewController, Context> {
var previousSteps = self.previousSteps
var previousSteps = previousSteps
let entitiesCollector = BaseEntitiesCollector<FactoryBox<FC>, ContainerActionBox>(finder: finder, factory: factory, action: action)
let step = BaseStep(entitiesProvider: entitiesCollector, taskProvider: taskCollector)
previousSteps.append(step)
Expand All @@ -101,7 +101,7 @@ public extension StepAssembly where FC: ContainerFactory {
///
/// - Parameter action: `Action` instance to be used with a step.
final func using<A: Action>(_ action: A) -> StepChainAssembly<ViewController, Context> {
var previousSteps = self.previousSteps
var previousSteps = previousSteps
let entitiesCollector = BaseEntitiesCollector<ContainerFactoryBox<FC>, ActionBox>(finder: finder, factory: factory, action: action)
let step = BaseStep(entitiesProvider: entitiesCollector, taskProvider: taskCollector)
previousSteps.append(step)
Expand All @@ -112,7 +112,7 @@ public extension StepAssembly where FC: ContainerFactory {
///
/// - Parameter action: `ContainerAction` instance to be used with a step.
final func using<A: ContainerAction>(_ action: A) -> ContainerStepChainAssembly<A.ViewController, ViewController, Context> {
var previousSteps = self.previousSteps
var previousSteps = previousSteps
let entitiesCollector = BaseEntitiesCollector<ContainerFactoryBox<FC>, ContainerActionBox>(finder: finder, factory: factory, action: action)
let step = BaseStep(entitiesProvider: entitiesCollector, taskProvider: taskCollector)
previousSteps.append(step)
Expand All @@ -130,7 +130,7 @@ public extension StepAssembly where FC: Factory & NilEntity {
///
/// - Parameter step: `ActionToStepIntegrator` instance to be used.
final func from<VC: UIViewController>(_ step: ActionToStepIntegrator<VC, Context>) -> ActionConnectingAssembly<ViewController, Context> {
var previousSteps = self.previousSteps
var previousSteps = previousSteps
let entitiesCollector = BaseEntitiesCollector<FactoryBox<FC>, ActionBox>(finder: finder, factory: factory, action: ViewControllerActions.NilAction())
let currentStep = BaseStep(entitiesProvider: entitiesCollector, taskProvider: taskCollector)
previousSteps.append(currentStep)
Expand All @@ -143,7 +143,7 @@ public extension StepAssembly where FC: Factory & NilEntity {
///
/// - Parameter step: `DestinationStep` instance to be used.
final func from<VC: UIViewController>(_ step: DestinationStep<VC, Context>) -> LastStepInChainAssembly<ViewController, Context> {
var previousSteps = self.previousSteps
var previousSteps = previousSteps
let entitiesCollector = BaseEntitiesCollector<FactoryBox<FC>, ActionBox>(finder: finder, factory: factory, action: ViewControllerActions.NilAction())
let currentStep = BaseStep(entitiesProvider: entitiesCollector, taskProvider: taskCollector)
previousSteps.append(currentStep)
Expand All @@ -162,7 +162,7 @@ public extension StepAssembly where FC: ContainerFactory & NilEntity {
///
/// - Parameter step: `ActionToStepIntegrator` instance to be used.
final func from<VC: UIViewController>(_ step: ActionToStepIntegrator<VC, Context>) -> ActionConnectingAssembly<ViewController, Context> {
var previousSteps = self.previousSteps
var previousSteps = previousSteps
let entitiesCollector = BaseEntitiesCollector<ContainerFactoryBox<FC>, ActionBox>(finder: finder, factory: factory, action: ViewControllerActions.NilAction())
let currentStep = BaseStep(entitiesProvider: entitiesCollector, taskProvider: taskCollector)
previousSteps.append(currentStep)
Expand All @@ -174,7 +174,7 @@ public extension StepAssembly where FC: ContainerFactory & NilEntity {
///
/// - Parameter step: `DestinationStep` instance to be used.
final func from<VC: UIViewController>(_ step: DestinationStep<VC, Context>) -> LastStepInChainAssembly<ViewController, Context> {
var previousSteps = self.previousSteps
var previousSteps = previousSteps
let entitiesCollector = BaseEntitiesCollector<ContainerFactoryBox<FC>, ActionBox>(finder: finder, factory: factory, action: ViewControllerActions.NilAction())
let currentStep = BaseStep(entitiesProvider: entitiesCollector, taskProvider: taskCollector)
previousSteps.append(currentStep)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public extension UIViewController {
/// - Parameters:
/// - viewController: A `UIViewController` instance to start from.
/// - options: A combination of `SearchOptions`.
/// - containerAdapterLocator: A `ContainerAdapterLocator` instance.
/// - predicate: A block that should return `true` if the `UIViewController` instance provided is the
/// one that is being searched for.
/// - Returns: A `UIViewController` instance if found, `nil` otherwise.
Expand Down Expand Up @@ -48,8 +49,12 @@ public extension UIViewController {
viewControllers.append(containerAdapter.containedViewControllers)
}
for currentViewController in Array(viewControllers.joined()).uniqueElements() {
var internalOptions: SearchOptions = options.contains(.visible) ? .currentVisibleOnly : [.current, .contained]
if options.contains(.presented) {
internalOptions.insert(.presented)
}
if let foundViewController = try findViewController(in: currentViewController,
options: options.contains(.visible) ? .currentVisibleOnly : [.current, .contained],
options: internalOptions,
containerAdapterLocator: containerAdapterLocator,
using: predicate) {
return foundViewController
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,8 @@ extension DefaultRouter {
guard let interceptableStep = step as? InterceptableStep else {
return StepTaskTaskRunner(contextTaskRunner: self.contextTaskRunner, postTaskRunner: self.postTaskRunner)
}
var contextTaskRunner = self.contextTaskRunner
var postTaskRunner = self.postTaskRunner
var contextTaskRunner = contextTaskRunner
var postTaskRunner = postTaskRunner
if let interceptor = interceptableStep.interceptor {
try interceptorRunner.add(interceptor, with: context)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ struct InterceptorMultiplexer: AnyRoutingInterceptor, MainThreadChecking, Custom
return
}

var interceptors = self.interceptors
var interceptors = interceptors

func runInterceptor(interceptor: AnyRoutingInterceptor) {
assertIfNotMainThread()
Expand Down

0 comments on commit 7147af6

Please sign in to comment.