Skip to content

Commit

Permalink
Added swift 6 concurrency support
Browse files Browse the repository at this point in the history
  • Loading branch information
ekazaev committed Nov 27, 2024
1 parent 4e36526 commit d375cb9
Show file tree
Hide file tree
Showing 113 changed files with 894 additions and 722 deletions.
2 changes: 1 addition & 1 deletion Example/Podfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
platform :ios, '11.0'
platform :ios, '14.0'
use_frameworks!

plugin 'slather'
Expand Down
6 changes: 3 additions & 3 deletions Example/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PODS:
- RouteComposer (2.10.5)
- RouteComposer (2.11.0)
- SwiftFormat/CLI (0.43.5)

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

SPEC CHECKSUMS:
RouteComposer: 7b27013033d55f7497c98dff81df64fcf946d787
RouteComposer: 7b587bcabbe8959232ff165131642871e35cbf3f
SwiftFormat: 352ea545e3e13cfd7a449e621c1f3c2e244d4906

PODFILE CHECKSUM: fc9566202a2f646e3cbb198c10cf157d9dd60f4f
PODFILE CHECKSUM: 3ede96e31e2fe7b8817db5fc1159a04214193e71

COCOAPODS: 1.13.0
10 changes: 5 additions & 5 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.

6 changes: 3 additions & 3 deletions Example/Pods/Manifest.lock

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

1,228 changes: 612 additions & 616 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.

4 changes: 2 additions & 2 deletions Example/RouteComposer.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1111,7 +1111,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 15.6;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand Down Expand Up @@ -1161,7 +1161,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 15.6;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import SwiftUI

let transitionController = BlurredBackgroundTransitionController()

