├── .swift-version.podspec ├── WisdomRouterKit ├── WisdomRouterKit │ ├── Assets.xcassets │ │ ├── Contents.json │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── ThreeTestModel.swift │ ├── TestModel.swift │ ├── NineViewController.swift │ ├── TestShareModel.swift │ ├── SecundTestModel.swift │ ├── OneViewController.swift │ ├── SecundViewController.swift │ ├── Info.plist │ ├── FourViewController.swift │ ├── Base.lproj │ │ └── LaunchScreen.storyboard │ ├── SecundThreeViewController.swift │ ├── AppDelegate.swift │ ├── FiveViewController.swift │ ├── SixViewController.swift │ ├── SevenViewController.swift │ ├── ThreeViewController.swift │ ├── EightViewController.swift │ ├── FirstViewController.swift │ └── FirstViewController.xib └── WisdomRouterKit.xcodeproj │ ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist │ ├── xcshareddata │ └── xcschemes │ │ └── WisdomRouterKit.xcscheme │ └── project.pbxproj ├── Source ├── WisdomRouterObjc.h ├── WisdomRouterModel.swift ├── WisdomRouterProtocol.swift ├── WisdomRouterObjc.m ├── WisdomRouterHandler.swift ├── WisdomRouterResult.swift ├── WisdomRouterAlertVC.swift ├── WisdomRouterRegister.swift ├── WisdomRouterConfig.swift ├── WisdomRouterParam.swift ├── WisdomRouterKit.swift └── WisdomRouterManager.swift ├── WisdomRouterKit.podspec ├── .gitignore ├── LICENSE └── README.md /.swift-version.podspec: -------------------------------------------------------------------------------- 1 | 5.0 2 | -------------------------------------------------------------------------------- /WisdomRouterKit/WisdomRouterKit/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /WisdomRouterKit/WisdomRouterKit.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /WisdomRouterKit/WisdomRouterKit.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Source/WisdomRouterObjc.h: -------------------------------------------------------------------------------- 1 | // 2 | // WisdomRouterObjc.h 3 | // WisdomRouterKit 4 | // 5 | // Created by jianfeng on 2023/4/6. 6 | // Copyright © 2023 All over the sky star. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface WisdomRouterObjc : NSObject 14 | 15 | @end 16 | 17 | NS_ASSUME_NONNULL_END 18 | -------------------------------------------------------------------------------- /WisdomRouterKit/WisdomRouterKit/ThreeTestModel.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ThreeTestModel.swift 3 | // WisdomRouterKitDemo 4 | // 5 | // Created by jianfeng on 2019/3/16. 6 | // Copyright © 2019年 All over the sky star. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ThreeTestModel: WisdomRouterModel { 12 | var name: String? 13 | var title: String? 14 | var des: String? 15 | var res: Bool = false 16 | var size: CGSize = .zero 17 | } 18 | -------------------------------------------------------------------------------- /Source/WisdomRouterModel.swift: -------------------------------------------------------------------------------- 1 | // 2 | // WisdomRouterModel.swift 3 | // WisdomRouterKitDemo 4 | // 5 | // Created by jianfeng on 2019/3/14. 6 | // Copyright © 2019年 All over the sky star. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @objcMembers open class WisdomRouterModel: NSObject { 12 | 13 | required override public init() { 14 | 15 | } 16 | } 17 | 18 | 19 | public class WisdomRouterModelList: NSObject { 20 | 21 | } 22 | -------------------------------------------------------------------------------- /WisdomRouterKit/WisdomRouterKit/TestModel.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TestModel.swift 3 | // WisdomRouterKitDemo 4 | // 5 | // Created by jianfeng on 2019/3/15. 6 | // Copyright © 2019年 All over the sky star. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class TestModel: WisdomRouterModel { 12 | var name: String? 13 | var title: String? 14 | var des: String? 15 | var res: Bool = false 16 | var size: CGSize = .zero 17 | var ages: NSInteger=0 18 | } 19 | -------------------------------------------------------------------------------- /WisdomRouterKit/WisdomRouterKit/NineViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // NineViewController.swift 3 | // WisdomRouterKit 4 | // 5 | // Created by jianfeng on 2019/10/8. 6 | // Copyright © 2019 All over the sky star. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class NineViewController: UIViewController { 12 | 13 | override func viewDidLoad() { 14 | super.viewDidLoad() 15 | title = "WisdomRouterKit" 16 | view.backgroundColor = UIColor.white 17 | } 18 | 19 | 20 | 21 | 22 | } 23 | -------------------------------------------------------------------------------- /Source/WisdomRouterProtocol.swift: -------------------------------------------------------------------------------- 1 | // 2 | // WisdomRouterProtocol.swift 3 | // WisdomRouterKit 4 | // 5 | // Created by jianfeng on 2019/10/8. 6 | // Copyright © 2019 All over the sky star. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | 12 | public protocol WisdomRouterRegisterProtocol { 13 | 14 | //MARK: - Register Router Protocol 15 | static func registerRouter() 16 | } 17 | 18 | 19 | @objc public protocol WisdomRouterShareProtocol{ 20 | 21 | //MARK: - Router Shared Protocol 22 | func routerShared() -> WisdomRouterModel; 23 | } 24 | 25 | -------------------------------------------------------------------------------- /Source/WisdomRouterObjc.m: -------------------------------------------------------------------------------- 1 | // 2 | // WisdomRouterObjc.m 3 | // WisdomRouterKit 4 | // 5 | // Created by jianfeng on 2023/4/6. 6 | // Copyright © 2023 All over the sky star. All rights reserved. 7 | // 8 | 9 | #import "WisdomRouterObjc.h" 10 | #import 11 | 12 | @implementation WisdomRouterObjc 13 | 14 | + (void)load { 15 | Class protocolCla = objc_getClass("WisdomRouterKit.WisdomRouterKitToSeeHere"); 16 | SEL sel = NSSelectorFromString(@"routerKitFunction"); 17 | 18 | IMP imp = [protocolCla methodForSelector:sel]; 19 | void (*func)(id, SEL) = (void *)imp; 20 | func(protocolCla, sel); 21 | } 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /Source/WisdomRouterHandler.swift: -------------------------------------------------------------------------------- 1 | // 2 | // WisdomRouterHandler.swift 3 | // WisdomRouterKitDemo 4 | // 5 | // Created by jianfeng on 2019/3/18. 6 | // Copyright © 2019年 All over the sky star. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | public class WisdomRouterHandler: NSObject { 12 | 13 | private(set) var value: Any? 14 | 15 | private(set) var valueTargetKey: String="" 16 | 17 | @objc public class func create(key: String, handler: Any) -> WisdomRouterHandler{ 18 | let obj = WisdomRouterHandler() 19 | obj.valueTargetKey = key 20 | obj.value = handler; 21 | return obj 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /WisdomRouterKit/WisdomRouterKit/TestShareModel.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TestShareModel.swift 3 | // WisdomRouterKit 4 | // 5 | // Created by jianfeng on 2019/10/7. 6 | // Copyright © 2019 All over the sky star. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class TestShareModel: WisdomRouterModel, WisdomRouterShareProtocol { 12 | 13 | func routerShared() -> WisdomRouterModel { 14 | return TestShareModel.share; 15 | } 16 | 17 | static let share : TestShareModel = TestShareModel() 18 | 19 | var name: String = "Wisdom" 20 | var title: String = "Title" 21 | var des: String = "描述" 22 | var res: Bool = false 23 | var size: CGSize = CGSize(width: 22, height: 100) 24 | var ages: NSInteger=30 25 | } 26 | -------------------------------------------------------------------------------- /WisdomRouterKit/WisdomRouterKit/SecundTestModel.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SecundTestModel.swift 3 | // WisdomRouterKitDemo 4 | // 5 | // Created by jianfeng on 2019/3/15. 6 | // Copyright © 2019年 All over the sky star. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class SecundTestModel: WisdomRouterModel { 12 | var name: String? 13 | var title: String? 14 | var des: String? 15 | var hhhhhhhhhh: String? 16 | 17 | var res: Bool=false 18 | var rect: CGRect = .zero 19 | var size: CGSize = .zero 20 | var point: CGPoint = .zero 21 | var float: CGFloat = 1 22 | 23 | var ages: NSInteger=990 24 | var int: Int = 0 25 | var double: Double = 1.0 26 | var integer: NSInteger = 1 27 | var number: NSNumber? 28 | 29 | var url: URL? 30 | } 31 | -------------------------------------------------------------------------------- /WisdomRouterKit/WisdomRouterKit/OneViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SecundViewController.swift 3 | // WisdomRouterKitDemo 4 | // 5 | // Created by jianfeng on 2019/3/14. 6 | // Copyright © 2019年 All over the sky star. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class OneViewController: UIViewController { 12 | 13 | lazy var label: UILabel = { 14 | let lab = UILabel() 15 | lab.text = "WisdomRouterKit\nFunc:\n无参数无闭包\nRouter Test" 16 | lab.frame = CGRect(x: 0, y: 0, width: 150, height: 150) 17 | lab.center = self.view.center 18 | lab.backgroundColor = UIColor(white: 0.5, alpha: 0.7) 19 | lab.numberOfLines = 0 20 | lab.textAlignment = .center 21 | return lab 22 | }() 23 | 24 | 25 | override func viewDidLoad() { 26 | super.viewDidLoad() 27 | title = "WisdomRouterKit" 28 | view.backgroundColor = UIColor.white 29 | view.addSubview(label) 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /WisdomRouterKit/WisdomRouterKit/SecundViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SecundTwoViewController.swift 3 | // WisdomRouterKitDemo 4 | // 5 | // Created by jianfeng on 2019/3/20. 6 | // Copyright © 2019年 All over the sky star. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @objcMembers class SecundViewController: UIViewController { 12 | 13 | var testSize: UInt64=1 14 | 15 | lazy var label: UILabel = { 16 | let lab = UILabel() 17 | lab.text = "WisdomRouterKit\nFunc:\n" 18 | lab.frame = CGRect(x: 0, y: 0, width: 150, height: 150) 19 | lab.center = self.view.center 20 | lab.backgroundColor = UIColor(white: 0.5, alpha: 0.7) 21 | lab.numberOfLines = 0 22 | lab.textAlignment = .center 23 | return lab 24 | }() 25 | 26 | override func viewDidLoad() { 27 | super.viewDidLoad() 28 | title = "WisdomRouterKit" 29 | view.backgroundColor = UIColor.white 30 | view.addSubview(label) 31 | 32 | if testSize > 0 { 33 | label.text = label.text! + "Double: \n" + String(testSize) 34 | }else{ 35 | label.text = label.text! + "Router传参数失败" 36 | label.textColor = UIColor.red 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /WisdomRouterKit.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = 'WisdomRouterKit' 3 | s.version = '0.3.1' 4 | s.license = { :type => "MIT", :file => "LICENSE" } 5 | s.authors = { 'tangjianfeng' => '497609288@qq.com' } 6 | s.homepage = 'https://github.com/tangjianfengVS/WisdomRouterKit' 7 | s.source = { :git => 'https://github.com/tangjianfengVS/WisdomRouterKit.git', :tag => s.version } 8 | s.summary = 'A powerful router SDK' 9 | 10 | s.description = "A powerful router SDK.For handling calls between componentized modules, WisdomRouterKit can help you with property parameters between pages and call-back Block transfer assignments without having to refer to each submodule or define a common protocol file to associate each submodule.No maintenance cost is required, no matter how large the project's future functionality or business scale.API call convenience, flexible use, just a few lines of registration code to complete." 11 | 12 | s.platform = :ios, "9.0" 13 | s.swift_version = ['5.5', '5.6', '5.7'] 14 | 15 | s.ios.deployment_target = '9.0' 16 | # s.osx.deployment_target = '' 17 | # s.watchos.deployment_target = '' 18 | # s.tvos.deployment_target = '' 19 | 20 | s.source_files = 'Source/*.swift', 'Source/*.{h,m}' 21 | #s.dependency "" 22 | 23 | end 24 | -------------------------------------------------------------------------------- /Source/WisdomRouterResult.swift: -------------------------------------------------------------------------------- 1 | // 2 | // WisdomRouterResult.swift 3 | // WisdomRouterKitDemo 4 | // 5 | // Created by jianfeng on 2019/3/22. 6 | // Copyright © 2019年 All over the sky star. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | public class WisdomRouterResult: NSObject { 12 | 13 | let vcClass: UIViewController.Type! 14 | 15 | let infos: WisdomRouterRegisterInfo! 16 | 17 | init(vcClassType: UIViewController.Type, info: WisdomRouterRegisterInfo) { 18 | vcClass = vcClassType 19 | infos = info 20 | super.init() 21 | } 22 | 23 | 24 | /** 追加注册模型 */ 25 | @discardableResult 26 | @objc public func register(modelListName: String, modelListClass: WisdomRouterModel.Type) -> WisdomRouterResult{ 27 | return WisdomRouterManager.shared.register(vcClassType: vcClass, 28 | modelListName: modelListName, 29 | modelListClass: modelListClass) 30 | } 31 | 32 | 33 | /** 追加注册Handler */ 34 | @discardableResult 35 | @objc public func register(handlerName: String, handler: @escaping RouterRegisterHandler) -> WisdomRouterResult { 36 | return WisdomRouterManager.shared.register(vcClassType: vcClass, 37 | handlerName: handlerName, 38 | handler: handler) 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /WisdomRouterKit/WisdomRouterKit/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIRequiredDeviceCapabilities 26 | 27 | armv7 28 | 29 | UISupportedInterfaceOrientations 30 | 31 | UIInterfaceOrientationPortrait 32 | 33 | UISupportedInterfaceOrientations~ipad 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationPortraitUpsideDown 37 | UIInterfaceOrientationLandscapeLeft 38 | UIInterfaceOrientationLandscapeRight 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /WisdomRouterKit/WisdomRouterKit/FourViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // FourViewController.swift 3 | // WisdomRouterKitDemo 4 | // 5 | // Created by jianfeng on 2019/3/18. 6 | // Copyright © 2019年 All over the sky star. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @objcMembers class FourViewController: UIViewController,WisdomRouterRegisterProtocol { 12 | 13 | var closure: ((String) -> Void)? 14 | 15 | static func registerRouter() { 16 | WisdomRouterKit.register(vcClassType: self, handlerName: "closure") { (handler: Any, vc: UIViewController) in 17 | let VC = vc as! FourViewController 18 | VC.closure = (handler as! ((String) -> Void)) 19 | } 20 | } 21 | 22 | lazy var handerBtn: UIButton = { 23 | let btn = UIButton() 24 | btn.setTitle("Click Hander", for: .normal) 25 | btn.backgroundColor = UIColor.gray 26 | btn.addTarget(self, action: #selector(clickHander), for: .touchUpInside) 27 | return btn 28 | }() 29 | 30 | override func viewDidLoad() { 31 | super.viewDidLoad() 32 | title = "WisdomRouterKit" 33 | view.backgroundColor = UIColor.white 34 | view.addSubview(handerBtn) 35 | handerBtn.frame = CGRect(x: 0, y: 0, width: 200, height: 40) 36 | handerBtn.center = view.center 37 | } 38 | 39 | @objc private func clickHander() { 40 | if closure != nil { 41 | closure!("closure \n闭包被调用了!") 42 | } 43 | } 44 | } 45 | 46 | 47 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData/ 8 | 9 | ## Various settings 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata/ 19 | 20 | ## Other 21 | *.moved-aside 22 | *.xccheckout 23 | *.xcscmblueprint 24 | 25 | ## Obj-C/Swift specific 26 | *.hmap 27 | *.ipa 28 | *.dSYM.zip 29 | *.dSYM 30 | 31 | ## Playgrounds 32 | timeline.xctimeline 33 | playground.xcworkspace 34 | 35 | # Swift Package Manager 36 | # 37 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. 38 | # Packages/ 39 | # Package.pins 40 | # Package.resolved 41 | .build/ 42 | 43 | # CocoaPods 44 | # 45 | # We recommend against adding the Pods directory to your .gitignore. However 46 | # you should judge for yourself, the pros and cons are mentioned at: 47 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 48 | # 49 | # Pods/ 50 | 51 | # Carthage 52 | # 53 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 54 | # Carthage/Checkouts 55 | 56 | Carthage/Build 57 | 58 | # fastlane 59 | # 60 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 61 | # screenshots whenever they are needed. 62 | # For more information about the recommended setup visit: 63 | # https://docs.fastlane.tools/best-practices/source-control/#source-control 64 | 65 | fastlane/report.xml 66 | fastlane/Preview.html 67 | fastlane/screenshots/**/*.png 68 | fastlane/test_output 69 | -------------------------------------------------------------------------------- /WisdomRouterKit/WisdomRouterKit/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /WisdomRouterKit/WisdomRouterKit/SecundThreeViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SecundThreeViewController.swift 3 | // WisdomRouterKitDemo 4 | // 5 | // Created by jianfeng on 2019/3/20. 6 | // Copyright © 2019年 All over the sky star. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @objcMembers class SecundThreeViewController: UIViewController { 12 | 13 | var testModel: SecundTestModel={ 14 | let model = SecundTestModel() 15 | model.size = CGSize(width: 999, height: 999) 16 | model.hhhhhhhhhh = "测试时" 17 | return model 18 | }() 19 | 20 | override func viewDidLoad() { 21 | super.viewDidLoad() 22 | title = "WisdomRouterKit" 23 | view.backgroundColor = UIColor.white 24 | let lab = UILabel() 25 | view.addSubview(lab) 26 | lab.frame = CGRect(x: 0, y: 0, width: 200, height: 400) 27 | lab.center = view.center 28 | lab.textAlignment = .center 29 | lab.numberOfLines = 0 30 | lab.backgroundColor = UIColor(white: 0.5, alpha: 0.7) 31 | var text: String = "WisdomRouterKit\nFunc:\ntestModel属性如下:\n" 32 | 33 | let propertyList = WisdomRouterManager.propertyList(targetClass: SecundTestModel.self) 34 | for key in propertyList { 35 | let res = testModel.value(forKey: key.name) 36 | var str = "" 37 | if let resStr = res as? CGSize{ 38 | str = String.init(format:"%.2f,%.2f",resStr.width,resStr.height) 39 | }else if let resStr = res as? Bool{ 40 | str = resStr ? "true":"fales" 41 | }else if let resStr = res as? NSInteger{ 42 | str = String(resStr) 43 | }else if let resStr = res as? String{ 44 | str = resStr 45 | }else if res == nil{ 46 | str = "nil" 47 | } 48 | text = text + "\n" + key.name + ": " + str 49 | } 50 | lab.text = text 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Source/WisdomRouterAlertVC.swift: -------------------------------------------------------------------------------- 1 | // 2 | // WisdomRouterAlertVC.swift 3 | // WisdomRouterKit 4 | // 5 | // Created by jianfeng on 2019/8/31. 6 | // Copyright © 2019 All over the sky star. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class WisdomRouterAlertVC: UIViewController { 12 | 13 | override func viewDidLoad() { 14 | super.viewDidLoad() 15 | } 16 | 17 | /** 系统界面提示 */ 18 | @objc public static func alert(title: String, 19 | message: String, 20 | closeActionText: String?, 21 | rightActionText: String?, 22 | handler: ((UIAlertAction) -> Void)?) -> WisdomRouterAlertVC{ 23 | let alertVC = WisdomRouterAlertVC() 24 | let alert = UIAlertController(title: title, message: message, preferredStyle: .alert) 25 | 26 | if closeActionText != nil { 27 | let cancelAction = UIAlertAction(title: closeActionText, style: .default, handler: { action in 28 | 29 | if handler != nil{ 30 | handler!(action) 31 | } 32 | alert.dismiss(animated: true, completion: nil) 33 | alertVC.navigationController?.popViewController(animated: true) 34 | }) 35 | alert.addAction(cancelAction) 36 | } 37 | 38 | if rightActionText != nil { 39 | let rightAction = UIAlertAction(title: rightActionText, style: UIAlertAction.Style.default, handler: { action in 40 | if handler != nil{ 41 | handler!(action) 42 | } 43 | }) 44 | alert.addAction(rightAction) 45 | } 46 | 47 | DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.5) { 48 | alertVC.present(alert, animated: true, completion: nil) 49 | } 50 | return alertVC 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /WisdomRouterKit/WisdomRouterKit/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "size" : "1024x1024", 91 | "scale" : "1x" 92 | } 93 | ], 94 | "info" : { 95 | "version" : 1, 96 | "author" : "xcode" 97 | } 98 | } -------------------------------------------------------------------------------- /Source/WisdomRouterRegister.swift: -------------------------------------------------------------------------------- 1 | // 2 | // WisdomRouterRegister.swift 3 | // WisdomRouterKitDemo 4 | // 5 | // Created by jianfeng on 2019/3/15. 6 | // Copyright © 2019年 All over the sky star. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | struct WisdomRouterRegisterInfo { 12 | 13 | private(set) var vcClassType: UIViewController.Type! 14 | 15 | private(set) var modelList: [WisdomRouterRegisterModel]=[] 16 | 17 | private(set) var handlerList: [WisdomRouterRegisterHandler]=[] 18 | 19 | init(vcClassType: UIViewController.Type) { 20 | self.vcClassType = vcClassType 21 | } 22 | 23 | mutating func add(model: WisdomRouterRegisterModel) { 24 | self.modelList.append(model) 25 | } 26 | 27 | mutating func add(handler: WisdomRouterRegisterHandler) { 28 | self.handlerList.append(handler) 29 | } 30 | } 31 | 32 | 33 | struct WisdomRouterRegisterModel { 34 | 35 | private(set) var modelClass: WisdomRouterModel.Type? 36 | 37 | private(set) var modelListName: String="" 38 | 39 | init(modelListName: String, modelClass: WisdomRouterModel.Type) { 40 | self.modelListName = modelListName 41 | self.modelClass = modelClass 42 | } 43 | 44 | mutating func updateModelClass(modelClass: WisdomRouterModel.Type) { 45 | self.modelClass = modelClass 46 | } 47 | } 48 | 49 | 50 | struct WisdomRouterRegisterHandler{ 51 | 52 | private(set) var handlerValue: RouterRegisterHandler! 53 | 54 | private(set) var handlerName: String! 55 | 56 | init(handerName:String, handlerValue: @escaping RouterRegisterHandler) { 57 | self.handlerName = handerName 58 | self.handlerValue = handlerValue 59 | } 60 | 61 | mutating func updateHanderValue(handlerValue: @escaping RouterRegisterHandler){ 62 | self.handlerValue = handlerValue 63 | } 64 | } 65 | 66 | 67 | struct WisdomRouterRegisterProperty{ 68 | 69 | private(set) var nameType: String! 70 | 71 | private(set) var name: String! 72 | 73 | private(set) var value: Any? 74 | 75 | init(name:String, nameType:String ) { 76 | self.name = name 77 | self.nameType = nameType 78 | } 79 | 80 | mutating func updateValue(value: Any) { 81 | self.value = value 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /WisdomRouterKit/WisdomRouterKit/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // WisdomRouterKitDemo 4 | // 5 | // Created by jianfeng on 2019/3/14. 6 | // Copyright © 2019年 All over the sky star. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 17 | window = UIWindow(frame: UIScreen.main.bounds) 18 | window?.rootViewController = UINavigationController(rootViewController: FirstViewController()) 19 | window?.makeKeyAndVisible() 20 | return true 21 | } 22 | 23 | func applicationWillResignActive(_ application: UIApplication) { 24 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 25 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 26 | } 27 | 28 | func applicationDidEnterBackground(_ application: UIApplication) { 29 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 30 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 31 | } 32 | 33 | func applicationWillEnterForeground(_ application: UIApplication) { 34 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 35 | } 36 | 37 | func applicationDidBecomeActive(_ application: UIApplication) { 38 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 39 | } 40 | 41 | func applicationWillTerminate(_ application: UIApplication) { 42 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 43 | } 44 | 45 | 46 | } 47 | 48 | -------------------------------------------------------------------------------- /WisdomRouterKit/WisdomRouterKit/FiveViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // FiveViewController.swift 3 | // WisdomRouterKitDemo 4 | // 5 | // Created by jianfeng on 2019/3/20. 6 | // Copyright © 2019年 All over the sky star. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @objcMembers class FiveViewController: UIViewController, WisdomRouterRegisterProtocol { 12 | 13 | static func registerRouter() { 14 | 15 | WisdomRouterKit.register(vcClassType: self, handlerName: "hander") { (hander, vc) in 16 | let VC = vc as! FiveViewController 17 | VC.hander = (hander as! (String,NSInteger)->(Bool)) 18 | } 19 | } 20 | 21 | var testModel: SecundTestModel = SecundTestModel() 22 | 23 | var hander: ((String,NSInteger)->(Bool))? 24 | 25 | lazy var handerBtn: UIButton = { 26 | let btn = UIButton() 27 | btn.setTitle("Click Hander", for: .normal) 28 | btn.backgroundColor = UIColor.gray 29 | btn.addTarget(self, action: #selector(clickHander), for: .touchUpInside) 30 | return btn 31 | }() 32 | 33 | override func viewDidLoad() { 34 | super.viewDidLoad() 35 | title = "WisdomRouterKit" 36 | view.backgroundColor = UIColor.white 37 | view.addSubview(handerBtn) 38 | handerBtn.frame = CGRect(x: 100, y: UIScreen.main.bounds.height - 200, 39 | width: UIScreen.main.bounds.width - 200, height: 40) 40 | 41 | let lab = UILabel() 42 | view.addSubview(lab) 43 | lab.frame = CGRect(x: 0, y: 0, width: 200, height: 300) 44 | lab.center = view.center 45 | lab.textAlignment = .center 46 | lab.numberOfLines = 0 47 | lab.backgroundColor = UIColor(white: 0.5, alpha: 0.7) 48 | var text: String = "WisdomRouterKit\nFunc:\ntestModel属性如下:\n" 49 | 50 | let propertyList = WisdomRouterManager.propertyList(targetClass: SecundTestModel.self) 51 | for key in propertyList { 52 | let res = testModel.value(forKey: key.name) 53 | var str = "" 54 | if let resStr = res as? CGSize{ 55 | str = String.init(format:"%.2f,%.2f",resStr.width,resStr.height) 56 | }else if let resStr = res as? Bool{ 57 | str = resStr ? "true":"fales" 58 | }else if let resStr = res as? NSInteger{ 59 | str = String(resStr) 60 | }else if let resStr = res as? String{ 61 | str = resStr 62 | }else if res == nil{ 63 | str = "nil" 64 | } 65 | text = text + "\n" + key.name + ": " + str 66 | } 67 | lab.text = text 68 | } 69 | 70 | @objc private func clickHander() { 71 | if hander != nil { 72 | let _ = hander!("我是回调\n数据",70) 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /Source/WisdomRouterConfig.swift: -------------------------------------------------------------------------------- 1 | // 2 | // WisdomRouterKitConfig.swift 3 | // WisdomRouterKit 4 | // 5 | // Created by jianfeng on 2019/3/28. 6 | // Copyright © 2019年 All over the sky star. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | 12 | class WisdomRouterKitToSeeHere { 13 | 14 | @objc static func routerKitFunction() { 15 | let start = CFAbsoluteTimeGetCurrent() 16 | let c = Int(objc_getClassList(nil, 0)) 17 | let types = UnsafeMutablePointer.allocate(capacity: c) 18 | let autoreleasingTypes = AutoreleasingUnsafeMutablePointer(types) 19 | objc_getClassList(autoreleasingTypes, Int32(c)) 20 | 21 | var list: [Int:Int] = [0: c/2, c/2+1: c]//23320-0.019 22 | if c>30000 { 23 | list = [0:c/6, c/6+1:c/6*2, c/6*2+1:c/6*3, c/6*3+1:c/6*4, c/6*4+1:c/6*5, c/6*5+1:c]//30616-0.065 24 | }else if c>28000 { 25 | list = [0:c/5, c/5+1:c/5*2, c/5*2+1:c/5*3, c/5*3+1:c/5*4, c/5*4+1:c] 26 | }else if c>26000 { 27 | list = [0:c/4, c/4+1:c/2, c/2+1:c/4*3, c/4*3+1:c] 28 | }else if c>24000 { 29 | list = [0:c/3, c/3+1:c/3*2, c/3*2+1:c] 30 | } 31 | let protocolQueue = DispatchQueue(label: "WisdomProtocolCoreQueue", attributes: DispatchQueue.Attributes.concurrent) 32 | for index in list { register(types: types, begin: index.key, end: index.value) } 33 | 34 | func register(types: UnsafeMutablePointer, begin: Int, end: Int) { 35 | protocolQueue.async { 36 | for index in begin ..< end { 37 | (types[index] as? WisdomRouterRegisterProtocol.Type)?.registerRouter() 38 | } 39 | } 40 | } 41 | 42 | protocolQueue.sync(flags: .barrier) { 43 | types.deinitialize(count: c) 44 | types.deallocate() 45 | print("[WisdomProtocol] Queue Took "+"\(CFAbsoluteTimeGetCurrent()-start) \(c) \(list.count)") 46 | } 47 | } 48 | } 49 | 50 | 51 | let Dot = "." 52 | 53 | let Bracket = "{" 54 | 55 | let Equal = "=" 56 | 57 | let DateBaseKey = "Double,double,NSInteger,Int,Int8,Int16,Int32,Int64,UInt,UInt8,UInt16,UInt32,UInt64,CGFloat,Float" 58 | 59 | let ReplacingList : [String] = ["10","11","12","13","14","15","16","17","18","19","20"] 60 | 61 | let valueTypesMap: Dictionary = [ 62 | "c" : "Int8", 63 | "s" : "Int16", 64 | "i" : "Int32", 65 | "q" : "Int", //also: Int64, NSInteger, only true on 64 bit platforms 66 | "S" : "UInt16", 67 | "I" : "UInt32", 68 | "Q" : "UInt", //also UInt64, only true on 64 bit platforms 69 | "B" : "Bool", 70 | "d" : "Double", 71 | "f" : "Float", 72 | "{" : "Decimal" 73 | ] 74 | 75 | 76 | public typealias RouterHandler = (UIViewController) -> Void 77 | 78 | public typealias RouterResultHandler = (UIViewController, [String]) -> Void 79 | 80 | public typealias RouterErrorHandler = (String) -> Void 81 | 82 | public typealias RouterRegisterHandler = (Any,UIViewController) -> Void 83 | 84 | public typealias RouterSharedHandler = (WisdomRouterModel,[String]) -> Void 85 | -------------------------------------------------------------------------------- /WisdomRouterKit/WisdomRouterKit/SixViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SixViewController.swift 3 | // WisdomRouterKitDemo 4 | // 5 | // Created by jianfeng on 2019/3/22. 6 | // Copyright © 2019年 All over the sky star. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @objcMembers class SixViewController: UIViewController { 12 | 13 | /// 参数一 14 | var name99: String? 15 | 16 | /// 参数二 17 | var testModel: SecundTestModel={ 18 | let model = SecundTestModel() 19 | model.size = CGSize(width: 999, height: 999) 20 | model.hhhhhhhhhh = "测试时" 21 | return model 22 | }() 23 | 24 | /// 参数三 25 | var threeTestModel: ThreeTestModel={ 26 | let model = ThreeTestModel() 27 | model.size = CGSize(width: 999, height: 999) 28 | return model 29 | }() 30 | 31 | override func viewDidLoad() { 32 | super.viewDidLoad() 33 | title = "WisdomRouterKit" 34 | view.backgroundColor = UIColor.white 35 | let lab = UILabel() 36 | view.addSubview(lab) 37 | lab.frame = CGRect(x: 0, y: 0, width: 250, height: view.frame.height - 60) 38 | lab.center.x = view.center.x 39 | lab.textAlignment = .center 40 | lab.numberOfLines = 0 41 | lab.backgroundColor = UIColor(white: 0.5, alpha: 0.7) 42 | 43 | var text = "WisdomRouterKit\nFunc:\n \n" 44 | text = text + "参数一:\n"+(name99 ?? "nil")+"\n \n参数二:\n"+"testModel属性如下: \n" 45 | 46 | var propertyList = WisdomRouterManager.propertyList(targetClass: SecundTestModel.self) 47 | for key in propertyList { 48 | let res = testModel.value(forKey: key.name) 49 | var str = "" 50 | if let resStr = res as? CGSize{ 51 | str = String.init(format:"%.2f,%.2f",resStr.width,resStr.height) 52 | }else if let resStr = res as? Bool{ 53 | str = resStr ? "true":"fales" 54 | }else if let resStr = res as? NSInteger{ 55 | str = String(resStr) 56 | }else if let resStr = res as? String{ 57 | str = resStr 58 | }else if str.count == 0{ 59 | str = "nil" 60 | } 61 | text = text + key.name + ": " + str + "\n" 62 | } 63 | 64 | text = text + "\n参数三:\n"+"threeTestModel属性如下: \n" 65 | propertyList = WisdomRouterManager.propertyList(targetClass: ThreeTestModel.self) 66 | for key in propertyList { 67 | let res = threeTestModel.value(forKey: key.name) 68 | var str = "" 69 | if let resStr = res as? CGSize{ 70 | str = String.init(format:"%.2f,%.2f",resStr.width,resStr.height) 71 | }else if let resStr = res as? Bool{ 72 | str = resStr ? "true":"fales" 73 | }else if let resStr = res as? NSInteger{ 74 | str = String(resStr) 75 | }else if let resStr = res as? String{ 76 | str = resStr 77 | }else if str.count == 0{ 78 | str = "nil" 79 | } 80 | text = text + key.name + ": " + str + "\n" 81 | } 82 | lab.text = text 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /WisdomRouterKit/WisdomRouterKit/SevenViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SevenViewController.swift 3 | // WisdomRouterKitDemo 4 | // 5 | // Created by jianfeng on 2019/3/22. 6 | // Copyright © 2019年 All over the sky star. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @objcMembers class SevenViewController: UIViewController,WisdomRouterRegisterProtocol { 12 | 13 | static func registerRouter() { 14 | WisdomRouterKit.register(vcClassType: self, handlerName: "closureOne") { (closureOne, vc) in 15 | let VC = vc as! SevenViewController 16 | VC.closureOne = (closureOne as! ((String) ->()) 17 | 18 | )}.register(handlerName: "closureTwo") { (closureTwo, vc) in 19 | let VC = vc as! SevenViewController 20 | VC.closureTwo = (closureTwo as! ((String,CGSize) -> ()) 21 | 22 | )}.register(handlerName: "closureThree") { (closureTwo, vc) in 23 | let VC = vc as! SevenViewController 24 | VC.closureThree = (closureTwo as! ((String, NSInteger) -> (Bool)) 25 | )} 26 | } 27 | 28 | var closureOne: ((String) ->())? 29 | 30 | var closureTwo: ((String,CGSize) -> ())? 31 | 32 | var closureThree: ((String, NSInteger) -> (Bool))? 33 | 34 | lazy var handerBtnOne: UIButton = { 35 | let btn = UIButton(frame: CGRect(x: 10, y: UIScreen.main.bounds.height - 270, width: UIScreen.main.bounds.width - 20, height: 35)) 36 | btn.setTitle("Click Hander One", for: .normal) 37 | btn.backgroundColor = UIColor.gray 38 | btn.addTarget(self, action: #selector(clickHanderOne), for: .touchUpInside) 39 | return btn 40 | }() 41 | 42 | lazy var handerBtnTwo: UIButton = { 43 | let btn = UIButton(frame: CGRect(x: 10, y: UIScreen.main.bounds.height - 210, width: UIScreen.main.bounds.width - 20, height: 35)) 44 | btn.setTitle("Click Hander Two", for: .normal) 45 | btn.backgroundColor = UIColor.gray 46 | btn.addTarget(self, action: #selector(clickHanderTwo), for: .touchUpInside) 47 | return btn 48 | }() 49 | 50 | lazy var handerBtnThree: UIButton = { 51 | let btn = UIButton(frame: CGRect(x: 10, y: UIScreen.main.bounds.height - 150, width: UIScreen.main.bounds.width - 20, height: 35)) 52 | btn.setTitle("Click Hander Three", for: .normal) 53 | btn.backgroundColor = UIColor.gray 54 | btn.addTarget(self, action: #selector(clickHanderThree), for: .touchUpInside) 55 | return btn 56 | }() 57 | 58 | override func viewDidLoad() { 59 | super.viewDidLoad() 60 | title = "WisdomRouterKit" 61 | view.backgroundColor = UIColor.white 62 | view.addSubview(handerBtnOne) 63 | view.addSubview(handerBtnTwo) 64 | view.addSubview(handerBtnThree) 65 | } 66 | 67 | @objc func clickHanderOne(){ 68 | if closureOne != nil { 69 | closureOne!("我是闭包closureOne\n我被调用了") 70 | } 71 | } 72 | 73 | @objc func clickHanderTwo(){ 74 | if closureTwo != nil { 75 | closureTwo!("我是闭包closureTwo\n我被调用了",CGSize(width: 77, height: 77)) 76 | } 77 | } 78 | 79 | @objc func clickHanderThree(){ 80 | if closureThree != nil { 81 | let _ = closureThree!("我是闭包closureThree\n我被调用了",999) 82 | } 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /WisdomRouterKit/WisdomRouterKit/ThreeViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ThreeViewController.swift 3 | // WisdomRouterKitDemo 4 | // 5 | // Created by jianfeng on 2019/3/16. 6 | // Copyright © 2019年 All over the sky star. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @objcMembers class ThreeViewController: UIViewController, WisdomRouterRegisterProtocol{ 12 | var testModelList: [ThreeTestModel]? 13 | 14 | static func registerRouter() { 15 | WisdomRouterKit.register(vcClassType: self, 16 | modelListName: "testModelList", 17 | modelListClass: ThreeTestModel.self) 18 | 19 | WisdomRouterKit.register(vcClassType: self, 20 | modelListName: "testModelList", 21 | modelListClass: ThreeTestModel.self) 22 | } 23 | 24 | override func viewDidLoad() { 25 | super.viewDidLoad() 26 | title = "WisdomRouterKit" 27 | view.backgroundColor = UIColor.white 28 | view.addSubview(tabView) 29 | } 30 | 31 | lazy var tabView : UITableView = { 32 | let view = UITableView(frame: self.view.frame, style: .plain) 33 | view.register(TestCell.classForCoder(), forCellReuseIdentifier: "TestCell") 34 | view.rowHeight = 160 35 | view.dataSource = self 36 | return view 37 | }() 38 | } 39 | 40 | 41 | extension ThreeViewController: UITableViewDataSource{ 42 | func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 43 | return testModelList != nil ? testModelList!.count : 0 44 | } 45 | 46 | func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { 47 | let cell = tableView.dequeueReusableCell(withIdentifier: "TestCell", for: indexPath) as! TestCell 48 | cell.model = testModelList![indexPath.row] 49 | return cell 50 | } 51 | } 52 | 53 | class TestCell: UITableViewCell { 54 | let labe = UILabel(frame: CGRect(x: 0, y: 0, width: UIScreen.main.bounds.width, height: 160)) 55 | 56 | var model: ThreeTestModel? { 57 | didSet{ 58 | labe.text = nil 59 | var text: String = "ThreeTestModel属性如下: \n" 60 | let propertyList = WisdomRouterManager.propertyList(targetClass: ThreeTestModel.self) 61 | for key in propertyList { 62 | let res = model!.value(forKey: key.name) 63 | var str = "" 64 | if let resStr = res as? CGSize{ 65 | str = String.init(format:"%.2f,%.2f",resStr.width,resStr.height) 66 | }else if let resStr = res as? Bool{ 67 | str = resStr ? "true":"fales" 68 | }else if let resStr = res as? NSInteger{ 69 | str = String(resStr) 70 | }else if let resStr = res as? String{ 71 | str = resStr 72 | }else if str.count == 0 { 73 | str = "nil" 74 | } 75 | text = text + "\n" + key.name + ": " + str 76 | } 77 | labe.text = text 78 | } 79 | } 80 | 81 | override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { 82 | super.init(style: style, reuseIdentifier: reuseIdentifier) 83 | contentView.addSubview(labe) 84 | labe.textAlignment = .center 85 | labe.numberOfLines = 0 86 | } 87 | 88 | required init?(coder aDecoder: NSCoder) { 89 | fatalError("init(coder:) has not been implemented") 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /WisdomRouterKit/WisdomRouterKit.xcodeproj/xcshareddata/xcschemes/WisdomRouterKit.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /WisdomRouterKit/WisdomRouterKit/EightViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // EightViewController.swift 3 | // WisdomRouterKitDemo 4 | // 5 | // Created by jianfeng on 2019/3/25. 6 | // Copyright © 2019年 All over the sky star. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @objcMembers class EightViewController: UIViewController,WisdomRouterRegisterProtocol { 12 | 13 | static func registerRouter() { 14 | WisdomRouterKit.register(vcClassType: self, handlerName: "closureOne") { (closureOne, vc) in 15 | let VC = vc as! EightViewController 16 | VC.closureOne = (closureOne as! ((String) ->()) 17 | 18 | )}.register(handlerName: "closureTwo") { (closureTwo, vc) in 19 | let VC = vc as! EightViewController 20 | VC.closureTwo = (closureTwo as! ((String,CGSize) -> ()) 21 | 22 | )}.register(handlerName: "closureThree") { (closureTwo, vc) in 23 | let VC = vc as! EightViewController 24 | VC.closureThree = (closureTwo as! ((String, NSInteger) -> (Bool)) 25 | 26 | )} 27 | } 28 | 29 | /// 参数一 30 | var name99: String? 31 | 32 | /// 参数二 33 | var testModel: SecundTestModel={ 34 | let model = SecundTestModel() 35 | model.size = CGSize(width: 999, height: 999) 36 | model.hhhhhhhhhh = "测试时" 37 | return model 38 | }() 39 | 40 | /// 参数三 41 | var threeTestModel: ThreeTestModel={ 42 | let model = ThreeTestModel() 43 | model.size = CGSize(width: 999, height: 999) 44 | return model 45 | }() 46 | 47 | 48 | var closureOne: ((String) ->())? 49 | 50 | var closureTwo: ((String,CGSize) -> ())? 51 | 52 | var closureThree: ((String, NSInteger) -> (Bool))? 53 | 54 | lazy var handerBtnOne: UIButton = { 55 | let btn = UIButton(frame: CGRect(x: 10, y: UIScreen.main.bounds.height - 250, width: UIScreen.main.bounds.width - 20, height: 35)) 56 | btn.setTitle("Click Hander One", for: .normal) 57 | btn.backgroundColor = UIColor.gray 58 | btn.addTarget(self, action: #selector(clickHanderOne), for: .touchUpInside) 59 | return btn 60 | }() 61 | 62 | lazy var handerBtnTwo: UIButton = { 63 | let btn = UIButton(frame: CGRect(x: 10, y: UIScreen.main.bounds.height - 200, width: UIScreen.main.bounds.width - 20, height: 35)) 64 | btn.setTitle("Click Hander Two", for: .normal) 65 | btn.backgroundColor = UIColor.gray 66 | btn.addTarget(self, action: #selector(clickHanderTwo), for: .touchUpInside) 67 | return btn 68 | }() 69 | 70 | lazy var handerBtnThree: UIButton = { 71 | let btn = UIButton(frame: CGRect(x: 10, y: UIScreen.main.bounds.height - 150, width: UIScreen.main.bounds.width - 20, height: 35)) 72 | btn.setTitle("Click Hander Three", for: .normal) 73 | btn.backgroundColor = UIColor.gray 74 | btn.addTarget(self, action: #selector(clickHanderThree), for: .touchUpInside) 75 | return btn 76 | }() 77 | 78 | override func viewDidLoad() { 79 | super.viewDidLoad() 80 | title = "WisdomRouterKit" 81 | view.backgroundColor = UIColor.white 82 | view.addSubview(handerBtnOne) 83 | view.addSubview(handerBtnTwo) 84 | view.addSubview(handerBtnThree) 85 | 86 | let lab = UILabel() 87 | view.addSubview(lab) 88 | lab.frame = CGRect(x: 0, y: 0, width: 270, height: 650) 89 | lab.center.x = view.center.x 90 | lab.textAlignment = .center 91 | lab.numberOfLines = 0 92 | lab.backgroundColor = UIColor(white: 0.5, alpha: 0.7) 93 | 94 | var text = "WisdomRouterKit\nFunc:\n \n" 95 | text = text + "参数一name99:\n"+(name99 ?? "nil")+"\n \n参数二:\n"+"testModel属性如下: \n" 96 | 97 | var propertyList = WisdomRouterManager.propertyList(targetClass: SecundTestModel.self) 98 | for key in propertyList { 99 | let res = testModel.value(forKey: key.name) 100 | var str = "" 101 | if let resStr = res as? CGSize{ 102 | str = String.init(format:"%.2f,%.2f",resStr.width,resStr.height) 103 | }else if let resStr = res as? Bool{ 104 | str = resStr ? "true":"fales" 105 | }else if let resStr = res as? NSInteger{ 106 | str = String(resStr) 107 | }else if let resStr = res as? String{ 108 | str = resStr 109 | }else if str.count == 0{ 110 | str = "nil" 111 | } 112 | text = text + key.name + ": " + str + "\n" 113 | } 114 | 115 | text = text + "\n参数三:\n"+"threeTestModel属性如下: \n" 116 | propertyList = WisdomRouterManager.propertyList(targetClass: ThreeTestModel.self) 117 | for key in propertyList { 118 | let res = threeTestModel.value(forKey: key.name) 119 | var str = "" 120 | if let resStr = res as? CGSize{ 121 | str = String.init(format:"%.2f,%.2f",resStr.width,resStr.height) 122 | }else if let resStr = res as? Bool{ 123 | str = resStr ? "true":"fales" 124 | }else if let resStr = res as? NSInteger{ 125 | str = String(resStr) 126 | }else if let resStr = res as? String{ 127 | str = resStr 128 | }else if str.count == 0{ 129 | str = "nil" 130 | } 131 | text = text + key.name + ": " + str + "\n" 132 | } 133 | lab.text = text 134 | } 135 | 136 | @objc func clickHanderOne(){ 137 | if closureOne != nil { 138 | closureOne!("我是闭包closureOne\n我被调用了") 139 | } 140 | } 141 | 142 | @objc func clickHanderTwo(){ 143 | if closureTwo != nil { 144 | closureTwo!("我是闭包closureTwo\n我被调用了",CGSize(width: 77, height: 77)) 145 | } 146 | } 147 | 148 | @objc func clickHanderThree(){ 149 | if closureThree != nil { 150 | let _ = closureThree!("我是闭包closureThree\n我被调用了",999) 151 | } 152 | } 153 | } 154 | -------------------------------------------------------------------------------- /Source/WisdomRouterParam.swift: -------------------------------------------------------------------------------- 1 | // 2 | // WisdomRouterParam.swift 3 | // WisdomRouterKitDemo 4 | // 5 | // Created by jianfeng on 2019/3/14. 6 | // Copyright © 2019年 All over the sky star. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | public class WisdomRouterParam: NSObject { 12 | 13 | private(set) var valueClass: AnyClass = NSObject.self 14 | 15 | private(set) var value: Any! 16 | 17 | private(set) var valueTargetKey: String="" 18 | 19 | private(set) var keyValue: [[String: WisdomRouterRegisterProperty]] = [] 20 | 21 | private(set) var typeValue: String="" 22 | 23 | //MARK: - Param ModelList 24 | @objc public class func create(key: String, modelList: [WisdomRouterModel]) -> WisdomRouterParam{ 25 | let obj = WisdomRouterParam() 26 | obj.value = modelList 27 | obj.valueTargetKey = key 28 | obj.valueClass = WisdomRouterModelList.self 29 | let propertyList = WisdomRouterManager.propertyList(targetClass: modelList.first!.classForCoder as! WisdomRouterModel.Type) 30 | 31 | for ject in modelList { 32 | var dict: [String: WisdomRouterRegisterProperty] = [:] 33 | 34 | for key in propertyList { 35 | let value = ject.value(forKey: key.name) 36 | if value != nil{ 37 | var property = WisdomRouterRegisterProperty(name: key.name, nameType: key.nameType) 38 | property.updateValue(value: value!) 39 | dict[key.name] = property 40 | } 41 | } 42 | obj.keyValue.append(dict) 43 | } 44 | return obj 45 | } 46 | 47 | 48 | //MARK: - Param Model 49 | @objc public class func create(key: String, model: WisdomRouterModel) -> WisdomRouterParam{ 50 | let obj = WisdomRouterParam() 51 | obj.value = model 52 | obj.valueTargetKey = key 53 | obj.valueClass = WisdomRouterModel.self 54 | let propertyList = WisdomRouterManager.propertyList(targetClass: model.classForCoder as! WisdomRouterModel.Type) 55 | var dict: [String: WisdomRouterRegisterProperty] = [:] 56 | 57 | for key in propertyList { 58 | let value = model.value(forKey: key.name) 59 | if value != nil{ 60 | var property = WisdomRouterRegisterProperty(name: key.name, nameType: key.nameType) 61 | property.updateValue(value: value!) 62 | dict[key.name] = property 63 | } 64 | } 65 | obj.keyValue.append(dict) 66 | return obj 67 | } 68 | 69 | 70 | //MARK: - Param Bool 71 | @objc public class func create(key: String, bool: Bool) -> WisdomRouterParam{ 72 | let obj = WisdomRouterParam.createAny(param: bool, key: key) 73 | obj.typeValue = "Bool,BOOL" 74 | return obj 75 | } 76 | 77 | 78 | //MARK: - Param String 79 | @objc public class func create(key: String, string: String) -> WisdomRouterParam{ 80 | let obj = WisdomRouterParam.createAny(param: string, key: key) 81 | obj.typeValue = "String,NSString" 82 | return obj 83 | } 84 | 85 | 86 | //MARK: - Param Double 87 | @objc public class func create(key: String, double: Double) -> WisdomRouterParam{ 88 | let obj = WisdomRouterParam.createAny(param: double, key: key) 89 | obj.typeValue = DateBaseKey 90 | return obj 91 | } 92 | 93 | 94 | //MARK: - Param NSInteger 95 | @objc public class func create(key: String, integer: NSInteger) -> WisdomRouterParam{ 96 | let obj = WisdomRouterParam.createAny(param: integer, key: key) 97 | obj.typeValue = DateBaseKey 98 | return obj 99 | } 100 | 101 | 102 | //MARK: - Param Int 103 | @objc public class func create(key: String, int: Int) -> WisdomRouterParam{ 104 | let obj = WisdomRouterParam.createAny(param: int, key: key) 105 | obj.typeValue = DateBaseKey 106 | return obj 107 | } 108 | 109 | 110 | //MARK: - Param CGFloat 111 | @objc public class func create(key: String, cgFloat: CGFloat) -> WisdomRouterParam{ 112 | let obj = WisdomRouterParam.createAny(param: cgFloat, key: key) 113 | obj.typeValue = DateBaseKey 114 | return obj 115 | } 116 | 117 | 118 | //MARK: - Param CGPoint 119 | @objc public class func create(key: String, point: CGPoint) -> WisdomRouterParam{ 120 | let obj = WisdomRouterParam.createAny(param: point, key: key) 121 | obj.typeValue = "CGPoint" 122 | return obj 123 | } 124 | 125 | 126 | //MARK: - Param CGSize 127 | @objc public class func create(key: String, size: CGSize) -> WisdomRouterParam{ 128 | let obj = WisdomRouterParam.createAny(param: size, key: key) 129 | obj.typeValue = "CGSize" 130 | return obj 131 | } 132 | 133 | 134 | //MARK: - Param CGRect 135 | @objc public class func create(key: String, rect: CGRect) -> WisdomRouterParam{ 136 | let obj = WisdomRouterParam.createAny(param: rect, key: key) 137 | obj.typeValue = "CGRect" 138 | return obj 139 | } 140 | 141 | 142 | //MARK: - Param Data 143 | @objc public class func create(key: String, data: Data) -> WisdomRouterParam{ 144 | let obj = WisdomRouterParam.createAny(param: data, key: key) 145 | obj.typeValue = "Data,NSData" 146 | return obj 147 | } 148 | 149 | 150 | //MARK: - Param URL 151 | @objc public class func create(key: String, url: URL) -> WisdomRouterParam{ 152 | let obj = WisdomRouterParam.createAny(param: url, key: key) 153 | obj.typeValue = "URL,NSURL" 154 | return obj 155 | } 156 | 157 | 158 | //MARK: - Param NSNumber 159 | @objc public class func create(key: String, number: NSNumber) -> WisdomRouterParam{ 160 | let obj = WisdomRouterParam.createAny(param: number, key: key) 161 | obj.typeValue = "NSNumber" 162 | return obj 163 | } 164 | 165 | 166 | //MARK: - Param UIView 167 | @objc public class func create(key: String, uiView: UIView) -> WisdomRouterParam { 168 | let obj = WisdomRouterParam.createAny(param: uiView.copy(), key: key) 169 | obj.typeValue = NSStringFromClass(uiView.classForCoder) 170 | return obj 171 | } 172 | 173 | 174 | //MARK: - Param UIImage 175 | @objc public class func create(key: String, image: UIImage) -> WisdomRouterParam { 176 | let obj = WisdomRouterParam.createAny(param: image.copy(), key: key) 177 | obj.typeValue = NSStringFromClass(image.classForCoder) 178 | return obj 179 | } 180 | 181 | 182 | private class func createAny(param: Any, key: String) -> WisdomRouterParam { 183 | let obj = WisdomRouterParam() 184 | obj.value = param 185 | obj.valueTargetKey = key 186 | return obj 187 | } 188 | } 189 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /Source/WisdomRouterKit.swift: -------------------------------------------------------------------------------- 1 | // 2 | // WisdomRouterKit.swift 3 | // WisdomRouterKitDemo 4 | // 5 | // Created by jianfeng on 2019/3/14. 6 | // Copyright © 2019年 All over the sky star. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | 12 | public class WisdomRouterKit : NSObject { 13 | 14 | //MARK: - register VC's 属性数组元素类型, 元素类型需要继承 WisdomRouterModel 15 | // - parame targetVC: target VC's class name 16 | // - parame modelListName: target VC's array name 17 | // - parame modelListClass: array's Element class 18 | @discardableResult 19 | @objc public class func register(vcClassType: UIViewController.Type, 20 | modelListName: String, 21 | modelListClass: WisdomRouterModel.Type) -> WisdomRouterResult{ 22 | 23 | return WisdomRouterManager.shared.register(vcClassType: vcClassType, 24 | modelListName: modelListName, 25 | modelListClass: modelListClass) 26 | } 27 | 28 | 29 | //MARK: - register VC's 属性闭包, 在handler中确认转换类型 30 | // - parame targetVC: target VC's class name 31 | // - parame handlerName: target VC's handler name 32 | // - parame handler: target VC's handler 33 | @discardableResult 34 | @objc public class func register(vcClassType: UIViewController.Type, 35 | handlerName: String, 36 | handler: @escaping RouterRegisterHandler) -> WisdomRouterResult{ 37 | 38 | return WisdomRouterManager.shared.register(vcClassType: vcClassType, 39 | handlerName: handlerName, 40 | handler: handler) 41 | } 42 | 43 | 44 | //MARK: - router 无参数,无Handler 45 | // - parame targetVC: target VC's class name 46 | // - parame project: target VC's class of project 47 | // - parame routerHandler: router handler, succeed 48 | // - parame routerErrorHandler: router handler, error 49 | @objc public class func router(targetVC: String, 50 | project: String, 51 | routerHandler: RouterHandler, 52 | routerErrorHandler: RouterErrorHandler) { 53 | 54 | WisdomRouterManager.router(targetVC: targetVC, 55 | project: project, 56 | routerHandler: routerHandler, 57 | routerErrorHandler: routerErrorHandler) 58 | } 59 | 60 | 61 | //MARK: - router 有参数,无Handler 62 | // - parame targetVC: target VC's class name 63 | // - parame project: target VC's class of project 64 | // - parame param: target VC's property of WisdomRouterParam 65 | // - parame routerResultHandler: router result handler, succeed 66 | // - parame routerErrorHandler: router handler, error 67 | @objc public class func router(targetVC: String, 68 | project: String, 69 | param: WisdomRouterParam, 70 | routerResultHandler: RouterResultHandler, 71 | routerErrorHandler: RouterErrorHandler) { 72 | 73 | WisdomRouterManager.router(targetVC: targetVC, 74 | project: project, 75 | param: param, 76 | routerResultHandler: routerResultHandler, 77 | routerErrorHandler: routerErrorHandler) 78 | } 79 | 80 | 81 | //MARK: - router 无参数,有Handler 82 | // - parame targetVC: target VC's class name 83 | // - parame project: target VC's class of project 84 | // - parame handler: target VC's handler of WisdomRouterHandler 85 | // - parame routerResultHandler: router result handler, succeed 86 | // - parame routerErrorHandler: router handler, error 87 | @objc public class func router(targetVC: String, 88 | project: String, 89 | handler: WisdomRouterHandler, 90 | routerResultHandler: RouterResultHandler, 91 | routerErrorHandler: RouterErrorHandler) { 92 | 93 | WisdomRouterManager.router(targetVC: targetVC, 94 | project: project, 95 | handler: handler, 96 | routerResultHandler: routerResultHandler, 97 | routerErrorHandler: routerErrorHandler) 98 | } 99 | 100 | 101 | //MARK: - router 有参数,有Handler 102 | // - parame targetVC: target VC's class name 103 | // - parame project: target VC's class of project 104 | // - parame param: target VC's property of WisdomRouterParam 105 | // - parame handler: target VC's handler of WisdomRouterHandler 106 | // - parame routerResultHandler: router result handler, succeed 107 | // - parame routerErrorHandler: router handler, error 108 | @objc public class func router(targetVC: String, 109 | project: String, 110 | param: WisdomRouterParam, 111 | handler: WisdomRouterHandler, 112 | routerResultHandler: RouterResultHandler, 113 | routerErrorHandler: RouterErrorHandler) { 114 | 115 | WisdomRouterManager.router(targetVC: targetVC, 116 | project: project, 117 | param: param, 118 | handler: handler, 119 | routerResultHandler: routerResultHandler, 120 | routerErrorHandler: routerErrorHandler) 121 | } 122 | 123 | 124 | //MARK: - router 多参数集合,无Handler 125 | // - parame targetVC: target VC's class name 126 | // - parame project: target VC's class of project 127 | // - parame params: target VC's property of WisdomRouterParam array 128 | // - parame routerResultHandler: router result handler, succeed 129 | // - parame routerErrorHandler: router handler, error 130 | @objc public class func router(targetVC: String, 131 | project: String, 132 | params: [WisdomRouterParam], 133 | routerResultHandler: RouterResultHandler, 134 | routerErrorHandler: RouterErrorHandler) { 135 | 136 | WisdomRouterManager.router(targetVC: targetVC, 137 | project: project, 138 | params: params, 139 | routerResultHandler: routerResultHandler, 140 | routerErrorHandler: routerErrorHandler) 141 | } 142 | 143 | 144 | //MARK: - router 无参数,多Handler集合 145 | // - parame targetVC: target VC's class name 146 | // - parame project: target VC's class of project 147 | // - parame handlers: target VC's property of WisdomRouterHandler array 148 | // - parame routerResultHandler: router result handler, succeed 149 | // - parame routerErrorHandler: router handler, error 150 | @objc public class func router(targetVC: String, 151 | project: String, 152 | handlers: [WisdomRouterHandler], 153 | routerResultHandler: RouterResultHandler, 154 | routerErrorHandler: RouterErrorHandler) { 155 | 156 | WisdomRouterManager.router(targetVC: targetVC, 157 | project: project, 158 | handlers: handlers, 159 | routerResultHandler: routerResultHandler, 160 | routerErrorHandler: routerErrorHandler) 161 | } 162 | 163 | 164 | //MARK: - router 多参数集合,多Handler集合 165 | // - parame targetVC: target VC's class name 166 | // - parame project: target VC's class of project 167 | // - parame params: target VC's property of WisdomRouterParam array 168 | // - parame handlers: target VC's property of WisdomRouterHandler array 169 | // - parame routerResultHandler: router result handler, succeed 170 | // - parame routerErrorHandler: router handler, error 171 | @objc public class func router(targetVC: String, 172 | project: String, 173 | params: [WisdomRouterParam], 174 | handlers: [WisdomRouterHandler], 175 | routerResultHandler: RouterResultHandler, 176 | routerErrorHandler: RouterErrorHandler) { 177 | 178 | WisdomRouterManager.router(targetVC: targetVC, 179 | project: project, 180 | params: params, 181 | handlers: handlers, 182 | routerResultHandler: routerResultHandler, 183 | routerErrorHandler: routerErrorHandler) 184 | } 185 | 186 | 187 | //MARK: - getShared 获取全局单列 Model 188 | // - parame sharedClassName: target shared's class name 189 | // - parame project: target shared's class of project 190 | // - parame substituteClassType: substitute of shared's class info 191 | // - parame routerSharedHandler: router shared handler, succeed 192 | // - parame routerErrorHandler: router handler, error 193 | @objc public class func getShared(sharedClassName: String, 194 | project: String, 195 | substituteModelType: WisdomRouterModel.Type, 196 | routerSharedHandler: RouterSharedHandler, 197 | routerErrorHandler: RouterErrorHandler) { 198 | 199 | WisdomRouterManager.routerShared(sharedClassName: sharedClassName, 200 | project: project, 201 | substituteModelType: substituteModelType, 202 | routerSharedHandler: routerSharedHandler, 203 | routerErrorHandler: routerErrorHandler) 204 | } 205 | 206 | 207 | 208 | // Object-c, use 'WisdomRouterKit', need register OC's Class. 209 | // Unlike swift, OC has no namespace. 210 | // Router is used in Object-c, which requires us to specify project registration for the classes used. 211 | // Please use the following registration method. 212 | 213 | //MARK: - register OC's Class of VC 214 | // - parame vcClassType: target VC's class name 215 | // - parame project: target VC's class of project 216 | @objc public class func register_OBJC(vcClassType: UIViewController.Type, project: String){ 217 | WisdomRouterManager.shared.register_OBJC(vcClassType: vcClassType, project: project) 218 | } 219 | 220 | 221 | //MARK: - register OC's Class of Model 222 | // - parame modelClassType: target Model's class name 223 | // - parame project: target VC's class of project 224 | @objc public class func register_OBJC(modelClassType: WisdomRouterModel.Type, project: String){ 225 | WisdomRouterManager.shared.register_OBJC(modelClassType: modelClassType, project: project) 226 | } 227 | 228 | } 229 | 230 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # WisdomRouterKit 2 | 3 | 1. address: https://github.com/tangjianfengVS/WisdomRouterKit 4 | 5 | 2. Swift Version Support: 5.5, 5.6, 5.7 6 | 7 | 3. cocoapods install:pod 'WisdomRouterKit', '0.3.1' 8 | 9 | 10 | # 一. intro/简介: 11 | 12 | 1. A powerful iOS router SDK. 13 | 14 | 2. For componentization calls between modules, WisdomRouterKit can help you to a page attribute parameter and callback Block assignment, and support the big property parameters of quantitative and quantitative correction Block assignment, without any reference between each module, also need not define relationships between public agreement file for each module, really completely decouple, truly indomitable spirit. 15 | 16 | 3. No matter the future function of the project or the rapid expansion and superposition of business code, there is no need for personnel maintenance and no maintenance cost. 17 | 18 | 4. The advantage of API is that it is easy to call, flexible to use, and simple append registration call is realized. It only takes a few lines of registration code to expand the following Router function. 19 | 20 | 5. WisdomRouterKit SDK is a pure swift code compilation, which ensures the efficient performance of SDK, supports exception fetching in the process of attribute assignment, and helps develop rapid location problems. 21 | 22 | 6. For those of you who are working on OC projects, the WisdomRouterKit SDK has been developed to support support for OC project calls, even though pod integration is the way to go. 23 | 24 | 【Chinese】 25 | 1. 一个强大的iOS路由器SDK。 26 | 27 | 2. 针对处理组件化模块之间的调用,WisdomRouterKit 可以帮你进行页面之间的属性参数和回调Block传递赋值,并且支持大量化的属性参数和大量化的回调Block传递赋值,无需各个子模块之间进行任何引用,也无需定义公共协议文件进行各个子模块之间关联,真正做到完全解偶,真正做到顶天立地。 28 | 29 | 3. 无论项目将来功能或者业务代码快速的扩展叠加,无需人员维护,无需维护成本。 30 | 31 | 4. API的优势是调用方便,使用灵活,实现了简洁的追加注册调用,只需要数行注册代码,我们就可以展开接下来的 Router 功能。 32 | 33 | 5. WisdomRouterKit SDK是纯swift代码编写,保证了SDK高效性能,支持属性赋值过程中的异常抓取,帮助开发快速定位问题。 34 | 35 | 6. OC 项目的小伙伴们也不要愁,WisdomRouterKit SDK完成支持OC项目调用,尽管pod集成就是了。 36 | 37 | 38 | # 二. Register protocol introduce/ 注册协议介绍: 39 | 40 | 1. To use WisdomRouterKit SDK, register the route object first. 41 | 42 | 2. Implement WisdomRouterRegisterProtocol agreement, guarantee in advance registration for route objects: 43 | 44 | public protocol WisdomRouterRegisterProtocol { 45 | 46 | //MARK: - Register Router Protocol 47 | static func registerRouter() 48 | } 49 | 50 | note: Please see demo to use 51 | 52 | 4. Implement WisdomRouterShareProtocol agreement, to ensure early registration for single route objects: 53 | 54 | @objc public protocol WisdomRouterShareProtocol{ 55 | 56 | //MARK: - Router Shared Protocol 57 | func routerShared() -> WisdomRouterModel; 58 | } 59 | 60 | note: Please see demo to use 61 | 62 | 【Chinese】 63 | 1. 要使用 WisdomRouterKit SDK,首先需要对 路由对象 进行注册; 64 | 65 | 2. 实现 WisdomRouterRegisterProtocol 协议,保证提前 对 路由对象 进行注册: 66 | 67 | public protocol WisdomRouterRegisterProtocol { 68 | 69 | //MARK: - Register Router Protocol 70 | static func registerRouter() 71 | } 72 | 73 | note: 使用请看 demo 74 | 75 | 4. 实现 WisdomRouterShareProtocol 协议,保证提前 对 单列路由对象 进行注册: 76 | 77 | @objc public protocol WisdomRouterShareProtocol{ 78 | 79 | //MARK: - Router Shared Protocol 80 | func routerShared() -> WisdomRouterModel; 81 | } 82 | 83 | note: 使用请看 demo 84 | 85 | 86 | # 三. Register API introduce/介绍: 87 | 88 | 【1】.Register Model array/注册 模型数组 89 | 90 | //MARK: - register VC's attribute array element type, element types require inheritance WisdomRouterModel 91 | //MARK: - register VC's 属性数组元素类型, 元素类型需要继承 WisdomRouterModel 92 | // - parame targetVC: target VC's class name 93 | // - parame modelListName: target VC's array name 94 | // - parame modelListClass: array's Element class 95 | @discardableResult 96 | @objc public class func register(vcClassType: UIViewController.Type, 97 | modelListName: String, 98 | modelListClass: WisdomRouterModel.Type) -> WisdomRouterResult 99 | 100 | // Inherited model object parent class/继承的模型对象父类 101 | @objcMembers open class WisdomRouterModel: NSObject { 102 | 103 | required override public init() { 104 | } 105 | } 106 | 107 | note: Returned value/返回值 WisdomRouterResult 108 | 109 | 【2】.Register Callback task Block/注册 回调任务 闭包 110 | 111 | //MARK: - register VC's attribute closure, confirm the conversion type in handler 112 | //MARK: - register VC's 属性闭包, 在 handler 中确认转换类型 113 | // - parame targetVC: target VC's class name 114 | // - parame handlerName: target VC's handler name 115 | // - parame handler: target VC's handler 116 | @discardableResult 117 | @objc public class func register(vcClassType: UIViewController.Type, 118 | handlerName: String, 119 | handler: @escaping RouterRegisterHandler) -> WisdomRouterResult 120 | 121 | // Block/闭包 type/类型 122 | public typealias RouterRegisterHandler = (Any,UIViewController) -> Void 123 | 124 | note: Returned value/返回值 WisdomRouterResult 125 | 126 | 127 | # 四. Object-c Register API introduce/介绍:(OC private registration interface/OC专用注册接口) 128 | 129 | 【1】.// Object-c, use 'WisdomRouterKit', need register OC's Class. 130 | 131 | // Unlike swift, OC has no namespace. 132 | // Router is used in Object-c, which requires us to specify project registration for the classes used. 133 | // Please use the following registration method. 134 | 135 | //MARK: - register OC's Class of VC 136 | // - parame vcClassType: target VC's class name 137 | // - parame project: target VC's class of project 138 | @objc public class func register_OBJC(vcClassType: UIViewController.Type, project: String) 139 | 140 | 141 | 【2】.//MARK: - register OC's Class of Model 142 | 143 | // - parame modelClassType: target Model's class name 144 | // - parame project: target VC's class of project 145 | @objc public class func register_OBJC(modelClassType: WisdomRouterModel.Type, project: String) 146 | 147 | 148 | # 五. Router API introduce/介绍: 149 | 150 | 【1】.//MARK: - router no argument/无参数,no/无 Handler 151 | 152 | // - parame targetVC: target VC's class name 153 | // - parame project: target VC's class of project 154 | // - parame routerHandler: router handler, succeed 155 | // - parame routerErrorHandler: router handler, error 156 | @objc public class func router(targetVC: String, 157 | project: String, 158 | routerHandler: RouterHandler, 159 | routerErrorHandler: RouterErrorHandler) 160 | 161 | 162 | 【2】.//MARK: - router has argument/有参数,no/无 Handler 163 | 164 | // - parame targetVC: target VC's class name 165 | // - parame project: target VC's class of project 166 | // - parame param: target VC's property of WisdomRouterParam 167 | // - parame routerResultHandler: router result handler, succeed 168 | // - parame routerErrorHandler: router handler, error 169 | @objc public class func router(targetVC: String, 170 | project: String, 171 | param: WisdomRouterParam, 172 | routerResultHandler: RouterResultHandler, 173 | routerErrorHandler: RouterErrorHandler) 174 | 175 | 176 | 【3】.//MARK: - router no argument/无参数,has/有 Handler 177 | 178 | // - parame targetVC: target VC's class name 179 | // - parame project: target VC's class of project 180 | // - parame handler: target VC's handler of WisdomRouterHandler 181 | // - parame routerResultHandler: router result handler, succeed 182 | // - parame routerErrorHandler: router handler, error 183 | @objc public class func router(targetVC: String, 184 | project: String, 185 | handler: WisdomRouterHandler, 186 | routerResultHandler: RouterResultHandler, 187 | routerErrorHandler: RouterErrorHandler) 188 | 189 | 190 | 【4】.//MARK: - router has argument/有参数,has/有 Handler 191 | 192 | // - parame targetVC: target VC's class name 193 | // - parame project: target VC's class of project 194 | // - parame param: target VC's property of WisdomRouterParam 195 | // - parame handler: target VC's handler of WisdomRouterHandler 196 | // - parame routerResultHandler: router result handler, succeed 197 | // - parame routerErrorHandler: router handler, error 198 | @objc public class func router(targetVC: String, 199 | project: String, 200 | param: WisdomRouterParam, 201 | handler: WisdomRouterHandler, 202 | routerResultHandler: RouterResultHandler, 203 | routerErrorHandler: RouterErrorHandler) 204 | 205 | 206 | 【5】.//MARK: - router parameter list,no/无 Handler 207 | 208 | // - parame targetVC: target VC's class name 209 | // - parame project: target VC's class of project 210 | // - parame params: target VC's property of WisdomRouterParam array 211 | // - parame routerResultHandler: router result handler, succeed 212 | // - parame routerErrorHandler: router handler, error 213 | @objc public class func router(targetVC: String, 214 | project: String, 215 | params: [WisdomRouterParam], 216 | routerResultHandler: RouterResultHandler, 217 | routerErrorHandler: RouterErrorHandler) 218 | 219 | 220 | 【6】.//MARK: - router no argument/无参数,Handler 数组/list 221 | 222 | // - parame targetVC: target VC's class name 223 | // - parame project: target VC's class of project 224 | // - parame handlers: target VC's property of WisdomRouterHandler array 225 | // - parame routerResultHandler: router result handler, succeed 226 | // - parame routerErrorHandler: router handler, error 227 | @objc public class func router(targetVC: String, 228 | project: String, 229 | handlers: [WisdomRouterHandler], 230 | routerResultHandler: RouterResultHandler, 231 | routerErrorHandler: RouterErrorHandler) 232 | 233 | 234 | 【7】.//MARK: - router parameter list,Handler 数组/list 235 | 236 | // - parame targetVC: target VC's class name 237 | // - parame project: target VC's class of project 238 | // - parame params: target VC's property of WisdomRouterParam array 239 | // - parame handlers: target VC's property of WisdomRouterHandler array 240 | // - parame routerResultHandler: router result handler, succeed 241 | // - parame routerErrorHandler: router handler, error 242 | @objc public class func router(targetVC: String, 243 | project: String, 244 | params: [WisdomRouterParam], 245 | handlers: [WisdomRouterHandler], 246 | routerResultHandler: RouterResultHandler, 247 | routerErrorHandler: RouterErrorHandler) 248 | 249 | # 六. Router Shared/单列 API introduce/介绍: 250 | 251 | // MARK: - getShared Gets a global Shared/获取全局单列 Model 252 | // - parame sharedClassName: target shared's class name 253 | // - parame project: target shared's class of project 254 | // - parame substituteClassType: substitute of shared's class info 255 | // - parame routerSharedHandler: router shared handler, succeed 256 | // - parame routerErrorHandler: router handler, error 257 | @objc public class func getShared(sharedClassName: String, 258 | project: String, 259 | substituteModelType: WisdomRouterModel.Type, 260 | routerSharedHandler: RouterSharedHandler, 261 | routerErrorHandler: RouterErrorHandler) 262 | 263 | 264 | # WisdomRouterKit 265 | 266 | 喜欢的朋友,觉得 SDK 写的还不错的朋友,请帮忙推荐给身边的小伙伴们,给颗星,十分感谢! Like friends, feel that the SDK writing is good friends, please help recommend to the small partners around, to the star, thank you very much! 267 | 268 | 如果您热衷于iOS/swift开发,是一位热爱学习进步的童鞋,欢迎来一起研究/讨论 开发中遇到的问题。联系QQ:497609288。 请给予我支持,我会继续我的创作。 If you are keen on iOS/swift development, you are a child who loves learning and progress, welcome to study/discuss the problems encountered in the development together. Contact QQ: 497609288. Please give me your support and I will continue my creation. 269 | -------------------------------------------------------------------------------- /WisdomRouterKit/WisdomRouterKit/FirstViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // FirstViewController.swift 3 | // WisdomRouterKitDemo 4 | // 5 | // Created by jianfeng on 2019/3/20. 6 | // Copyright © 2019年 All over the sky star. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class FirstViewController: UIViewController { 12 | var testModel: TestModel = TestModel() 13 | 14 | var testModelList: [TestModel] = [] 15 | 16 | override func viewDidLoad() { 17 | super.viewDidLoad() 18 | title = "WisdomRouterKit" 19 | navigationController?.navigationBar.isTranslucent = false 20 | } 21 | 22 | 23 | 24 | ///########################################################################### 25 | ///## ## 26 | ///## 基本功能 ## 27 | ///## ## 28 | ///########################################################################### 29 | 30 | /// 无参数,无闭包 31 | @IBAction func clickPushNoDateBtn(_ sender: UIButton) { 32 | WisdomRouterKit.router(targetVC: "OneViewController", 33 | project: "WisdomRouterKit", 34 | routerHandler: { (VC) in 35 | navigationController?.pushViewController(VC, animated: true) 36 | }) { (error) in 37 | 38 | } 39 | } 40 | 41 | 42 | /// 有参数,无闭包 43 | @IBAction func clickPushHasDateBtn(_ sender: UIButton) { 44 | WisdomRouterKit.router(targetVC: "SecundViewController", 45 | project: "WisdomRouterKit", 46 | param: WisdomRouterParam.create(key: "testSize", double: 99.99), 47 | routerResultHandler: { (VC, warning) in 48 | navigationController?.pushViewController(VC, animated: true) 49 | }) { (error) in 50 | 51 | } 52 | } 53 | 54 | 55 | /// 参数 testModel 56 | @IBAction func clickPushHasDateModelBtn(_ sender: UIButton) { 57 | testModel.name = "名字:小米" 58 | testModel.title = "文字:SS" 59 | testModel.des = "描述:MM" 60 | testModel.res = true 61 | testModel.size = CGSize(width: 33, height: 33) 62 | testModel.ages = 30 63 | WisdomRouterKit.router(targetVC: "SecundThreeViewController", 64 | project: "WisdomRouterKit", 65 | param: WisdomRouterParam.create(key: "testModel",model: testModel), 66 | routerResultHandler: { (VC, warning) in 67 | navigationController?.pushViewController(VC, animated: true) 68 | }) { (error) in 69 | 70 | } 71 | } 72 | 73 | 74 | /// 参数 testModelList ------------------------------------------------------ 75 | @IBAction func clickPushHasDateModelListBtn(_ sender: UIButton) { 76 | for i in 0...500 { 77 | let model = TestModel() 78 | model.name = "名字-" + String(i) 79 | model.title = "文字-" + String(i) 80 | model.des = "描述-" + String(i) 81 | model.res = true 82 | model.size = CGSize(width: i, height: i) 83 | testModelList.append(model) 84 | } 85 | WisdomRouterKit.router(targetVC: "ThreeViewController", 86 | project: "WisdomRouterKit", 87 | param: WisdomRouterParam.create(key: "testModelList", modelList: testModelList), 88 | routerResultHandler: { (VC, warning) in 89 | navigationController?.pushViewController(VC, animated: true) 90 | }) { (error) in 91 | 92 | } 93 | } 94 | 95 | 96 | /// 闭包 --------------------------------------------------------- 97 | @IBAction func clickPushWaitHanderBtn(_ sender: UIButton) { 98 | let handler = WisdomRouterHandler.create(key: "closure", handler: {(name: String) in 99 | let label = UILabel(frame: CGRect(x: 0, y: 100, width: 100, height: 100)) 100 | label.layer.cornerRadius = 8 101 | label.layer.masksToBounds = true 102 | label.backgroundColor = UIColor(white: 0.3, alpha: 0.5) 103 | label.textAlignment = .center 104 | label.numberOfLines = 0 105 | label.center = UIApplication.shared.keyWindow!.center 106 | label.text = name 107 | UIApplication.shared.keyWindow?.addSubview(label) 108 | 109 | DispatchQueue.main.asyncAfter(deadline: .now()+2.5, execute:{ 110 | label.removeFromSuperview() 111 | }) 112 | }) 113 | 114 | WisdomRouterKit.router(targetVC: "FourViewController", 115 | project: "WisdomRouterKit", 116 | handler: handler, 117 | routerResultHandler: { (VC, warning) in 118 | navigationController?.pushViewController(VC, animated: true) 119 | }) { (error) in 120 | 121 | } 122 | } 123 | 124 | 125 | 126 | ///########################################################################### 127 | ///## ## 128 | ///## 功能进阶 ## 129 | ///## ## 130 | ///########################################################################### 131 | 132 | /// 一个参数和一个闭包 133 | @IBAction func clickPushModelAndeWaitHanderBtn(_ sender: UIButton) { 134 | testModel.name = "名字--" 135 | testModel.title = "文字--" 136 | testModel.des = "描述--" 137 | testModel.res = true 138 | testModel.size = CGSize(width: 100, height: 100) 139 | testModel.ages = 30 140 | 141 | let param = WisdomRouterParam.create(key: "testModel",model: testModel) 142 | let handler = WisdomRouterHandler.create(key: "hander", handler: {(name: String, count: NSInteger) -> (Bool) in 143 | let label = UILabel(frame: CGRect(x: 0, y: 100, width: 125, height: 130)) 144 | label.layer.cornerRadius = 8 145 | label.layer.masksToBounds = true 146 | label.backgroundColor = UIColor(white: 0.5, alpha: 0.9) 147 | label.textAlignment = .center 148 | label.numberOfLines = 0 149 | label.center = UIApplication.shared.keyWindow!.center 150 | label.text = name+"\n"+"和\n" + String(count) + "\n返回值是:true" 151 | UIApplication.shared.keyWindow?.addSubview(label) 152 | 153 | DispatchQueue.main.asyncAfter(deadline: .now()+2.5, execute:{ 154 | label.removeFromSuperview() 155 | }) 156 | return true 157 | }) 158 | WisdomRouterKit.router(targetVC: "FiveViewController", 159 | project: "WisdomRouterKit", 160 | param: param, 161 | handler: handler, 162 | routerResultHandler: { (VC, warning) in 163 | navigationController?.pushViewController(VC, animated: true) 164 | }) { (error) in 165 | 166 | } 167 | } 168 | 169 | 170 | /// 多参数集合 171 | @IBAction func clickPushMuchModelBtn(_ sender: UIButton) { 172 | let param1 = WisdomRouterParam.create(key: "name99", string: "我是参数一:name99") 173 | 174 | testModel.name = "名字" 175 | testModel.title = "文字" 176 | testModel.des = "描述" 177 | testModel.res = true 178 | testModel.size = CGSize(width: 33, height: 33) 179 | testModel.ages = 30 180 | let param2 = WisdomRouterParam.create(key: "testModel", model: testModel) 181 | 182 | testModel.name = "名字---" 183 | testModel.title = "文字--" 184 | testModel.des = "描述---" 185 | testModel.res = true 186 | testModel.size = CGSize(width: 777, height: 777) 187 | testModel.ages = 777 188 | let param3 = WisdomRouterParam.create(key: "threeTestModel", model: testModel) 189 | 190 | WisdomRouterKit.router(targetVC: "SixViewController", 191 | project: "WisdomRouterKit", 192 | params: [param1,param2,param3], 193 | routerResultHandler: { (VC, warning) in 194 | navigationController?.pushViewController(VC, animated: true) 195 | }) { (error) in 196 | 197 | } 198 | } 199 | 200 | 201 | /// 多闭包集合 202 | @IBAction func clickPushMuchHanderBtn(_ sender: UIButton) { 203 | let hander1 = WisdomRouterHandler.create(key: "closureOne", handler: {(name: String) in 204 | let label = UILabel(frame: CGRect(x: 0, y: 100, width: 125, height: 130)) 205 | label.layer.cornerRadius = 8 206 | label.layer.masksToBounds = true 207 | label.backgroundColor = UIColor(white: 0.5, alpha: 0.9) 208 | label.textAlignment = .center 209 | label.numberOfLines = 0 210 | label.center = UIApplication.shared.keyWindow!.center 211 | label.text = name 212 | UIApplication.shared.keyWindow?.addSubview(label) 213 | 214 | DispatchQueue.main.asyncAfter(deadline: .now()+2.5, execute:{ 215 | label.removeFromSuperview() 216 | }) 217 | }) 218 | 219 | let hander2 = WisdomRouterHandler.create(key: "closureTwo", handler: {(name: String, size: CGSize) in 220 | let label = UILabel(frame: CGRect(x: 0, y: 100, width: 125, height: 130)) 221 | label.layer.cornerRadius = 8 222 | label.layer.masksToBounds = true 223 | label.backgroundColor = UIColor(white: 0.5, alpha: 0.9) 224 | label.textAlignment = .center 225 | label.numberOfLines = 0 226 | label.center = UIApplication.shared.keyWindow!.center 227 | label.text = name+"\n" + String.init(format:"%.2f,%.2f",size.width,size.height) 228 | UIApplication.shared.keyWindow?.addSubview(label) 229 | 230 | DispatchQueue.main.asyncAfter(deadline: .now()+2.5, execute:{ 231 | label.removeFromSuperview() 232 | }) 233 | }) 234 | 235 | let hander3 = WisdomRouterHandler.create(key: "closureThree", handler: {(name: String, count: NSInteger) -> (Bool) in 236 | let label = UILabel(frame: CGRect(x: 0, y: 100, width: 125, height: 130)) 237 | label.layer.cornerRadius = 8 238 | label.layer.masksToBounds = true 239 | label.backgroundColor = UIColor(white: 0.5, alpha: 0.9) 240 | label.textAlignment = .center 241 | label.numberOfLines = 0 242 | label.center = UIApplication.shared.keyWindow!.center 243 | label.text = name+"\n"+"和\n" + String(count) + "\n返回值是:true" 244 | UIApplication.shared.keyWindow?.addSubview(label) 245 | 246 | DispatchQueue.main.asyncAfter(deadline: .now()+2.5, execute:{ 247 | label.removeFromSuperview() 248 | }) 249 | return true 250 | }) 251 | 252 | WisdomRouterKit.router(targetVC: "SevenViewController", 253 | project: "WisdomRouterKit", 254 | handlers: [hander1,hander2,hander3], 255 | routerResultHandler: { (VC, warning) in 256 | navigationController?.pushViewController(VC, animated: true) 257 | }) { (error) in 258 | 259 | } 260 | } 261 | 262 | 263 | /// 多参数和闭包集合 264 | @IBAction func clickPushMuchHanderAndMuchDataBtn(_ sender: UIButton) { 265 | let param1 = WisdomRouterParam.create(key: "name99", string: "我是参数一:name99") 266 | 267 | testModel.name = "名字" 268 | testModel.title = "文字" 269 | testModel.des = "描述" 270 | testModel.res = true 271 | testModel.size = CGSize(width: 33, height: 33) 272 | testModel.ages = 30 273 | let param2 = WisdomRouterParam.create(key: "testModel", model: testModel) 274 | 275 | testModel.name = "名字---" 276 | testModel.title = "文字--" 277 | testModel.des = "描述---" 278 | testModel.res = true 279 | testModel.size = CGSize(width: 777, height: 777) 280 | testModel.ages = 777 281 | let param3 = WisdomRouterParam.create(key: "threeTestModel", model: testModel) 282 | 283 | let hander1 = WisdomRouterHandler.create(key: "closureOne", handler: {(name: String) in 284 | let label = UILabel(frame: CGRect(x: 0, y: 100, width: 125, height: 130)) 285 | label.layer.cornerRadius = 8 286 | label.layer.masksToBounds = true 287 | label.backgroundColor = UIColor(white: 0.5, alpha: 0.9) 288 | label.textAlignment = .center 289 | label.numberOfLines = 0 290 | label.center = UIApplication.shared.keyWindow!.center 291 | label.text = name 292 | UIApplication.shared.keyWindow?.addSubview(label) 293 | 294 | DispatchQueue.main.asyncAfter(deadline: .now()+2.5, execute:{ 295 | label.removeFromSuperview() 296 | }) 297 | }) 298 | 299 | let hander2 = WisdomRouterHandler.create(key: "closureTwo", handler: {(name: String, size: CGSize) in 300 | let label = UILabel(frame: CGRect(x: 0, y: 100, width: 125, height: 130)) 301 | label.layer.cornerRadius = 8 302 | label.layer.masksToBounds = true 303 | label.backgroundColor = UIColor(white: 0.5, alpha: 0.9) 304 | label.textAlignment = .center 305 | label.numberOfLines = 0 306 | label.center = UIApplication.shared.keyWindow!.center 307 | label.text = name+"\n" + String.init(format:"%.2f,%.2f",size.width,size.height) 308 | UIApplication.shared.keyWindow?.addSubview(label) 309 | 310 | DispatchQueue.main.asyncAfter(deadline: .now()+2.5, execute:{ 311 | label.removeFromSuperview() 312 | }) 313 | }) 314 | 315 | let hander3 = WisdomRouterHandler.create(key: "closureThree", handler: {(name: String, count: NSInteger) -> (Bool) in 316 | let label = UILabel(frame: CGRect(x: 0, y: 100, width: 125, height: 130)) 317 | label.layer.cornerRadius = 8 318 | label.layer.masksToBounds = true 319 | label.backgroundColor = UIColor(white: 0.5, alpha: 0.9) 320 | label.textAlignment = .center 321 | label.numberOfLines = 0 322 | label.center = UIApplication.shared.keyWindow!.center 323 | label.text = name+"\n"+"和\n" + String(count) + "\n返回值是:true" 324 | UIApplication.shared.keyWindow?.addSubview(label) 325 | 326 | DispatchQueue.main.asyncAfter(deadline: .now()+2.5, execute:{ 327 | label.removeFromSuperview() 328 | }) 329 | return true 330 | }) 331 | WisdomRouterKit.router(targetVC: "EightViewController", 332 | project: "WisdomRouterKit", 333 | params: [param1,param2,param3], 334 | handlers: [hander1,hander2,hander3], 335 | routerResultHandler: { (VC, warning) in 336 | navigationController?.pushViewController(VC, animated: true) 337 | }) { (error) in 338 | 339 | } 340 | } 341 | 342 | 343 | 344 | ///########################################################################### 345 | ///## ## 346 | ///## 功能进阶 -获取全局单列 Model ## 347 | ///## ## 348 | ///########################################################################### 349 | 350 | /// 获取全局单列 Model 351 | @IBAction func clickSherdDataBtn(_ sender: UIButton) { 352 | 353 | func show(sheraModel: TestModel){ 354 | var text = "单列数据: \nsheraModel属性如下: \n" 355 | let propertyList = WisdomRouterManager.propertyList(targetClass: TestModel.self) 356 | for key in propertyList { 357 | let res = sheraModel.value(forKey: key.name) 358 | var str = "" 359 | if let resStr = res as? CGSize{ 360 | str = String.init(format:"%.2f,%.2f",resStr.width,resStr.height) 361 | }else if let resStr = res as? Bool{ 362 | str = resStr ? "true":"fales" 363 | }else if let resStr = res as? NSInteger{ 364 | str = String(resStr) 365 | }else if let resStr = res as? String{ 366 | str = resStr 367 | }else if str.count == 0{ 368 | str = "nil" 369 | } 370 | text = text + key.name + ": " + str + "\n" 371 | } 372 | 373 | let label = UILabel(frame: CGRect(x: 0, y: 100, width: 250, height: 300)) 374 | label.layer.cornerRadius = 8 375 | label.layer.masksToBounds = true 376 | label.backgroundColor = UIColor(white: 0.5, alpha: 0.9) 377 | label.textAlignment = .center 378 | label.numberOfLines = 0 379 | label.center = UIApplication.shared.keyWindow!.center 380 | label.text = text 381 | UIApplication.shared.keyWindow?.addSubview(label) 382 | 383 | DispatchQueue.main.asyncAfter(deadline: .now()+2.5, execute:{ 384 | label.removeFromSuperview() 385 | }) 386 | } 387 | 388 | WisdomRouterKit.getShared(sharedClassName: "TestShareModel", 389 | project: "WisdomRouterKit", 390 | substituteModelType: TestModel.self, 391 | routerSharedHandler: { (model, warning) in 392 | show(sheraModel: model as! TestModel) 393 | }) { (error) in 394 | 395 | } 396 | } 397 | } 398 | -------------------------------------------------------------------------------- /WisdomRouterKit/WisdomRouterKit/FirstViewController.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 35 | 47 | 59 | 71 | 83 | 97 | 111 | 118 | 125 | 139 | 153 | 160 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | -------------------------------------------------------------------------------- /WisdomRouterKit/WisdomRouterKit.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 3EC4BFA229DE99DA00F41452 /* WisdomRouterKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3EC4BF9629DE99DA00F41452 /* WisdomRouterKit.swift */; }; 11 | 3EC4BFA329DE99DA00F41452 /* WisdomRouterObjc.m in Sources */ = {isa = PBXBuildFile; fileRef = 3EC4BF9729DE99DA00F41452 /* WisdomRouterObjc.m */; }; 12 | 3EC4BFA429DE99DA00F41452 /* WisdomRouterManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3EC4BF9829DE99DA00F41452 /* WisdomRouterManager.swift */; }; 13 | 3EC4BFA529DE99DA00F41452 /* WisdomRouterProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3EC4BF9929DE99DA00F41452 /* WisdomRouterProtocol.swift */; }; 14 | 3EC4BFA629DE99DA00F41452 /* WisdomRouterConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3EC4BF9A29DE99DA00F41452 /* WisdomRouterConfig.swift */; }; 15 | 3EC4BFA729DE99DA00F41452 /* WisdomRouterResult.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3EC4BF9B29DE99DA00F41452 /* WisdomRouterResult.swift */; }; 16 | 3EC4BFA829DE99DA00F41452 /* WisdomRouterRegister.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3EC4BF9C29DE99DA00F41452 /* WisdomRouterRegister.swift */; }; 17 | 3EC4BFA929DE99DA00F41452 /* WisdomRouterHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3EC4BF9D29DE99DA00F41452 /* WisdomRouterHandler.swift */; }; 18 | 3EC4BFAA29DE99DA00F41452 /* WisdomRouterParam.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3EC4BF9E29DE99DA00F41452 /* WisdomRouterParam.swift */; }; 19 | 3EC4BFAB29DE99DA00F41452 /* WisdomRouterAlertVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3EC4BFA029DE99DA00F41452 /* WisdomRouterAlertVC.swift */; }; 20 | 3EC4BFAC29DE99DA00F41452 /* WisdomRouterModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3EC4BFA129DE99DA00F41452 /* WisdomRouterModel.swift */; }; 21 | A54D8334223A4A0B0076BF10 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = A54D8333223A4A0B0076BF10 /* AppDelegate.swift */; }; 22 | A54D833B223A4A0C0076BF10 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A54D833A223A4A0C0076BF10 /* Assets.xcassets */; }; 23 | A54D833E223A4A0C0076BF10 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A54D833C223A4A0C0076BF10 /* LaunchScreen.storyboard */; }; 24 | A54D8360223A571D0076BF10 /* OneViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A54D835F223A571D0076BF10 /* OneViewController.swift */; }; 25 | A54D8365223B72F30076BF10 /* TestModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A54D8364223B72F30076BF10 /* TestModel.swift */; }; 26 | A54D8367223B7DF00076BF10 /* SecundTestModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A54D8366223B7DF00076BF10 /* SecundTestModel.swift */; }; 27 | A56E05372241DB3400124526 /* FirstViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A56E05352241DB3400124526 /* FirstViewController.swift */; }; 28 | A56E05382241DB3400124526 /* FirstViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = A56E05362241DB3400124526 /* FirstViewController.xib */; }; 29 | A56E053C224211B000124526 /* SecundViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A56E053B224211B000124526 /* SecundViewController.swift */; }; 30 | A56E053E224215D900124526 /* SecundThreeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A56E053D224215D900124526 /* SecundThreeViewController.swift */; }; 31 | A56E054022423FC300124526 /* FiveViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A56E053F22423FC300124526 /* FiveViewController.swift */; }; 32 | A571B1C2234CC629004FB175 /* NineViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A571B1C1234CC629004FB175 /* NineViewController.swift */; }; 33 | A5B3B7C42248D5A8007B3207 /* EightViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5B3B7C32248D5A8007B3207 /* EightViewController.swift */; }; 34 | A5DF3ECE234B890100CBB9E8 /* TestShareModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5DF3ECD234B890100CBB9E8 /* TestShareModel.swift */; }; 35 | A5E024DC2244818D00BE2C2B /* SixViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5E024DB2244818D00BE2C2B /* SixViewController.swift */; }; 36 | A5E024E02244BBAF00BE2C2B /* SevenViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5E024DF2244BBAF00BE2C2B /* SevenViewController.swift */; }; 37 | A5F65A37223CB08D00413D49 /* ThreeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5F65A36223CB08D00413D49 /* ThreeViewController.swift */; }; 38 | A5F65A39223CB0E300413D49 /* ThreeTestModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5F65A38223CB0E300413D49 /* ThreeTestModel.swift */; }; 39 | A5F65A3D223F48FD00413D49 /* FourViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5F65A3C223F48FD00413D49 /* FourViewController.swift */; }; 40 | /* End PBXBuildFile section */ 41 | 42 | /* Begin PBXFileReference section */ 43 | 3EC4BF9629DE99DA00F41452 /* WisdomRouterKit.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WisdomRouterKit.swift; sourceTree = ""; }; 44 | 3EC4BF9729DE99DA00F41452 /* WisdomRouterObjc.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WisdomRouterObjc.m; sourceTree = ""; }; 45 | 3EC4BF9829DE99DA00F41452 /* WisdomRouterManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WisdomRouterManager.swift; sourceTree = ""; }; 46 | 3EC4BF9929DE99DA00F41452 /* WisdomRouterProtocol.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WisdomRouterProtocol.swift; sourceTree = ""; }; 47 | 3EC4BF9A29DE99DA00F41452 /* WisdomRouterConfig.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WisdomRouterConfig.swift; sourceTree = ""; }; 48 | 3EC4BF9B29DE99DA00F41452 /* WisdomRouterResult.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WisdomRouterResult.swift; sourceTree = ""; }; 49 | 3EC4BF9C29DE99DA00F41452 /* WisdomRouterRegister.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WisdomRouterRegister.swift; sourceTree = ""; }; 50 | 3EC4BF9D29DE99DA00F41452 /* WisdomRouterHandler.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WisdomRouterHandler.swift; sourceTree = ""; }; 51 | 3EC4BF9E29DE99DA00F41452 /* WisdomRouterParam.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WisdomRouterParam.swift; sourceTree = ""; }; 52 | 3EC4BF9F29DE99DA00F41452 /* WisdomRouterObjc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WisdomRouterObjc.h; sourceTree = ""; }; 53 | 3EC4BFA029DE99DA00F41452 /* WisdomRouterAlertVC.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WisdomRouterAlertVC.swift; sourceTree = ""; }; 54 | 3EC4BFA129DE99DA00F41452 /* WisdomRouterModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WisdomRouterModel.swift; sourceTree = ""; }; 55 | A54D8330223A4A0B0076BF10 /* WisdomRouterKit.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = WisdomRouterKit.app; sourceTree = BUILT_PRODUCTS_DIR; }; 56 | A54D8333223A4A0B0076BF10 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 57 | A54D833A223A4A0C0076BF10 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 58 | A54D833D223A4A0C0076BF10 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 59 | A54D833F223A4A0C0076BF10 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 60 | A54D835F223A571D0076BF10 /* OneViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OneViewController.swift; sourceTree = ""; }; 61 | A54D8364223B72F30076BF10 /* TestModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestModel.swift; sourceTree = ""; }; 62 | A54D8366223B7DF00076BF10 /* SecundTestModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecundTestModel.swift; sourceTree = ""; }; 63 | A56E05352241DB3400124526 /* FirstViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FirstViewController.swift; sourceTree = ""; }; 64 | A56E05362241DB3400124526 /* FirstViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = FirstViewController.xib; sourceTree = ""; }; 65 | A56E053B224211B000124526 /* SecundViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecundViewController.swift; sourceTree = ""; }; 66 | A56E053D224215D900124526 /* SecundThreeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecundThreeViewController.swift; sourceTree = ""; }; 67 | A56E053F22423FC300124526 /* FiveViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FiveViewController.swift; sourceTree = ""; }; 68 | A571B1C1234CC629004FB175 /* NineViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NineViewController.swift; sourceTree = ""; }; 69 | A5B3B7C32248D5A8007B3207 /* EightViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EightViewController.swift; sourceTree = ""; }; 70 | A5DF3ECD234B890100CBB9E8 /* TestShareModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestShareModel.swift; sourceTree = ""; }; 71 | A5E024DB2244818D00BE2C2B /* SixViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SixViewController.swift; sourceTree = ""; }; 72 | A5E024DF2244BBAF00BE2C2B /* SevenViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SevenViewController.swift; sourceTree = ""; }; 73 | A5F65A36223CB08D00413D49 /* ThreeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ThreeViewController.swift; sourceTree = ""; }; 74 | A5F65A38223CB0E300413D49 /* ThreeTestModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ThreeTestModel.swift; sourceTree = ""; }; 75 | A5F65A3C223F48FD00413D49 /* FourViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FourViewController.swift; sourceTree = ""; }; 76 | /* End PBXFileReference section */ 77 | 78 | /* Begin PBXFrameworksBuildPhase section */ 79 | A54D832D223A4A0B0076BF10 /* Frameworks */ = { 80 | isa = PBXFrameworksBuildPhase; 81 | buildActionMask = 2147483647; 82 | files = ( 83 | ); 84 | runOnlyForDeploymentPostprocessing = 0; 85 | }; 86 | /* End PBXFrameworksBuildPhase section */ 87 | 88 | /* Begin PBXGroup section */ 89 | 3EC4BF9529DE99DA00F41452 /* Source */ = { 90 | isa = PBXGroup; 91 | children = ( 92 | 3EC4BF9629DE99DA00F41452 /* WisdomRouterKit.swift */, 93 | 3EC4BF9F29DE99DA00F41452 /* WisdomRouterObjc.h */, 94 | 3EC4BF9729DE99DA00F41452 /* WisdomRouterObjc.m */, 95 | 3EC4BF9829DE99DA00F41452 /* WisdomRouterManager.swift */, 96 | 3EC4BF9929DE99DA00F41452 /* WisdomRouterProtocol.swift */, 97 | 3EC4BF9A29DE99DA00F41452 /* WisdomRouterConfig.swift */, 98 | 3EC4BF9B29DE99DA00F41452 /* WisdomRouterResult.swift */, 99 | 3EC4BF9C29DE99DA00F41452 /* WisdomRouterRegister.swift */, 100 | 3EC4BF9D29DE99DA00F41452 /* WisdomRouterHandler.swift */, 101 | 3EC4BF9E29DE99DA00F41452 /* WisdomRouterParam.swift */, 102 | 3EC4BFA029DE99DA00F41452 /* WisdomRouterAlertVC.swift */, 103 | 3EC4BFA129DE99DA00F41452 /* WisdomRouterModel.swift */, 104 | ); 105 | name = Source; 106 | path = ../Source; 107 | sourceTree = ""; 108 | }; 109 | A54D8327223A4A0B0076BF10 = { 110 | isa = PBXGroup; 111 | children = ( 112 | 3EC4BF9529DE99DA00F41452 /* Source */, 113 | A54D8332223A4A0B0076BF10 /* WisdomRouterKit */, 114 | A54D8331223A4A0B0076BF10 /* Products */, 115 | ); 116 | sourceTree = ""; 117 | }; 118 | A54D8331223A4A0B0076BF10 /* Products */ = { 119 | isa = PBXGroup; 120 | children = ( 121 | A54D8330223A4A0B0076BF10 /* WisdomRouterKit.app */, 122 | ); 123 | name = Products; 124 | sourceTree = ""; 125 | }; 126 | A54D8332223A4A0B0076BF10 /* WisdomRouterKit */ = { 127 | isa = PBXGroup; 128 | children = ( 129 | A54D8333223A4A0B0076BF10 /* AppDelegate.swift */, 130 | A56E05352241DB3400124526 /* FirstViewController.swift */, 131 | A56E05362241DB3400124526 /* FirstViewController.xib */, 132 | A54D835F223A571D0076BF10 /* OneViewController.swift */, 133 | A56E053B224211B000124526 /* SecundViewController.swift */, 134 | A56E053D224215D900124526 /* SecundThreeViewController.swift */, 135 | A5F65A36223CB08D00413D49 /* ThreeViewController.swift */, 136 | A5F65A3C223F48FD00413D49 /* FourViewController.swift */, 137 | A56E053F22423FC300124526 /* FiveViewController.swift */, 138 | A5E024DB2244818D00BE2C2B /* SixViewController.swift */, 139 | A5E024DF2244BBAF00BE2C2B /* SevenViewController.swift */, 140 | A5B3B7C32248D5A8007B3207 /* EightViewController.swift */, 141 | A571B1C1234CC629004FB175 /* NineViewController.swift */, 142 | A54D8364223B72F30076BF10 /* TestModel.swift */, 143 | A54D8366223B7DF00076BF10 /* SecundTestModel.swift */, 144 | A5F65A38223CB0E300413D49 /* ThreeTestModel.swift */, 145 | A5DF3ECD234B890100CBB9E8 /* TestShareModel.swift */, 146 | A54D833A223A4A0C0076BF10 /* Assets.xcassets */, 147 | A54D833C223A4A0C0076BF10 /* LaunchScreen.storyboard */, 148 | A54D833F223A4A0C0076BF10 /* Info.plist */, 149 | ); 150 | path = WisdomRouterKit; 151 | sourceTree = ""; 152 | }; 153 | /* End PBXGroup section */ 154 | 155 | /* Begin PBXNativeTarget section */ 156 | A54D832F223A4A0B0076BF10 /* WisdomRouterKit */ = { 157 | isa = PBXNativeTarget; 158 | buildConfigurationList = A54D8342223A4A0C0076BF10 /* Build configuration list for PBXNativeTarget "WisdomRouterKit" */; 159 | buildPhases = ( 160 | A54D832C223A4A0B0076BF10 /* Sources */, 161 | A54D832D223A4A0B0076BF10 /* Frameworks */, 162 | A54D832E223A4A0B0076BF10 /* Resources */, 163 | ); 164 | buildRules = ( 165 | ); 166 | dependencies = ( 167 | ); 168 | name = WisdomRouterKit; 169 | productName = WisdomRouterKitDemo; 170 | productReference = A54D8330223A4A0B0076BF10 /* WisdomRouterKit.app */; 171 | productType = "com.apple.product-type.application"; 172 | }; 173 | /* End PBXNativeTarget section */ 174 | 175 | /* Begin PBXProject section */ 176 | A54D8328223A4A0B0076BF10 /* Project object */ = { 177 | isa = PBXProject; 178 | attributes = { 179 | LastSwiftUpdateCheck = 1010; 180 | LastUpgradeCheck = 1010; 181 | ORGANIZATIONNAME = "All over the sky star"; 182 | TargetAttributes = { 183 | A54D832F223A4A0B0076BF10 = { 184 | CreatedOnToolsVersion = 10.1; 185 | LastSwiftMigration = 1420; 186 | }; 187 | }; 188 | }; 189 | buildConfigurationList = A54D832B223A4A0B0076BF10 /* Build configuration list for PBXProject "WisdomRouterKit" */; 190 | compatibilityVersion = "Xcode 9.3"; 191 | developmentRegion = en; 192 | hasScannedForEncodings = 0; 193 | knownRegions = ( 194 | en, 195 | Base, 196 | ); 197 | mainGroup = A54D8327223A4A0B0076BF10; 198 | productRefGroup = A54D8331223A4A0B0076BF10 /* Products */; 199 | projectDirPath = ""; 200 | projectRoot = ""; 201 | targets = ( 202 | A54D832F223A4A0B0076BF10 /* WisdomRouterKit */, 203 | ); 204 | }; 205 | /* End PBXProject section */ 206 | 207 | /* Begin PBXResourcesBuildPhase section */ 208 | A54D832E223A4A0B0076BF10 /* Resources */ = { 209 | isa = PBXResourcesBuildPhase; 210 | buildActionMask = 2147483647; 211 | files = ( 212 | A54D833E223A4A0C0076BF10 /* LaunchScreen.storyboard in Resources */, 213 | A54D833B223A4A0C0076BF10 /* Assets.xcassets in Resources */, 214 | A56E05382241DB3400124526 /* FirstViewController.xib in Resources */, 215 | ); 216 | runOnlyForDeploymentPostprocessing = 0; 217 | }; 218 | /* End PBXResourcesBuildPhase section */ 219 | 220 | /* Begin PBXSourcesBuildPhase section */ 221 | A54D832C223A4A0B0076BF10 /* Sources */ = { 222 | isa = PBXSourcesBuildPhase; 223 | buildActionMask = 2147483647; 224 | files = ( 225 | A56E053C224211B000124526 /* SecundViewController.swift in Sources */, 226 | 3EC4BFAC29DE99DA00F41452 /* WisdomRouterModel.swift in Sources */, 227 | A5E024DC2244818D00BE2C2B /* SixViewController.swift in Sources */, 228 | A5F65A3D223F48FD00413D49 /* FourViewController.swift in Sources */, 229 | 3EC4BFAB29DE99DA00F41452 /* WisdomRouterAlertVC.swift in Sources */, 230 | 3EC4BFA529DE99DA00F41452 /* WisdomRouterProtocol.swift in Sources */, 231 | A5F65A37223CB08D00413D49 /* ThreeViewController.swift in Sources */, 232 | A571B1C2234CC629004FB175 /* NineViewController.swift in Sources */, 233 | A56E053E224215D900124526 /* SecundThreeViewController.swift in Sources */, 234 | 3EC4BFA429DE99DA00F41452 /* WisdomRouterManager.swift in Sources */, 235 | 3EC4BFA729DE99DA00F41452 /* WisdomRouterResult.swift in Sources */, 236 | 3EC4BFAA29DE99DA00F41452 /* WisdomRouterParam.swift in Sources */, 237 | A5E024E02244BBAF00BE2C2B /* SevenViewController.swift in Sources */, 238 | 3EC4BFA229DE99DA00F41452 /* WisdomRouterKit.swift in Sources */, 239 | A5B3B7C42248D5A8007B3207 /* EightViewController.swift in Sources */, 240 | A5F65A39223CB0E300413D49 /* ThreeTestModel.swift in Sources */, 241 | A54D8367223B7DF00076BF10 /* SecundTestModel.swift in Sources */, 242 | 3EC4BFA929DE99DA00F41452 /* WisdomRouterHandler.swift in Sources */, 243 | A56E05372241DB3400124526 /* FirstViewController.swift in Sources */, 244 | A54D8365223B72F30076BF10 /* TestModel.swift in Sources */, 245 | A5DF3ECE234B890100CBB9E8 /* TestShareModel.swift in Sources */, 246 | A54D8334223A4A0B0076BF10 /* AppDelegate.swift in Sources */, 247 | 3EC4BFA829DE99DA00F41452 /* WisdomRouterRegister.swift in Sources */, 248 | A56E054022423FC300124526 /* FiveViewController.swift in Sources */, 249 | A54D8360223A571D0076BF10 /* OneViewController.swift in Sources */, 250 | 3EC4BFA329DE99DA00F41452 /* WisdomRouterObjc.m in Sources */, 251 | 3EC4BFA629DE99DA00F41452 /* WisdomRouterConfig.swift in Sources */, 252 | ); 253 | runOnlyForDeploymentPostprocessing = 0; 254 | }; 255 | /* End PBXSourcesBuildPhase section */ 256 | 257 | /* Begin PBXVariantGroup section */ 258 | A54D833C223A4A0C0076BF10 /* LaunchScreen.storyboard */ = { 259 | isa = PBXVariantGroup; 260 | children = ( 261 | A54D833D223A4A0C0076BF10 /* Base */, 262 | ); 263 | name = LaunchScreen.storyboard; 264 | sourceTree = ""; 265 | }; 266 | /* End PBXVariantGroup section */ 267 | 268 | /* Begin XCBuildConfiguration section */ 269 | A54D8340223A4A0C0076BF10 /* Debug */ = { 270 | isa = XCBuildConfiguration; 271 | buildSettings = { 272 | ALWAYS_SEARCH_USER_PATHS = NO; 273 | CLANG_ANALYZER_NONNULL = YES; 274 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 275 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 276 | CLANG_CXX_LIBRARY = "libc++"; 277 | CLANG_ENABLE_MODULES = YES; 278 | CLANG_ENABLE_OBJC_ARC = YES; 279 | CLANG_ENABLE_OBJC_WEAK = YES; 280 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 281 | CLANG_WARN_BOOL_CONVERSION = YES; 282 | CLANG_WARN_COMMA = YES; 283 | CLANG_WARN_CONSTANT_CONVERSION = YES; 284 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 285 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 286 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 287 | CLANG_WARN_EMPTY_BODY = YES; 288 | CLANG_WARN_ENUM_CONVERSION = YES; 289 | CLANG_WARN_INFINITE_RECURSION = YES; 290 | CLANG_WARN_INT_CONVERSION = YES; 291 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 292 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 293 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 294 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 295 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 296 | CLANG_WARN_STRICT_PROTOTYPES = YES; 297 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 298 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 299 | CLANG_WARN_UNREACHABLE_CODE = YES; 300 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 301 | CODE_SIGN_IDENTITY = "iPhone Developer"; 302 | COPY_PHASE_STRIP = NO; 303 | DEBUG_INFORMATION_FORMAT = dwarf; 304 | ENABLE_STRICT_OBJC_MSGSEND = YES; 305 | ENABLE_TESTABILITY = YES; 306 | GCC_C_LANGUAGE_STANDARD = gnu11; 307 | GCC_DYNAMIC_NO_PIC = NO; 308 | GCC_NO_COMMON_BLOCKS = YES; 309 | GCC_OPTIMIZATION_LEVEL = 0; 310 | GCC_PREPROCESSOR_DEFINITIONS = ( 311 | "DEBUG=1", 312 | "$(inherited)", 313 | ); 314 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 315 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 316 | GCC_WARN_UNDECLARED_SELECTOR = YES; 317 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 318 | GCC_WARN_UNUSED_FUNCTION = YES; 319 | GCC_WARN_UNUSED_VARIABLE = YES; 320 | IPHONEOS_DEPLOYMENT_TARGET = 11.0; 321 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 322 | MTL_FAST_MATH = YES; 323 | ONLY_ACTIVE_ARCH = YES; 324 | SDKROOT = iphoneos; 325 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 326 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 327 | }; 328 | name = Debug; 329 | }; 330 | A54D8341223A4A0C0076BF10 /* Release */ = { 331 | isa = XCBuildConfiguration; 332 | buildSettings = { 333 | ALWAYS_SEARCH_USER_PATHS = NO; 334 | CLANG_ANALYZER_NONNULL = YES; 335 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 336 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 337 | CLANG_CXX_LIBRARY = "libc++"; 338 | CLANG_ENABLE_MODULES = YES; 339 | CLANG_ENABLE_OBJC_ARC = YES; 340 | CLANG_ENABLE_OBJC_WEAK = YES; 341 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 342 | CLANG_WARN_BOOL_CONVERSION = YES; 343 | CLANG_WARN_COMMA = YES; 344 | CLANG_WARN_CONSTANT_CONVERSION = YES; 345 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 346 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 347 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 348 | CLANG_WARN_EMPTY_BODY = YES; 349 | CLANG_WARN_ENUM_CONVERSION = YES; 350 | CLANG_WARN_INFINITE_RECURSION = YES; 351 | CLANG_WARN_INT_CONVERSION = YES; 352 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 353 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 354 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 355 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 356 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 357 | CLANG_WARN_STRICT_PROTOTYPES = YES; 358 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 359 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 360 | CLANG_WARN_UNREACHABLE_CODE = YES; 361 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 362 | CODE_SIGN_IDENTITY = "iPhone Developer"; 363 | COPY_PHASE_STRIP = NO; 364 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 365 | ENABLE_NS_ASSERTIONS = NO; 366 | ENABLE_STRICT_OBJC_MSGSEND = YES; 367 | GCC_C_LANGUAGE_STANDARD = gnu11; 368 | GCC_NO_COMMON_BLOCKS = YES; 369 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 370 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 371 | GCC_WARN_UNDECLARED_SELECTOR = YES; 372 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 373 | GCC_WARN_UNUSED_FUNCTION = YES; 374 | GCC_WARN_UNUSED_VARIABLE = YES; 375 | IPHONEOS_DEPLOYMENT_TARGET = 11.0; 376 | MTL_ENABLE_DEBUG_INFO = NO; 377 | MTL_FAST_MATH = YES; 378 | SDKROOT = iphoneos; 379 | SWIFT_COMPILATION_MODE = wholemodule; 380 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 381 | VALIDATE_PRODUCT = YES; 382 | }; 383 | name = Release; 384 | }; 385 | A54D8343223A4A0C0076BF10 /* Debug */ = { 386 | isa = XCBuildConfiguration; 387 | buildSettings = { 388 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 389 | CLANG_ENABLE_MODULES = YES; 390 | CODE_SIGN_STYLE = Automatic; 391 | INFOPLIST_FILE = WisdomRouterKit/Info.plist; 392 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 393 | LD_RUNPATH_SEARCH_PATHS = ( 394 | "$(inherited)", 395 | "@executable_path/Frameworks", 396 | ); 397 | PRODUCT_BUNDLE_IDENTIFIER = "All-over-the-sky-star.WisdomRouterKitDemo"; 398 | PRODUCT_NAME = "$(TARGET_NAME)"; 399 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 400 | SWIFT_VERSION = 5.0; 401 | TARGETED_DEVICE_FAMILY = "1,2"; 402 | }; 403 | name = Debug; 404 | }; 405 | A54D8344223A4A0C0076BF10 /* Release */ = { 406 | isa = XCBuildConfiguration; 407 | buildSettings = { 408 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 409 | CLANG_ENABLE_MODULES = YES; 410 | CODE_SIGN_STYLE = Automatic; 411 | INFOPLIST_FILE = WisdomRouterKit/Info.plist; 412 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 413 | LD_RUNPATH_SEARCH_PATHS = ( 414 | "$(inherited)", 415 | "@executable_path/Frameworks", 416 | ); 417 | PRODUCT_BUNDLE_IDENTIFIER = "All-over-the-sky-star.WisdomRouterKitDemo"; 418 | PRODUCT_NAME = "$(TARGET_NAME)"; 419 | SWIFT_VERSION = 5.0; 420 | TARGETED_DEVICE_FAMILY = "1,2"; 421 | }; 422 | name = Release; 423 | }; 424 | /* End XCBuildConfiguration section */ 425 | 426 | /* Begin XCConfigurationList section */ 427 | A54D832B223A4A0B0076BF10 /* Build configuration list for PBXProject "WisdomRouterKit" */ = { 428 | isa = XCConfigurationList; 429 | buildConfigurations = ( 430 | A54D8340223A4A0C0076BF10 /* Debug */, 431 | A54D8341223A4A0C0076BF10 /* Release */, 432 | ); 433 | defaultConfigurationIsVisible = 0; 434 | defaultConfigurationName = Release; 435 | }; 436 | A54D8342223A4A0C0076BF10 /* Build configuration list for PBXNativeTarget "WisdomRouterKit" */ = { 437 | isa = XCConfigurationList; 438 | buildConfigurations = ( 439 | A54D8343223A4A0C0076BF10 /* Debug */, 440 | A54D8344223A4A0C0076BF10 /* Release */, 441 | ); 442 | defaultConfigurationIsVisible = 0; 443 | defaultConfigurationName = Release; 444 | }; 445 | /* End XCConfigurationList section */ 446 | }; 447 | rootObject = A54D8328223A4A0B0076BF10 /* Project object */; 448 | } 449 | -------------------------------------------------------------------------------- /Source/WisdomRouterManager.swift: -------------------------------------------------------------------------------- 1 | // 2 | // WisdomRouterManager.swift 3 | // WisdomRouterKitDemo 4 | // 5 | // Created by jianfeng on 2019/3/15. 6 | // Copyright © 2019年 All over the sky star. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class WisdomRouterManager { 12 | 13 | static let shared = WisdomRouterManager() 14 | 15 | /// 注册控制器属性 16 | private(set) var registerRouterVCInfo: [String: WisdomRouterRegisterInfo] = [:] 17 | 18 | private let modelPropertyCache = NSCache() 19 | 20 | /// register OBJC class 21 | private(set) var register_OBJC_Info: [String: AnyClass] = [:] 22 | 23 | 24 | /// get class 25 | private class func getClass(stringName: String) -> (UIViewController.Type?,String){ 26 | 27 | guard let childVcClass = NSClassFromString(stringName) else { 28 | 29 | if let Class = WisdomRouterManager.shared.register_OBJC_Info[stringName]{ 30 | if let childVcType = Class as? UIViewController.Type { 31 | return (childVcType, "") 32 | } 33 | return (nil,"没有得到类型 UIViewController : " + stringName) 34 | } 35 | 36 | return (nil,"没有获取到对应的class: " + stringName) 37 | } 38 | 39 | guard let childVcType = childVcClass as? UIViewController.Type else { 40 | return (nil,"没有得到类型 UIViewController : " + stringName) 41 | } 42 | return (childVcType, "") 43 | } 44 | 45 | 46 | /// get shared class 47 | private class func getSharedClass(stringName: String) -> (WisdomRouterModel.Type?, String){ 48 | 49 | guard let childModelClass = NSClassFromString(stringName) else { 50 | 51 | if let Class = WisdomRouterManager.shared.register_OBJC_Info[stringName]{ 52 | if let childModelType = Class as? WisdomRouterModel.Type { 53 | return (childModelType, "") 54 | } 55 | return (nil,"没有得到类型 UIViewController : " + stringName) 56 | } 57 | 58 | return (nil,"没有获取到对应的class: " + stringName) 59 | } 60 | 61 | guard let childModelType = childModelClass as? WisdomRouterModel.Type else { 62 | return (nil,"没有得到类型 Model: " + stringName) 63 | } 64 | return (childModelType, "") 65 | } 66 | 67 | 68 | /// Handler赋值 69 | private class func setVCRouterHandler(targetVC: UIViewController, 70 | handler: WisdomRouterHandler, 71 | className: String, 72 | project: String) -> [String] { 73 | var errorList : [String] = [] 74 | let result = WisdomRouterManager.hasPropertyList(targetClass: targetVC.classForCoder, 75 | targetParamKey: handler.valueTargetKey) 76 | if result.0 { 77 | errorList = WisdomRouterManager.shared.setHandlerProperty(targetVC: targetVC, handler: handler) 78 | }else{ 79 | errorList.append(className + "⚠️未实现 Handler 属性: "+"'"+handler.valueTargetKey+"'") 80 | } 81 | return errorList 82 | } 83 | 84 | 85 | /// Hander属性赋值 86 | private func setHandlerProperty(targetVC: UIViewController, handler: WisdomRouterHandler) -> [String] { 87 | var errorList: [String] = [] 88 | let key = NSStringFromClass(targetVC.classForCoder) 89 | let registerInfo = WisdomRouterManager.shared.registerRouterVCInfo[key] 90 | 91 | if registerInfo != nil { 92 | var has = false 93 | 94 | for registerHandler in registerInfo!.handlerList { 95 | if registerHandler.handlerName == handler.valueTargetKey { 96 | has = true 97 | registerHandler.handlerValue(handler.value!,targetVC) 98 | break 99 | } 100 | } 101 | if !has { 102 | let error = NSStringFromClass(targetVC.classForCoder)+" ⚠️未注册Handler:'"+handler.valueTargetKey+"'" 103 | errorList.append(error) 104 | } 105 | }else{ 106 | let error = NSStringFromClass(targetVC.classForCoder)+" ⚠️未注册Handler:'"+handler.valueTargetKey+"'" 107 | errorList.append(error) 108 | } 109 | return errorList 110 | } 111 | 112 | 113 | /// 参数赋值 114 | private class func setVCRouterParam(targetVC: UIViewController, 115 | param: WisdomRouterParam, 116 | className: String, 117 | project: String) -> [String] { 118 | var errorList : [String] = [] 119 | let result = WisdomRouterManager.hasPropertyList(targetClass: targetVC.classForCoder, 120 | targetParamKey: param.valueTargetKey) 121 | if result.0 { 122 | var error = "" 123 | if param.valueClass == WisdomRouterModel.self { 124 | errorList = setModelProperty(targetVC: targetVC, 125 | param: param, 126 | project: project, 127 | vcModelStr: result.1) 128 | }else if param.valueClass == WisdomRouterModelList.self { 129 | errorList = setModelListProperty(targetVC: targetVC, 130 | param: param, 131 | project: project, 132 | vcModelStr: result.1) 133 | }else{ 134 | error = set_VC_Value(target: targetVC, 135 | param: param, 136 | tagerDateType: result.1, 137 | className: className) 138 | if error.count > 0 { 139 | errorList.append(error) 140 | } 141 | } 142 | }else{ 143 | errorList.append(className + "⚠️未实现属性: "+"'"+param.valueTargetKey+"'") 144 | } 145 | return errorList 146 | } 147 | 148 | 149 | /// model 属性赋值 150 | private class func setModelProperty(targetVC: UIViewController, 151 | param: WisdomRouterParam, 152 | project: String, 153 | vcModelStr: String) -> [String] { 154 | var errorList: [String] = [] 155 | /// 判断是否是 Model 156 | if vcModelStr.contains(project) { 157 | let range = vcModelStr.range(of: project) 158 | let suffix_vcModelStr = vcModelStr.suffix(from: range!.lowerBound) 159 | var vcModelClassStr : String = String(suffix_vcModelStr) 160 | for replacing in ReplacingList { 161 | vcModelClassStr = vcModelClassStr.replacingOccurrences(of: replacing, with: ".") 162 | } 163 | 164 | if let vcModelClass = NSClassFromString(vcModelClassStr) as? WisdomRouterModel.Type { 165 | let model = vcModelClass.init() 166 | 167 | errorList = set_Model_Value(target:model, startProperty:param.keyValue.first!, vcModelClass: vcModelClass) 168 | targetVC.setValue(model, forKey: param.valueTargetKey) 169 | }else{ 170 | errorList.append(vcModelStr+" ⚠️属性Model '"+param.valueTargetKey+"'"+" ⚠️未继承: ‘WisdomRouterModel’") 171 | } 172 | }else{ 173 | errorList.append(vcModelStr+" ⚠️属性Model '"+param.valueTargetKey+"'"+" ⚠️未继承: ‘WisdomRouterModel’") 174 | } 175 | return errorList 176 | } 177 | 178 | 179 | /// model list 属性赋值 180 | private class func setModelListProperty(targetVC: UIViewController, 181 | param: WisdomRouterParam, 182 | project: String, 183 | vcModelStr: String) -> [String] { 184 | var errorList: [String] = [] 185 | let key = NSStringFromClass(targetVC.classForCoder) 186 | let registerInfo = WisdomRouterManager.shared.registerRouterVCInfo[key] 187 | 188 | if registerInfo != nil { 189 | var has = false 190 | 191 | for registerModel in registerInfo!.modelList { 192 | if registerModel.modelListName == param.valueTargetKey { 193 | has = true 194 | let modelClass : WisdomRouterModel.Type = registerModel.modelClass! 195 | var rray : [WisdomRouterModel] = [] 196 | 197 | for property in param.keyValue { 198 | let model = modelClass.init() 199 | let errorArray = set_Model_Value(target:model, startProperty:property, vcModelClass: modelClass) 200 | 201 | rray.append(model) 202 | errorList = errorList + errorArray 203 | } 204 | targetVC.setValue(rray, forKey: param.valueTargetKey) 205 | } 206 | } 207 | if !has { 208 | let error = NSStringFromClass(targetVC.classForCoder)+" ⚠️未注册属性:'"+param.valueTargetKey+"'" 209 | errorList.append(error) 210 | } 211 | }else{ 212 | let error = NSStringFromClass(targetVC.classForCoder)+" ⚠️未注册属性:'"+param.valueTargetKey+"'" 213 | errorList.append(error) 214 | } 215 | return errorList 216 | } 217 | 218 | 219 | /// model 属性赋值 220 | private class func setSharedModelProperty(param: WisdomRouterParam, 221 | substituteModel: WisdomRouterModel, 222 | substituteModelType: WisdomRouterModel.Type) -> [String] { 223 | var errorList: [String] = [] 224 | errorList = set_Model_Value(target:substituteModel, 225 | startProperty:param.keyValue.first!, 226 | vcModelClass: substituteModelType) 227 | return errorList 228 | } 229 | 230 | 231 | /// 判断属性实现 232 | class func hasPropertyList(targetClass: AnyClass, targetParamKey: String) -> (Bool,String) { 233 | var count: UInt32 = 0 234 | let list = class_copyPropertyList(targetClass, &count) 235 | 236 | for i in 0.. String{ 256 | if param.typeValue.contains(tagerDateType) { 257 | target.setValue(param.value, forKey: param.valueTargetKey) 258 | return "" 259 | }else{ 260 | let error = className + " ⚠️属性类型不匹配: "+"'"+param.valueTargetKey+"'"+" -> "+tagerDateType 261 | return error 262 | } 263 | } 264 | 265 | 266 | /// Model属性赋值 267 | private class func set_Model_Value(target: WisdomRouterModel, 268 | startProperty: [String: WisdomRouterRegisterProperty], 269 | vcModelClass: WisdomRouterModel.Type) -> [String]{ 270 | var errorList: [String] = [] 271 | let className = NSStringFromClass(vcModelClass) 272 | var propertyList: [WisdomRouterRegisterProperty] = [] 273 | 274 | let list = WisdomRouterManager.shared.modelPropertyCache.object(forKey: className as AnyObject) as? [WisdomRouterRegisterProperty] 275 | if list != nil{ 276 | propertyList = list! 277 | }else{ 278 | propertyList = WisdomRouterManager.propertyList(targetClass: vcModelClass) 279 | WisdomRouterManager.shared.modelPropertyCache.setObject(propertyList as AnyObject, 280 | forKey: className as AnyObject) 281 | } 282 | 283 | for registerProperty in startProperty { 284 | var succeed = false 285 | let startP = registerProperty.value 286 | 287 | for property in propertyList { 288 | if startP.name == property.name{ 289 | succeed = true 290 | 291 | if startP.nameType == property.nameType { 292 | target.setValue(startP.value, forKey: property.name) 293 | }else{ 294 | let error = className+" ⚠️属性类型不匹配: "+"'"+startP.nameType+"'"+" -> "+property.nameType 295 | errorList.append(error) 296 | } 297 | break 298 | } 299 | } 300 | 301 | if !succeed { 302 | errorList.append(className+" ⚠️未实现属性: "+"'"+startP.name+"'") 303 | } 304 | } 305 | return errorList 306 | } 307 | 308 | 309 | /// 属性列表 310 | class func propertyList(targetClass: WisdomRouterModel.Type) -> [WisdomRouterRegisterProperty] { 311 | var count: UInt32 = 0 312 | var nameLsit: [WisdomRouterRegisterProperty] = [] 313 | let list = class_copyPropertyList(targetClass.classForCoder(), &count) 314 | 315 | for i in 0.. String { 332 | let str = property_getAttributes(property)! 333 | guard let attributesStr = String(utf8String: str) else { 334 | return " " 335 | } 336 | let slices = attributesStr.components(separatedBy: "\"") 337 | 338 | guard slices.count > 1 else { 339 | return WisdomRouterManager.valueType(withAttributes: attributesStr) 340 | } 341 | let objectClassName = slices[1] 342 | return objectClassName 343 | } 344 | 345 | 346 | /// 类型确定 347 | private class func valueType(withAttributes attributes: String) -> String { 348 | if attributes.contains(Bracket) && attributes.contains(Equal){ 349 | let res = attributes.components(separatedBy: Bracket) 350 | let res2 = res[1].components(separatedBy: Equal) 351 | return res2.first! 352 | }else{ 353 | let tmp = attributes as NSString 354 | let letter = tmp.substring(with: NSMakeRange(1, 1)) 355 | guard let type = valueTypesMap[letter] else { 356 | return " " 357 | } 358 | return type 359 | } 360 | } 361 | 362 | } 363 | 364 | 365 | extension WisdomRouterManager { 366 | 367 | //MARK: - register 注册数组模型 368 | func register(vcClassType: UIViewController.Type, 369 | modelListName: String, 370 | modelListClass: WisdomRouterModel.Type) -> WisdomRouterResult { 371 | let key = NSStringFromClass(vcClassType) 372 | if var VCInfo : WisdomRouterRegisterInfo = registerRouterVCInfo[key] { 373 | var hasModelListName = false 374 | for registerModel in VCInfo.modelList { 375 | /// 存在不操作 376 | if registerModel.modelListName == modelListName { 377 | hasModelListName = true 378 | break 379 | } 380 | } 381 | 382 | if !hasModelListName { 383 | let registerModel = WisdomRouterRegisterModel(modelListName: modelListName, 384 | modelClass: modelListClass) 385 | VCInfo.add(model: registerModel) 386 | registerRouterVCInfo[key] = VCInfo 387 | } 388 | return WisdomRouterResult(vcClassType: vcClassType, info: VCInfo) 389 | }else{ 390 | var info = WisdomRouterRegisterInfo(vcClassType: vcClassType) 391 | let registerModel = WisdomRouterRegisterModel(modelListName: modelListName, 392 | modelClass: modelListClass) 393 | info.add(model: registerModel) 394 | registerRouterVCInfo[key] = info 395 | return WisdomRouterResult(vcClassType: vcClassType, info: info) 396 | } 397 | } 398 | 399 | 400 | //MARK: - register 注册Handler 401 | func register(vcClassType: UIViewController.Type, 402 | handlerName: String, 403 | handler: @escaping RouterRegisterHandler) -> WisdomRouterResult{ 404 | let key = NSStringFromClass(vcClassType) 405 | if var VCInfo : WisdomRouterRegisterInfo = registerRouterVCInfo[key] { 406 | var hasHandlerName = false 407 | for registerHandler in VCInfo.handlerList { 408 | /// 存在不操作 409 | if registerHandler.handlerName == handlerName { 410 | hasHandlerName = true 411 | break 412 | } 413 | } 414 | 415 | if !hasHandlerName { 416 | let registerHandler = WisdomRouterRegisterHandler(handerName: handlerName, 417 | handlerValue: handler) 418 | VCInfo.add(handler: registerHandler) 419 | registerRouterVCInfo[key] = VCInfo 420 | } 421 | return WisdomRouterResult(vcClassType: vcClassType, info: VCInfo) 422 | }else{ 423 | var info = WisdomRouterRegisterInfo(vcClassType: vcClassType) 424 | let registerHandler = WisdomRouterRegisterHandler(handerName: handlerName, 425 | handlerValue: handler) 426 | info.add(handler: registerHandler) 427 | registerRouterVCInfo[key] = info 428 | return WisdomRouterResult(vcClassType: vcClassType, info: info) 429 | } 430 | } 431 | 432 | 433 | //MARK: - router 无参数,无Handler 434 | public class func router(targetVC: String, 435 | project: String, 436 | routerHandler: RouterHandler, 437 | routerErrorHandler: RouterErrorHandler) { 438 | let className = (project + Dot + targetVC).replacingOccurrences(of: "-", with: "_") 439 | 440 | let result = WisdomRouterManager.getClass(stringName: className) 441 | 442 | if let vcClass = result.0 { 443 | let VC = vcClass.init() 444 | routerHandler(VC) 445 | } else { 446 | routerErrorHandler(result.1) 447 | } 448 | } 449 | 450 | 451 | //MARK: - router 有参数,无Handler 452 | public class func router(targetVC: String, 453 | project: String, 454 | param: WisdomRouterParam, 455 | routerResultHandler: RouterResultHandler, 456 | routerErrorHandler: RouterErrorHandler) { 457 | let className = (project + Dot + targetVC).replacingOccurrences(of: "-", with: "_") 458 | 459 | let result = WisdomRouterManager.getClass(stringName: className) 460 | 461 | if let vcClass = result.0 { 462 | let VC = vcClass.init() 463 | let warning: [String] = WisdomRouterManager.setVCRouterParam(targetVC: VC, 464 | param: param, 465 | className: className, 466 | project: project) 467 | routerResultHandler(VC,warning) 468 | } else { 469 | routerErrorHandler(result.1) 470 | } 471 | } 472 | 473 | 474 | //MARK: - router 无参数,有Handler 475 | public class func router(targetVC: String, 476 | project: String, 477 | handler: WisdomRouterHandler, 478 | routerResultHandler: RouterResultHandler, 479 | routerErrorHandler: RouterErrorHandler) { 480 | let className = (project + Dot + targetVC).replacingOccurrences(of: "-", with: "_") 481 | 482 | let result = WisdomRouterManager.getClass(stringName: className) 483 | 484 | if let vcClass = result.0 { 485 | let VC = vcClass.init() 486 | let warning: [String] = WisdomRouterManager.setVCRouterHandler(targetVC: VC, 487 | handler: handler, 488 | className: className, 489 | project: project) 490 | routerResultHandler(VC,warning) 491 | } else { 492 | routerErrorHandler(result.1) 493 | } 494 | } 495 | 496 | 497 | //MARK: - router 有参数,有Handler 498 | public class func router(targetVC: String, 499 | project: String, 500 | param: WisdomRouterParam, 501 | handler: WisdomRouterHandler, 502 | routerResultHandler: RouterResultHandler, 503 | routerErrorHandler: RouterErrorHandler) { 504 | let className = (project + Dot + targetVC).replacingOccurrences(of: "-", with: "_") 505 | 506 | let result = WisdomRouterManager.getClass(stringName: className) 507 | 508 | if let vcClass = result.0 { 509 | let VC = vcClass.init() 510 | let warningM: [String] = WisdomRouterManager.setVCRouterParam(targetVC: VC, 511 | param: param, 512 | className: className, 513 | project: project) 514 | let warningH: [String] = WisdomRouterManager.setVCRouterHandler(targetVC: VC, 515 | handler: handler, 516 | className: className, 517 | project: project) 518 | routerResultHandler(VC,warningM+warningH) 519 | } else { 520 | routerErrorHandler(result.1) 521 | } 522 | } 523 | 524 | 525 | //MARK: - router 多参数集合,无Handler 526 | public class func router(targetVC: String, 527 | project: String, 528 | params: [WisdomRouterParam], 529 | routerResultHandler: RouterResultHandler, 530 | routerErrorHandler: RouterErrorHandler) { 531 | let className = (project + Dot + targetVC).replacingOccurrences(of: "-", with: "_") 532 | 533 | let result = WisdomRouterManager.getClass(stringName: className) 534 | 535 | if let vcClass = result.0 { 536 | let VC = vcClass.init() 537 | var warningL: [String] = [] 538 | for param in params { 539 | let warningP = WisdomRouterManager.setVCRouterParam(targetVC: VC, 540 | param: param, 541 | className: className, 542 | project: project) 543 | warningL = warningL + warningP 544 | } 545 | routerResultHandler(VC,warningL) 546 | } else { 547 | routerErrorHandler(result.1) 548 | } 549 | } 550 | 551 | 552 | //MARK: - router 无参数集合,多Handler集合 553 | public class func router(targetVC: String, 554 | project: String, 555 | handlers: [WisdomRouterHandler], 556 | routerResultHandler: RouterResultHandler, 557 | routerErrorHandler: RouterErrorHandler) { 558 | let className = (project + Dot + targetVC).replacingOccurrences(of: "-", with: "_") 559 | 560 | let result = WisdomRouterManager.getClass(stringName: className) 561 | 562 | if let vcClass = result.0 { 563 | let VC = vcClass.init() 564 | var warningL: [String] = [] 565 | for handler in handlers { 566 | let warningP: [String] = WisdomRouterManager.setVCRouterHandler(targetVC: VC, 567 | handler: handler, 568 | className: className, 569 | project: project) 570 | warningL = warningL + warningP 571 | } 572 | routerResultHandler(VC,warningL) 573 | } else { 574 | routerErrorHandler(result.1) 575 | } 576 | } 577 | 578 | 579 | //MARK: - router 多参数集合,多Handler集合 580 | public class func router(targetVC: String, 581 | project: String, 582 | params: [WisdomRouterParam], 583 | handlers: [WisdomRouterHandler], 584 | routerResultHandler: RouterResultHandler, 585 | routerErrorHandler: RouterErrorHandler) { 586 | let className = (project + Dot + targetVC).replacingOccurrences(of: "-", with: "_") 587 | 588 | let result = WisdomRouterManager.getClass(stringName: className) 589 | 590 | if let vcClass = result.0 { 591 | let VC = vcClass.init() 592 | var warningL: [String] = [] 593 | for param in params { 594 | let warningP = WisdomRouterManager.setVCRouterParam(targetVC: VC, 595 | param: param, 596 | className: className, 597 | project: project) 598 | warningL = warningL + warningP 599 | } 600 | 601 | for handler in handlers { 602 | let warningP: [String] = WisdomRouterManager.setVCRouterHandler(targetVC: VC, 603 | handler: handler, 604 | className: className, 605 | project: project) 606 | warningL = warningL + warningP 607 | } 608 | routerResultHandler(VC,warningL) 609 | } else { 610 | routerErrorHandler(result.1) 611 | } 612 | } 613 | 614 | 615 | //MARK: - routerShared 获取全局单列 Model 616 | class func routerShared(sharedClassName: String, 617 | project: String, 618 | substituteModelType: WisdomRouterModel.Type, 619 | routerSharedHandler: RouterSharedHandler, 620 | routerErrorHandler: RouterErrorHandler){ 621 | let className = (project + Dot + sharedClassName).replacingOccurrences(of: "-", with: "_") 622 | 623 | let result = WisdomRouterManager.getSharedClass(stringName: className) 624 | 625 | if let sharedClass = result.0 { 626 | let sharedModel = sharedClass.init() 627 | 628 | if sharedModel.responds(to: #selector(WisdomRouterShareProtocol.routerShared)){ 629 | let model = (sharedModel as! WisdomRouterShareProtocol).routerShared() 630 | let param = WisdomRouterParam.create(key: "",model: model) 631 | let substituteModel = substituteModelType.init() 632 | 633 | let warning: [String] = setSharedModelProperty(param: param, 634 | substituteModel: substituteModel, 635 | substituteModelType: substituteModelType) 636 | routerSharedHandler(substituteModel, warning) 637 | }else{ 638 | routerErrorHandler(result.1) 639 | } 640 | }else{ 641 | routerErrorHandler(result.1) 642 | } 643 | } 644 | 645 | 646 | // - register OC's Class of VC 647 | func register_OBJC(vcClassType: UIViewController.Type, project: String){ 648 | let key = (project + Dot + NSStringFromClass(vcClassType)).replacingOccurrences(of: "-", with: "_") 649 | register_OBJC_Info[key] = vcClassType; 650 | } 651 | 652 | 653 | // - register OC's Class of Model 654 | func register_OBJC(modelClassType: WisdomRouterModel.Type, project: String){ 655 | let key = (project + Dot + NSStringFromClass(modelClassType)).replacingOccurrences(of: "-", with: "_") 656 | register_OBJC_Info[key] = modelClassType; 657 | } 658 | 659 | } 660 | --------------------------------------------------------------------------------