Skip to content

Commit

Permalink
Reverted Swift concurrency for now
Browse files Browse the repository at this point in the history
  • Loading branch information
ekazaev committed Nov 27, 2024
1 parent 9c44b1c commit a560eae
Show file tree
Hide file tree
Showing 124 changed files with 636 additions and 823 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.11.0)
- RouteComposer (2.11.1)
- SwiftFormat/CLI (0.43.5)

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

SPEC CHECKSUMS:
RouteComposer: a3ab59db2276896b7697029aa4c2275e09779a58
RouteComposer: eb0d97150affb8d5e4a220cd7281b9382060e2f8
SwiftFormat: 352ea545e3e13cfd7a449e621c1f3c2e244d4906

PODFILE CHECKSUM: 60fdfd081ebcb6e88fc9f1261e0b0e989ba665c8
Expand Down
8 changes: 4 additions & 4 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.

1,034 changes: 519 additions & 515 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 @@ -1116,7 +1116,7 @@
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 6.0;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand Down Expand Up @@ -1165,7 +1165,7 @@
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 6.0;
SWIFT_VERSION = 5.0;
VALIDATE_PRODUCT = YES;
};
name = Release;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import Foundation
import UIKit

@MainActor
protocol ExampleAnalyticsSupport {

var screenType: ExampleScreenTypes { get }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@ import RouteComposer
import SwiftUI
#endif

@MainActor
let transitionController = BlurredBackgroundTransitionController()

@MainActor
protocol ExampleScreenConfiguration {

var homeScreen: DestinationStep<UITabBarController, Any?> { get }
Expand Down Expand Up @@ -205,7 +203,6 @@ 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 @@ -198,7 +198,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 15.6;
IPHONEOS_DEPLOYMENT_TARGET = 11.4;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand Down Expand Up @@ -256,7 +256,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 15.6;
IPHONEOS_DEPLOYMENT_TARGET = 11.4;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_COMPILATION_MODE = wholemodule;
Expand All @@ -280,6 +280,7 @@
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = ContainerViewController/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand All @@ -305,6 +306,7 @@
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = ContainerViewController/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

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 @@ -202,7 +202,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 15.6;
IPHONEOS_DEPLOYMENT_TARGET = 11.4;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand Down Expand Up @@ -260,7 +260,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 15.6;
IPHONEOS_DEPLOYMENT_TARGET = 11.4;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_COMPILATION_MODE = wholemodule;
Expand All @@ -284,6 +284,7 @@
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = ImageDetailsController/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand All @@ -309,6 +310,7 @@
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = ImageDetailsController/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

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 @@ -202,13 +202,13 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 15.6;
IPHONEOS_DEPLOYMENT_TARGET = 11.4;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 6.0;
SWIFT_VERSION = 5.0;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
Expand Down Expand Up @@ -260,12 +260,12 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 15.6;
IPHONEOS_DEPLOYMENT_TARGET = 11.4;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
SWIFT_VERSION = 6.0;
SWIFT_VERSION = 5.0;
VALIDATE_PRODUCT = YES;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
Expand All @@ -284,6 +284,7 @@
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = ImagesController/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand All @@ -309,6 +310,7 @@
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = ImagesController/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

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,7 +14,6 @@ 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,15 +18,12 @@ 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 @@ -39,7 +36,6 @@ 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,7 +18,6 @@ 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 @@ -27,15 +26,13 @@ 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 @@ -45,12 +42,10 @@ 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 @@ -14,7 +14,6 @@ import Foundation

class CitiesDataModel {

@MainActor
static var cities = [
(cityId: 1, city: "Dublin", description: "Dublin, capital of the Republic of Ireland, is on Ireland’s east " +
"coast at the mouth of the River Liffey. Its historic buildings include Dublin Castle, dating to the" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import UIKit

// This view controller allows us to have the same ContextChecking UIViewController for testing
// as its currently is swift it is impossible to write `some UIViewController: ContextChecking where Context == SOMETHING`
@MainActor
class AnyContextCheckingViewController<Context: Equatable>: UIViewController, ContextChecking {

func isTarget(for context: Context) -> Bool {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ 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 @@ -28,7 +27,6 @@ enum InternalSearchConfiguration {
})
.assemble()

@MainActor
private static let mainScreenFromCircle = StepAssembly(
finder: NilFinder<UITabBarController, MainScreenContext>(),
factory: completeFactory)
Expand All @@ -45,14 +43,12 @@ 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,7 +15,6 @@ 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 @@ -15,7 +15,6 @@ import RouteComposer
import UIKit

// I do not want to create login service for demo so it is just a variable
@MainActor
var isLoggedIn: Bool = false

class LoginInterceptor<C>: RoutingInterceptor {
Expand Down Expand Up @@ -94,8 +93,7 @@ class LoginViewController: UIViewController, ExampleAnalyticsSupport {
let mainQueue = DispatchQueue.main
let deadline = DispatchTime.now() + .seconds(2)
activityIndicator.startAnimating()
Task { @MainActor in
try await Task.sleep(nanoseconds: deadline.uptimeNanoseconds)
mainQueue.asyncAfter(deadline: deadline) {
self.loginButton.isEnabled = true
self.activityIndicator.stopAnimating()
isLoggedIn = true
Expand Down
Loading

0 comments on commit a560eae

Please sign in to comment.