@MainActor
protocol ExampleScreenConfiguration {

var homeScreen: DestinationStep<UITabBarController, Any?> { get }
Expand Down Expand Up @@ -203,6 +204,7 @@ struct AlternativeExampleConfiguration: ExampleScreenConfiguration {
enum ConfigurationHolder {

// Declared as static to avoid dependency injection in the Example app. So this variable is available everywhere.
@MainActor
static var configuration: ExampleScreenConfiguration = ExampleConfiguration()

}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

import Foundation

@MainActor
public protocol CustomViewControllerDelegate: AnyObject {

func dismissCustomContainer(controller: CustomContainerController)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

import Foundation

@MainActor
public protocol ImageDetailsControllerDelegate: AnyObject {

func dismiss(imageDetails: ImageDetailsViewController)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

import Foundation

@MainActor
public protocol ImagesControllerDelegate: AnyObject {

func didSelect(imageID: String, in controller: ImagesViewController)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import Foundation
import RouteComposer
import UIKit

@MainActor
protocol ExampleURLTranslator {

func destination(from url: URL) -> AnyDestination?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,15 @@ import UIKit
// transforming data that is contained in the `URL` into `AnyDestination` instance.
enum ExampleUniversalLinksManager {

@MainActor
private static var translators: [ExampleURLTranslator] = []

@MainActor
static func register(translator: ExampleURLTranslator) {
translators.append(translator)
}

@MainActor
static func destination(for url: URL) -> AnyDestination? {
guard let translator = translators.first(where: { $0.destination(from: url) != nil }) else {
return nil
Expand All @@ -36,6 +39,7 @@ enum ExampleUniversalLinksManager {

extension ExampleUniversalLinksManager {

@MainActor
static func configure() {
ExampleUniversalLinksManager.register(translator: ColorURLTranslator())
ExampleUniversalLinksManager.register(translator: ProductURLTranslator())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import UIKit
class CitiesConfiguration {

// Split View Controller
@MainActor
private static var city = StepAssembly(finder: ClassFinder<UISplitViewController, Void>(), // Context type `Void` here is only used to demonstrate the possibility of context transformation.
factory: StoryboardFactory(name: "Split"))
.adding(LoginInterceptor<Void>())
Expand All @@ -26,13 +27,15 @@ class CitiesConfiguration {
.assemble()

// Cities List
@MainActor
private static var citiesList = StepAssembly(finder: ClassFinder<CitiesTableViewController, String?>(),
factory: NilFactory())
.adding(CityTableContextTask())
.from(city.adaptingContext(using: InlineContextTransformer { _ in () })) // We have to transform `String?` to `Void` to satisfy the requirements
.assemble()

// City Details
@MainActor
private static var cityDetails = StepAssembly(
finder: ClassFinder<CityDetailViewController, Int>(),
factory: StoryboardFactory(name: "Split",
Expand All @@ -42,10 +45,12 @@ class CitiesConfiguration {
.from(citiesList.adaptingContext(using: InlineContextTransformer { $0.flatMap { "\($0)" } }).expectingContainer()) // We have to transform `Int` to `String?` to satisfy the requirements
.assemble()

@MainActor
static func citiesList(cityId: Int? = nil) -> Destination<CitiesTableViewController, String?> {
Destination(to: citiesList, with: cityId.flatMap { "\($0)" } ?? nil)
}

@MainActor
static func cityDetail(cityId: Int) -> Destination<CityDetailViewController, Int> {
Destination(to: cityDetails, with: cityId)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import RouteComposer
import UIKit

enum InternalSearchConfiguration {
@MainActor
private static let completeFactory = CompleteFactoryAssembly(factory: TabBarControllerFactory())
.with(CompleteFactoryAssembly(factory: NavigationControllerFactory<UINavigationController, MainScreenContext>(configuration: { $0.tabBarItem.title = "Home" /* One way */ }))
.with(ClassFactory<HomeViewController, MainScreenContext>())
Expand All @@ -27,6 +28,7 @@ enum InternalSearchConfiguration {
})
.assemble()

@MainActor
private static let mainScreenFromCircle = StepAssembly(
finder: NilFinder<UITabBarController, MainScreenContext>(),
factory: completeFactory)
Expand All @@ -43,12 +45,14 @@ enum InternalSearchConfiguration {
.from(ConfigurationHolder.configuration.circleScreen.expectingContainer())
.assemble()

@MainActor
static let home = Destination(to: StepAssembly(
finder: ClassWithContextFinder<HomeViewController, MainScreenContext>(),
factory: NilFactory())
.from(mainScreenFromCircle)
.assemble(), with: .home)

@MainActor
static let settings = Destination(to: StepAssembly(
finder: ClassWithContextFinder<SettingsViewController, MainScreenContext>(),
factory: NilFactory())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import RouteComposer

enum LoginConfiguration {

@MainActor
static func login() -> Destination<LoginViewController, Void> {
let loginScreen = StepAssembly(finder: ClassFinder<LoginViewController, Void>(),
factory: NilFactory()) // Login view controller will be created when UINavigationController will be loaded from storyboard.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import UIKit

enum ImagesConfigurationWithLibrary {

@MainActor
private static let imagesContainerStep = StepAssembly(
finder: ClassFinder<CustomContainerController, Any?>(),
factory: CustomContainerFactory(delegate: ImagesWithLibraryHandler.shared))
Expand All @@ -28,6 +29,7 @@ enum ImagesConfigurationWithLibrary {
.from(GeneralStep.current())
.assemble()

@MainActor
static func images() -> Destination<ImagesViewController, Any?> {
let imagesStep = StepAssembly(
finder: ClassFinder(),
Expand All @@ -38,6 +40,7 @@ enum ImagesConfigurationWithLibrary {
return Destination(to: imagesStep)
}

@MainActor
static func imageDetails(for imageID: String) -> Destination<ImageDetailsViewController, String> {
let imageDetailsStep = StepAssembly(
finder: ClassFinder(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ class ImagesWithoutLibraryConfiguration {

static let shared = ImagesWithoutLibraryConfiguration()

@MainActor
private static let handler = ImagesWithoutLibraryHandler()

@MainActor
func showCustomController() {
// Handled by CustomContainerFactory
let storyboard = UIStoryboard(name: "Images", bundle: Bundle.main)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import UIKit

class ProductConfiguration {

@MainActor
static let productScreen = StepAssembly(
finder: ClassWithContextFinder<ProductViewController, ProductContext>(),
factory: StoryboardFactory(name: "TabBar", identifier: "ProductViewController"))
Expand Down Expand Up @@ -45,6 +46,7 @@ class ProductConfiguration {
.assemble()

// This path is used to test the transactions in presentations. Does not have any other purposes
@MainActor
static let productScreenFromCircle = StepAssembly(
finder: ClassWithContextFinder<ProductViewController, ProductContext>(),
factory: NilFactory())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import RouteComposer
import UIKit

enum WishListConfiguration {
@MainActor
static let wishListScreen = StepAssembly(
finder: ClassFinder<WishListViewController, WishListContext>(),
factory: StoryboardFactory(name: "TabBar", identifier: "WishListViewController"))
Expand All @@ -26,10 +27,12 @@ enum WishListConfiguration {
.from(GeneralStep.current())
.assemble()

@MainActor
static func favorites() -> Destination<WishListViewController, WishListContext> {
Destination(to: wishListScreen, with: WishListContext.favorites)
}

@MainActor
static func collections() -> Destination<WishListViewController, WishListContext> {
Destination(to: wishListScreen, with: WishListContext.collections)
}
Expand Down
1 change: 1 addition & 0 deletions Example/Tests/ActionTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import UIKit
import XCTest

@MainActor
class ActionTests: XCTestCase {

override func setUp() {
Expand Down
1 change: 1 addition & 0 deletions Example/Tests/AssemblyTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import Foundation
import UIKit
import XCTest

@MainActor
class AssemblyTest: XCTestCase {

struct NilContainerFactory<VC: ContainerViewController, C>: ContainerFactory, NilEntity {
Expand Down
1 change: 1 addition & 0 deletions Example/Tests/BoxTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import UIKit
import XCTest

@MainActor
class BoxTests: XCTestCase {

func testFactoryBox() {
Expand Down
1 change: 1 addition & 0 deletions Example/Tests/ContainerLocatorTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import UIKit
import XCTest

@MainActor
class ContainerLocatorTests: XCTestCase {

class TestContainerController: UIViewController, CustomContainerViewController {
Expand Down
1 change: 1 addition & 0 deletions Example/Tests/ContainerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import UIKit
import XCTest

@MainActor
class ContainerTests: XCTestCase {

func testChildCoordinatorBuild() {
Expand Down
1 change: 1 addition & 0 deletions Example/Tests/DestinationStepTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import UIKit
import XCTest

@MainActor
class DestinationStepTests: XCTestCase {

struct TestFinder<VC: UIViewController, C>: Finder {
Expand Down
1 change: 1 addition & 0 deletions Example/Tests/ExtensionsTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import Foundation
import UIKit
import XCTest

@MainActor
class ExtensionsTest: XCTestCase {

class InvisibleViewController: UIViewController {}
Expand Down
1 change: 1 addition & 0 deletions Example/Tests/ExtrasTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import Foundation
import UIKit
import XCTest

@MainActor
class ExtrasTest: XCTestCase {

let router = SingleNavigationRouter(router: DefaultRouter(), lock: SingleNavigationLock())
Expand Down
1 change: 1 addition & 0 deletions Example/Tests/FactoryTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import Foundation
import UIKit
import XCTest

@MainActor
class FactoryTest: XCTestCase {

func testClassFactoryByType() {
Expand Down
1 change: 1 addition & 0 deletions Example/Tests/FinderTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ extension DefaultStackIterator.StartingPoint: Equatable {

}

@MainActor
class FinderTest: XCTestCase {

class TestContextCheckingViewController: UIViewController, ContextChecking {
Expand Down
Loading

0 comments on commit d375cb9

Please sign in to comment.