Parcourir la source

Используем кастомный заголовок для секции списка папок

Pavel Yurchenko il y a 1 an
Parent
commit
bdf4462aba

+ 10 - 0
CoordinatorSUI/Sources/CoordinatorSUI/ActionAliases.swift

@@ -0,0 +1,10 @@
+//
+//  ActionAliases.swift
+//  CoordinatorSUI
+//
+//  Created by Pavel Yurchenko on 28.11.2024.
+//
+
+import Foundation
+
+public typealias Action = () -> Void

+ 38 - 0
CoordinatorSUI/Sources/CoordinatorSUI/BaseCoordinator.swift

@@ -0,0 +1,38 @@
+//
+//  BaseCoordinator.swift
+//  CoordinatorSUI
+//
+//  Created by Pavel Yurchenko on 28.11.2024.
+//
+
+import Foundation
+
+open class BaseCoordinator: Coordinator {
+
+    // MARK: - Public properties
+
+    public var finishFlow: Action?
+
+    // MARK: - Private properties
+
+    private var childCoordinators = [Coordinator]()
+
+    // MARK: - Coordinator
+
+    public func addChild(_ coordinator: Coordinator) {
+        childCoordinators.append(coordinator)
+    }
+
+    public func removeChild(_ coordinator: Coordinator?) {
+        for (index, element) in childCoordinators.enumerated() where element === coordinator {
+            childCoordinators.remove(at: index)
+            break
+        }
+    }
+
+    open func start() {}
+
+    deinit {
+        print("\(self.self) deinit")
+    }
+}

+ 13 - 0
CoordinatorSUI/Sources/CoordinatorSUI/Coordinator.swift

@@ -0,0 +1,13 @@
+//
+//  Coordinator.swift
+//  CoordinatorSUI
+//
+//  Created by Pavel Yurchenko on 28.11.2024.
+//
+
+import Foundation
+
+public protocol Coordinator: AnyObject {
+    var finishFlow: Action? { get set }
+    func start()
+}

+ 0 - 2
CoordinatorSUI/Sources/CoordinatorSUI/CoordinatorSUI.swift

@@ -1,2 +0,0 @@
-// The Swift Programming Language
-// https://docs.swift.org/swift-book

+ 21 - 0
SUIExamples.xcodeproj/project.pbxproj

@@ -6,6 +6,10 @@
 	objectVersion = 77;
 	objects = {
 
+/* Begin PBXBuildFile section */
+		060F7D0C2CF85210005B0507 /* CoordinatorSUI in Frameworks */ = {isa = PBXBuildFile; productRef = 060F7D0B2CF85210005B0507 /* CoordinatorSUI */; };
+/* End PBXBuildFile section */
+
 /* Begin PBXFileReference section */
 		06B1064E2CF84E210047B090 /* CoordinatorSUI */ = {isa = PBXFileReference; lastKnownFileType = wrapper; path = CoordinatorSUI; sourceTree = "<group>"; };
 		06C5BF7E2C707D2C006896A8 /* SUIExamples.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SUIExamples.app; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -24,17 +28,26 @@
 			isa = PBXFrameworksBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
+				060F7D0C2CF85210005B0507 /* CoordinatorSUI in Frameworks */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
 /* End PBXFrameworksBuildPhase section */
 
 /* Begin PBXGroup section */
+		060F7D0A2CF8520A005B0507 /* Frameworks */ = {
+			isa = PBXGroup;
+			children = (
+			);
+			name = Frameworks;
+			sourceTree = "<group>";
+		};
 		06C5BF752C707D2C006896A8 = {
 			isa = PBXGroup;
 			children = (
 				06B1064E2CF84E210047B090 /* CoordinatorSUI */,
 				06C5BF802C707D2C006896A8 /* SUIExamples */,
+				060F7D0A2CF8520A005B0507 /* Frameworks */,
 				06C5BF7F2C707D2C006896A8 /* Products */,
 			);
 			sourceTree = "<group>";
@@ -67,6 +80,7 @@
 			);
 			name = SUIExamples;
 			packageProductDependencies = (
+				060F7D0B2CF85210005B0507 /* CoordinatorSUI */,
 			);
 			productName = SUIExamples;
 			productReference = 06C5BF7E2C707D2C006896A8 /* SUIExamples.app */;
@@ -324,6 +338,13 @@
 			defaultConfigurationName = Release;
 		};
 /* End XCConfigurationList section */
+
+/* Begin XCSwiftPackageProductDependency section */
+		060F7D0B2CF85210005B0507 /* CoordinatorSUI */ = {
+			isa = XCSwiftPackageProductDependency;
+			productName = CoordinatorSUI;
+		};
+/* End XCSwiftPackageProductDependency section */
 	};
 	rootObject = 06C5BF762C707D2C006896A8 /* Project object */;
 }

+ 22 - 0
SUIExamples/Application/ApplicationCoordinator.swift

@@ -0,0 +1,22 @@
+//
+//  ApplicationCoordinator.swift
+//  SUIExamples
+//
+//  Created by Pavel Yurchenko on 28.11.2024.
+//
+
+import CoordinatorSUI
+
+final class ApplicationCoordinator: BaseCoordinator {
+
+    override func start() {
+        runMainFlow()
+    }
+
+    // MARK: - Private properties
+
+    private func runMainFlow() {
+        
+    }
+}
+

+ 0 - 0
SUIExamples/SUIExamplesApp.swift → SUIExamples/Application/SUIExamplesApp.swift