├── .gitignore ├── LICENSE ├── MediatorRouter.xcodeproj ├── project.pbxproj └── project.xcworkspace │ └── contents.xcworkspacedata ├── MediatorRouter ├── AppDelegate.h ├── AppDelegate.m ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ ├── Contents.json │ ├── tabbar_mine_normal.imageset │ │ ├── Contents.json │ │ ├── tabbar_mine_normal@2x.png │ │ └── tabbar_mine_normal@3x.png │ ├── tabbar_mine_select.imageset │ │ ├── Contents.json │ │ ├── tabbar_mine_select@2x.png │ │ └── tabbar_mine_select@3x.png │ ├── tabbar_platform_normal.imageset │ │ ├── Contents.json │ │ ├── tabbar_platform_normal@2x.png │ │ └── tabbar_platform_normal@3x.png │ └── tabbar_platform_select.imageset │ │ ├── Contents.json │ │ ├── tabbar_platform_select@2x.png │ │ └── tabbar_platform_select@3x.png ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── Info.plist ├── Mediator │ ├── CTMediator │ │ ├── CTMediator.h │ │ └── CTMediator.m │ ├── MediatorHome │ │ ├── MediatorMainViewController.h │ │ └── MediatorMainViewController.m │ └── Models │ │ ├── Category │ │ ├── CTMediator+CategoryExtension.h │ │ ├── CTMediator+CategoryExtension.m │ │ ├── MediatorCategoryViewController.h │ │ ├── MediatorCategoryViewController.m │ │ ├── Next │ │ │ ├── CTMediator+NextExtension.h │ │ │ ├── CTMediator+NextExtension.m │ │ │ ├── MediatorNextViewController.h │ │ │ ├── MediatorNextViewController.m │ │ │ ├── Target_MediatorNextViewController.h │ │ │ └── Target_MediatorNextViewController.m │ │ ├── Target_MediatorCategoryViewController.h │ │ └── Target_MediatorCategoryViewController.m │ │ └── Home │ │ ├── CTMediator+HomeExtension.h │ │ ├── CTMediator+HomeExtension.m │ │ ├── Detail │ │ ├── CTMediator+DetailExtension.h │ │ ├── CTMediator+DetailExtension.m │ │ ├── MediatorDetailViewController.h │ │ ├── MediatorDetailViewController.m │ │ ├── Target_MediatorDetailViewController.h │ │ └── Target_MediatorDetailViewController.m │ │ ├── MediatorHomeViewController.h │ │ ├── MediatorHomeViewController.m │ │ ├── Target_MediatorHomeViewController.h │ │ └── Target_MediatorHomeViewController.m ├── Others │ ├── ModuleA │ │ ├── AViewController.h │ │ ├── AViewController.m │ │ ├── Target_ModuleA.h │ │ └── Target_ModuleA.m │ ├── ModuleACategory │ │ ├── CTMediator+ModuleA.h │ │ └── CTMediator+ModuleA.m │ ├── ModuleB │ │ ├── BViewController.h │ │ ├── BViewController.m │ │ ├── Target_ModuleB.h │ │ └── Target_ModuleB.m │ ├── ModuleBCategory │ │ ├── CTMediator+ModuleB.h │ │ └── CTMediator+ModuleB.m │ ├── SingleViewController.h │ └── SingleViewController.m ├── Router │ ├── Common │ │ ├── CommonRouter.h │ │ └── CommonRouter.m │ ├── MGJRouter │ │ ├── MGJRouter.h │ │ └── MGJRouter.m │ ├── Models │ │ ├── RouterCategoryViewController.h │ │ ├── RouterCategoryViewController.m │ │ ├── RouterDetailViewController.h │ │ ├── RouterDetailViewController.m │ │ ├── RouterHomeViewController.h │ │ ├── RouterHomeViewController.m │ │ ├── RouterNextViewController.h │ │ └── RouterNextViewController.m │ └── RootHome │ │ ├── RouterMainViewController.h │ │ └── RouterMainViewController.m ├── ViewController.h ├── ViewController.m └── main.m └── README.md /.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 | # CocoaPods 32 | # 33 | # We recommend against adding the Pods directory to your .gitignore. However 34 | # you should judge for yourself, the pros and cons are mentioned at: 35 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 36 | # 37 | # Pods/ 38 | 39 | # Carthage 40 | # 41 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 42 | # Carthage/Checkouts 43 | 44 | Carthage/Build 45 | 46 | # fastlane 47 | # 48 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 49 | # screenshots whenever they are needed. 50 | # For more information about the recommended setup visit: 51 | # https://docs.fastlane.tools/best-practices/source-control/#source-control 52 | 53 | fastlane/report.xml 54 | fastlane/Preview.html 55 | fastlane/screenshots/**/*.png 56 | fastlane/test_output 57 | 58 | # Code Injection 59 | # 60 | # After new code Injection tools there's a generated folder /iOSInjectionProject 61 | # https://github.com/johnno1962/injectionforxcode 62 | 63 | iOSInjectionProject/ 64 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /MediatorRouter.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 48; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | B512FB0E2192ED2A002D47BD /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = B512FB0D2192ED2A002D47BD /* AppDelegate.m */; }; 11 | B512FB112192ED2A002D47BD /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B512FB102192ED2A002D47BD /* ViewController.m */; }; 12 | B512FB142192ED2A002D47BD /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = B512FB122192ED2A002D47BD /* Main.storyboard */; }; 13 | B512FB162192ED2A002D47BD /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = B512FB152192ED2A002D47BD /* Assets.xcassets */; }; 14 | B512FB192192ED2A002D47BD /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = B512FB172192ED2A002D47BD /* LaunchScreen.storyboard */; }; 15 | B512FB1C2192ED2A002D47BD /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = B512FB1B2192ED2A002D47BD /* main.m */; }; 16 | B512FB282192EE3D002D47BD /* MGJRouter.m in Sources */ = {isa = PBXBuildFile; fileRef = B512FB272192EE3D002D47BD /* MGJRouter.m */; }; 17 | B512FB2B2192EE4A002D47BD /* CTMediator.m in Sources */ = {isa = PBXBuildFile; fileRef = B512FB292192EE4A002D47BD /* CTMediator.m */; }; 18 | B512FB2F2192EE8E002D47BD /* RouterMainViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B512FB2E2192EE8E002D47BD /* RouterMainViewController.m */; }; 19 | B512FB332192EEA6002D47BD /* MediatorMainViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B512FB322192EEA6002D47BD /* MediatorMainViewController.m */; }; 20 | B512FB372192F33D002D47BD /* CommonRouter.m in Sources */ = {isa = PBXBuildFile; fileRef = B512FB362192F33D002D47BD /* CommonRouter.m */; }; 21 | B512FB3B2192F367002D47BD /* RouterCategoryViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B512FB3A2192F367002D47BD /* RouterCategoryViewController.m */; }; 22 | B512FB3E2192F374002D47BD /* RouterNextViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B512FB3D2192F374002D47BD /* RouterNextViewController.m */; }; 23 | B512FB412192F37D002D47BD /* RouterDetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B512FB402192F37D002D47BD /* RouterDetailViewController.m */; }; 24 | B512FB442192F385002D47BD /* RouterHomeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B512FB432192F385002D47BD /* RouterHomeViewController.m */; }; 25 | B512FB58219302A0002D47BD /* CTMediator+ModuleB.m in Sources */ = {isa = PBXBuildFile; fileRef = B512FB4A219302A0002D47BD /* CTMediator+ModuleB.m */; }; 26 | B512FB59219302A0002D47BD /* BViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B512FB4E219302A0002D47BD /* BViewController.m */; }; 27 | B512FB5A219302A0002D47BD /* Target_ModuleB.m in Sources */ = {isa = PBXBuildFile; fileRef = B512FB4F219302A0002D47BD /* Target_ModuleB.m */; }; 28 | B512FB5B219302A0002D47BD /* AViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B512FB52219302A0002D47BD /* AViewController.m */; }; 29 | B512FB5C219302A0002D47BD /* Target_ModuleA.m in Sources */ = {isa = PBXBuildFile; fileRef = B512FB53219302A0002D47BD /* Target_ModuleA.m */; }; 30 | B512FB5D219302A0002D47BD /* CTMediator+ModuleA.m in Sources */ = {isa = PBXBuildFile; fileRef = B512FB57219302A0002D47BD /* CTMediator+ModuleA.m */; }; 31 | B512FB60219302B2002D47BD /* SingleViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B512FB5F219302B2002D47BD /* SingleViewController.m */; }; 32 | B512FB6821930386002D47BD /* Target_MediatorHomeService.m in Sources */ = {isa = PBXBuildFile; fileRef = B512FB6721930386002D47BD /* Target_MediatorHomeService.m */; }; 33 | B512FB6B21930396002D47BD /* Target_MediatorDetailService.m in Sources */ = {isa = PBXBuildFile; fileRef = B512FB6A21930396002D47BD /* Target_MediatorDetailService.m */; }; 34 | B512FB6E219303A3002D47BD /* MediatorHomeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B512FB6D219303A3002D47BD /* MediatorHomeViewController.m */; }; 35 | B512FB74219303DC002D47BD /* MediatorDetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B512FB73219303DC002D47BD /* MediatorDetailViewController.m */; }; 36 | B512FB7721930400002D47BD /* MediatorCategoryViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B512FB7621930400002D47BD /* MediatorCategoryViewController.m */; }; 37 | B512FB7A2193040B002D47BD /* Target_MediatorCategoryService.m in Sources */ = {isa = PBXBuildFile; fileRef = B512FB792193040B002D47BD /* Target_MediatorCategoryService.m */; }; 38 | B512FB802193043D002D47BD /* MediatorNextViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B512FB7F2193043D002D47BD /* MediatorNextViewController.m */; }; 39 | B512FB8321930468002D47BD /* Target_MediatorNextService.m in Sources */ = {isa = PBXBuildFile; fileRef = B512FB8221930468002D47BD /* Target_MediatorNextService.m */; }; 40 | B512FB89219304C4002D47BD /* CTMediator+CategoryExtension.m in Sources */ = {isa = PBXBuildFile; fileRef = B512FB88219304C4002D47BD /* CTMediator+CategoryExtension.m */; }; 41 | B512FB8C219304D0002D47BD /* CTMediator+NextExtension.m in Sources */ = {isa = PBXBuildFile; fileRef = B512FB8B219304D0002D47BD /* CTMediator+NextExtension.m */; }; 42 | B512FB8F219304D9002D47BD /* CTMediator+HomeExtension.m in Sources */ = {isa = PBXBuildFile; fileRef = B512FB8E219304D9002D47BD /* CTMediator+HomeExtension.m */; }; 43 | B512FB92219304E4002D47BD /* CTMediator+DetailExtension.m in Sources */ = {isa = PBXBuildFile; fileRef = B512FB91219304E4002D47BD /* CTMediator+DetailExtension.m */; }; 44 | /* End PBXBuildFile section */ 45 | 46 | /* Begin PBXFileReference section */ 47 | B512FB092192ED2A002D47BD /* MediatorRouter.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MediatorRouter.app; sourceTree = BUILT_PRODUCTS_DIR; }; 48 | B512FB0C2192ED2A002D47BD /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 49 | B512FB0D2192ED2A002D47BD /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 50 | B512FB0F2192ED2A002D47BD /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 51 | B512FB102192ED2A002D47BD /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 52 | B512FB132192ED2A002D47BD /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 53 | B512FB152192ED2A002D47BD /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 54 | B512FB182192ED2A002D47BD /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 55 | B512FB1A2192ED2A002D47BD /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 56 | B512FB1B2192ED2A002D47BD /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 57 | B512FB262192EE3D002D47BD /* MGJRouter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGJRouter.h; sourceTree = ""; }; 58 | B512FB272192EE3D002D47BD /* MGJRouter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MGJRouter.m; sourceTree = ""; }; 59 | B512FB292192EE4A002D47BD /* CTMediator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CTMediator.m; sourceTree = ""; }; 60 | B512FB2A2192EE4A002D47BD /* CTMediator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CTMediator.h; sourceTree = ""; }; 61 | B512FB2D2192EE8E002D47BD /* RouterMainViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RouterMainViewController.h; sourceTree = ""; }; 62 | B512FB2E2192EE8E002D47BD /* RouterMainViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RouterMainViewController.m; sourceTree = ""; }; 63 | B512FB312192EEA6002D47BD /* MediatorMainViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MediatorMainViewController.h; sourceTree = ""; }; 64 | B512FB322192EEA6002D47BD /* MediatorMainViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MediatorMainViewController.m; sourceTree = ""; }; 65 | B512FB352192F33D002D47BD /* CommonRouter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CommonRouter.h; sourceTree = ""; }; 66 | B512FB362192F33D002D47BD /* CommonRouter.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CommonRouter.m; sourceTree = ""; }; 67 | B512FB392192F367002D47BD /* RouterCategoryViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RouterCategoryViewController.h; sourceTree = ""; }; 68 | B512FB3A2192F367002D47BD /* RouterCategoryViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RouterCategoryViewController.m; sourceTree = ""; }; 69 | B512FB3C2192F374002D47BD /* RouterNextViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RouterNextViewController.h; sourceTree = ""; }; 70 | B512FB3D2192F374002D47BD /* RouterNextViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RouterNextViewController.m; sourceTree = ""; }; 71 | B512FB3F2192F37D002D47BD /* RouterDetailViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RouterDetailViewController.h; sourceTree = ""; }; 72 | B512FB402192F37D002D47BD /* RouterDetailViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RouterDetailViewController.m; sourceTree = ""; }; 73 | B512FB422192F385002D47BD /* RouterHomeViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RouterHomeViewController.h; sourceTree = ""; }; 74 | B512FB432192F385002D47BD /* RouterHomeViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RouterHomeViewController.m; sourceTree = ""; }; 75 | B512FB49219302A0002D47BD /* CTMediator+ModuleB.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "CTMediator+ModuleB.h"; sourceTree = ""; }; 76 | B512FB4A219302A0002D47BD /* CTMediator+ModuleB.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "CTMediator+ModuleB.m"; sourceTree = ""; }; 77 | B512FB4C219302A0002D47BD /* BViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BViewController.h; sourceTree = ""; }; 78 | B512FB4D219302A0002D47BD /* Target_ModuleB.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Target_ModuleB.h; sourceTree = ""; }; 79 | B512FB4E219302A0002D47BD /* BViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BViewController.m; sourceTree = ""; }; 80 | B512FB4F219302A0002D47BD /* Target_ModuleB.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Target_ModuleB.m; sourceTree = ""; }; 81 | B512FB51219302A0002D47BD /* Target_ModuleA.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Target_ModuleA.h; sourceTree = ""; }; 82 | B512FB52219302A0002D47BD /* AViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AViewController.m; sourceTree = ""; }; 83 | B512FB53219302A0002D47BD /* Target_ModuleA.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Target_ModuleA.m; sourceTree = ""; }; 84 | B512FB54219302A0002D47BD /* AViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AViewController.h; sourceTree = ""; }; 85 | B512FB56219302A0002D47BD /* CTMediator+ModuleA.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "CTMediator+ModuleA.h"; sourceTree = ""; }; 86 | B512FB57219302A0002D47BD /* CTMediator+ModuleA.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "CTMediator+ModuleA.m"; sourceTree = ""; }; 87 | B512FB5E219302B2002D47BD /* SingleViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SingleViewController.h; sourceTree = ""; }; 88 | B512FB5F219302B2002D47BD /* SingleViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SingleViewController.m; sourceTree = ""; }; 89 | B512FB6621930386002D47BD /* Target_MediatorHomeService.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Target_MediatorHomeService.h; sourceTree = ""; }; 90 | B512FB6721930386002D47BD /* Target_MediatorHomeService.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Target_MediatorHomeService.m; sourceTree = ""; }; 91 | B512FB6921930396002D47BD /* Target_MediatorDetailService.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Target_MediatorDetailService.h; sourceTree = ""; }; 92 | B512FB6A21930396002D47BD /* Target_MediatorDetailService.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Target_MediatorDetailService.m; sourceTree = ""; }; 93 | B512FB6C219303A3002D47BD /* MediatorHomeViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MediatorHomeViewController.h; sourceTree = ""; }; 94 | B512FB6D219303A3002D47BD /* MediatorHomeViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MediatorHomeViewController.m; sourceTree = ""; }; 95 | B512FB72219303DC002D47BD /* MediatorDetailViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MediatorDetailViewController.h; sourceTree = ""; }; 96 | B512FB73219303DC002D47BD /* MediatorDetailViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MediatorDetailViewController.m; sourceTree = ""; }; 97 | B512FB7521930400002D47BD /* MediatorCategoryViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MediatorCategoryViewController.h; sourceTree = ""; }; 98 | B512FB7621930400002D47BD /* MediatorCategoryViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MediatorCategoryViewController.m; sourceTree = ""; }; 99 | B512FB782193040B002D47BD /* Target_MediatorCategoryService.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Target_MediatorCategoryService.h; sourceTree = ""; }; 100 | B512FB792193040B002D47BD /* Target_MediatorCategoryService.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Target_MediatorCategoryService.m; sourceTree = ""; }; 101 | B512FB7E2193043D002D47BD /* MediatorNextViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MediatorNextViewController.h; sourceTree = ""; }; 102 | B512FB7F2193043D002D47BD /* MediatorNextViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MediatorNextViewController.m; sourceTree = ""; }; 103 | B512FB8121930468002D47BD /* Target_MediatorNextService.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Target_MediatorNextService.h; sourceTree = ""; }; 104 | B512FB8221930468002D47BD /* Target_MediatorNextService.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Target_MediatorNextService.m; sourceTree = ""; }; 105 | B512FB87219304C4002D47BD /* CTMediator+CategoryExtension.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "CTMediator+CategoryExtension.h"; sourceTree = ""; }; 106 | B512FB88219304C4002D47BD /* CTMediator+CategoryExtension.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "CTMediator+CategoryExtension.m"; sourceTree = ""; }; 107 | B512FB8A219304D0002D47BD /* CTMediator+NextExtension.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "CTMediator+NextExtension.h"; sourceTree = ""; }; 108 | B512FB8B219304D0002D47BD /* CTMediator+NextExtension.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "CTMediator+NextExtension.m"; sourceTree = ""; }; 109 | B512FB8D219304D9002D47BD /* CTMediator+HomeExtension.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "CTMediator+HomeExtension.h"; sourceTree = ""; }; 110 | B512FB8E219304D9002D47BD /* CTMediator+HomeExtension.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "CTMediator+HomeExtension.m"; sourceTree = ""; }; 111 | B512FB90219304E4002D47BD /* CTMediator+DetailExtension.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "CTMediator+DetailExtension.h"; sourceTree = ""; }; 112 | B512FB91219304E4002D47BD /* CTMediator+DetailExtension.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "CTMediator+DetailExtension.m"; sourceTree = ""; }; 113 | /* End PBXFileReference section */ 114 | 115 | /* Begin PBXFrameworksBuildPhase section */ 116 | B512FB062192ED2A002D47BD /* Frameworks */ = { 117 | isa = PBXFrameworksBuildPhase; 118 | buildActionMask = 2147483647; 119 | files = ( 120 | ); 121 | runOnlyForDeploymentPostprocessing = 0; 122 | }; 123 | /* End PBXFrameworksBuildPhase section */ 124 | 125 | /* Begin PBXGroup section */ 126 | B512FB002192ED2A002D47BD = { 127 | isa = PBXGroup; 128 | children = ( 129 | B512FB0B2192ED2A002D47BD /* MediatorRouter */, 130 | B512FB0A2192ED2A002D47BD /* Products */, 131 | ); 132 | sourceTree = ""; 133 | }; 134 | B512FB0A2192ED2A002D47BD /* Products */ = { 135 | isa = PBXGroup; 136 | children = ( 137 | B512FB092192ED2A002D47BD /* MediatorRouter.app */, 138 | ); 139 | name = Products; 140 | sourceTree = ""; 141 | }; 142 | B512FB0B2192ED2A002D47BD /* MediatorRouter */ = { 143 | isa = PBXGroup; 144 | children = ( 145 | B512FB232192EDB8002D47BD /* Router */, 146 | B512FB222192EDAF002D47BD /* Mediator */, 147 | B512FB0C2192ED2A002D47BD /* AppDelegate.h */, 148 | B512FB0D2192ED2A002D47BD /* AppDelegate.m */, 149 | B512FB0F2192ED2A002D47BD /* ViewController.h */, 150 | B512FB102192ED2A002D47BD /* ViewController.m */, 151 | B512FB122192ED2A002D47BD /* Main.storyboard */, 152 | B512FB152192ED2A002D47BD /* Assets.xcassets */, 153 | B512FB172192ED2A002D47BD /* LaunchScreen.storyboard */, 154 | B512FB1A2192ED2A002D47BD /* Info.plist */, 155 | B512FB1B2192ED2A002D47BD /* main.m */, 156 | B512FB4721930280002D47BD /* Others */, 157 | ); 158 | path = MediatorRouter; 159 | sourceTree = ""; 160 | }; 161 | B512FB222192EDAF002D47BD /* Mediator */ = { 162 | isa = PBXGroup; 163 | children = ( 164 | B512FB462193025B002D47BD /* Models */, 165 | B512FB302192EE9C002D47BD /* MediatorHome */, 166 | B512FB252192EE32002D47BD /* CTMediator */, 167 | ); 168 | path = Mediator; 169 | sourceTree = ""; 170 | }; 171 | B512FB232192EDB8002D47BD /* Router */ = { 172 | isa = PBXGroup; 173 | children = ( 174 | B512FB382192F34E002D47BD /* Models */, 175 | B512FB342192F32A002D47BD /* Common */, 176 | B512FB2C2192EE75002D47BD /* RootHome */, 177 | B512FB242192EE1D002D47BD /* MGJRouter */, 178 | ); 179 | path = Router; 180 | sourceTree = ""; 181 | }; 182 | B512FB242192EE1D002D47BD /* MGJRouter */ = { 183 | isa = PBXGroup; 184 | children = ( 185 | B512FB262192EE3D002D47BD /* MGJRouter.h */, 186 | B512FB272192EE3D002D47BD /* MGJRouter.m */, 187 | ); 188 | path = MGJRouter; 189 | sourceTree = ""; 190 | }; 191 | B512FB252192EE32002D47BD /* CTMediator */ = { 192 | isa = PBXGroup; 193 | children = ( 194 | B512FB2A2192EE4A002D47BD /* CTMediator.h */, 195 | B512FB292192EE4A002D47BD /* CTMediator.m */, 196 | ); 197 | path = CTMediator; 198 | sourceTree = ""; 199 | }; 200 | B512FB2C2192EE75002D47BD /* RootHome */ = { 201 | isa = PBXGroup; 202 | children = ( 203 | B512FB2D2192EE8E002D47BD /* RouterMainViewController.h */, 204 | B512FB2E2192EE8E002D47BD /* RouterMainViewController.m */, 205 | ); 206 | path = RootHome; 207 | sourceTree = ""; 208 | }; 209 | B512FB302192EE9C002D47BD /* MediatorHome */ = { 210 | isa = PBXGroup; 211 | children = ( 212 | B512FB312192EEA6002D47BD /* MediatorMainViewController.h */, 213 | B512FB322192EEA6002D47BD /* MediatorMainViewController.m */, 214 | ); 215 | path = MediatorHome; 216 | sourceTree = ""; 217 | }; 218 | B512FB342192F32A002D47BD /* Common */ = { 219 | isa = PBXGroup; 220 | children = ( 221 | B512FB352192F33D002D47BD /* CommonRouter.h */, 222 | B512FB362192F33D002D47BD /* CommonRouter.m */, 223 | ); 224 | path = Common; 225 | sourceTree = ""; 226 | }; 227 | B512FB382192F34E002D47BD /* Models */ = { 228 | isa = PBXGroup; 229 | children = ( 230 | B512FB392192F367002D47BD /* RouterCategoryViewController.h */, 231 | B512FB3A2192F367002D47BD /* RouterCategoryViewController.m */, 232 | B512FB3C2192F374002D47BD /* RouterNextViewController.h */, 233 | B512FB3D2192F374002D47BD /* RouterNextViewController.m */, 234 | B512FB3F2192F37D002D47BD /* RouterDetailViewController.h */, 235 | B512FB402192F37D002D47BD /* RouterDetailViewController.m */, 236 | B512FB422192F385002D47BD /* RouterHomeViewController.h */, 237 | B512FB432192F385002D47BD /* RouterHomeViewController.m */, 238 | ); 239 | path = Models; 240 | sourceTree = ""; 241 | }; 242 | B512FB462193025B002D47BD /* Models */ = { 243 | isa = PBXGroup; 244 | children = ( 245 | B512FB622193031E002D47BD /* Category */, 246 | B512FB6121930319002D47BD /* Home */, 247 | ); 248 | path = Models; 249 | sourceTree = ""; 250 | }; 251 | B512FB4721930280002D47BD /* Others */ = { 252 | isa = PBXGroup; 253 | children = ( 254 | B512FB5E219302B2002D47BD /* SingleViewController.h */, 255 | B512FB5F219302B2002D47BD /* SingleViewController.m */, 256 | B512FB50219302A0002D47BD /* ModuleA */, 257 | B512FB55219302A0002D47BD /* ModuleACategory */, 258 | B512FB4B219302A0002D47BD /* ModuleB */, 259 | B512FB48219302A0002D47BD /* ModuleBCategory */, 260 | ); 261 | path = Others; 262 | sourceTree = ""; 263 | }; 264 | B512FB48219302A0002D47BD /* ModuleBCategory */ = { 265 | isa = PBXGroup; 266 | children = ( 267 | B512FB49219302A0002D47BD /* CTMediator+ModuleB.h */, 268 | B512FB4A219302A0002D47BD /* CTMediator+ModuleB.m */, 269 | ); 270 | path = ModuleBCategory; 271 | sourceTree = ""; 272 | }; 273 | B512FB4B219302A0002D47BD /* ModuleB */ = { 274 | isa = PBXGroup; 275 | children = ( 276 | B512FB4C219302A0002D47BD /* BViewController.h */, 277 | B512FB4D219302A0002D47BD /* Target_ModuleB.h */, 278 | B512FB4E219302A0002D47BD /* BViewController.m */, 279 | B512FB4F219302A0002D47BD /* Target_ModuleB.m */, 280 | ); 281 | path = ModuleB; 282 | sourceTree = ""; 283 | }; 284 | B512FB50219302A0002D47BD /* ModuleA */ = { 285 | isa = PBXGroup; 286 | children = ( 287 | B512FB51219302A0002D47BD /* Target_ModuleA.h */, 288 | B512FB52219302A0002D47BD /* AViewController.m */, 289 | B512FB53219302A0002D47BD /* Target_ModuleA.m */, 290 | B512FB54219302A0002D47BD /* AViewController.h */, 291 | ); 292 | path = ModuleA; 293 | sourceTree = ""; 294 | }; 295 | B512FB55219302A0002D47BD /* ModuleACategory */ = { 296 | isa = PBXGroup; 297 | children = ( 298 | B512FB56219302A0002D47BD /* CTMediator+ModuleA.h */, 299 | B512FB57219302A0002D47BD /* CTMediator+ModuleA.m */, 300 | ); 301 | path = ModuleACategory; 302 | sourceTree = ""; 303 | }; 304 | B512FB6121930319002D47BD /* Home */ = { 305 | isa = PBXGroup; 306 | children = ( 307 | B512FB6C219303A3002D47BD /* MediatorHomeViewController.h */, 308 | B512FB6D219303A3002D47BD /* MediatorHomeViewController.m */, 309 | B512FB6621930386002D47BD /* Target_MediatorHomeService.h */, 310 | B512FB6721930386002D47BD /* Target_MediatorHomeService.m */, 311 | B512FB8D219304D9002D47BD /* CTMediator+HomeExtension.h */, 312 | B512FB8E219304D9002D47BD /* CTMediator+HomeExtension.m */, 313 | B512FB642193032D002D47BD /* Detail */, 314 | ); 315 | path = Home; 316 | sourceTree = ""; 317 | }; 318 | B512FB622193031E002D47BD /* Category */ = { 319 | isa = PBXGroup; 320 | children = ( 321 | B512FB7521930400002D47BD /* MediatorCategoryViewController.h */, 322 | B512FB7621930400002D47BD /* MediatorCategoryViewController.m */, 323 | B512FB782193040B002D47BD /* Target_MediatorCategoryService.h */, 324 | B512FB792193040B002D47BD /* Target_MediatorCategoryService.m */, 325 | B512FB87219304C4002D47BD /* CTMediator+CategoryExtension.h */, 326 | B512FB88219304C4002D47BD /* CTMediator+CategoryExtension.m */, 327 | B512FB6321930327002D47BD /* Next */, 328 | ); 329 | path = Category; 330 | sourceTree = ""; 331 | }; 332 | B512FB6321930327002D47BD /* Next */ = { 333 | isa = PBXGroup; 334 | children = ( 335 | B512FB7E2193043D002D47BD /* MediatorNextViewController.h */, 336 | B512FB7F2193043D002D47BD /* MediatorNextViewController.m */, 337 | B512FB8121930468002D47BD /* Target_MediatorNextService.h */, 338 | B512FB8221930468002D47BD /* Target_MediatorNextService.m */, 339 | B512FB8A219304D0002D47BD /* CTMediator+NextExtension.h */, 340 | B512FB8B219304D0002D47BD /* CTMediator+NextExtension.m */, 341 | ); 342 | path = Next; 343 | sourceTree = ""; 344 | }; 345 | B512FB642193032D002D47BD /* Detail */ = { 346 | isa = PBXGroup; 347 | children = ( 348 | B512FB72219303DC002D47BD /* MediatorDetailViewController.h */, 349 | B512FB73219303DC002D47BD /* MediatorDetailViewController.m */, 350 | B512FB6921930396002D47BD /* Target_MediatorDetailService.h */, 351 | B512FB6A21930396002D47BD /* Target_MediatorDetailService.m */, 352 | B512FB90219304E4002D47BD /* CTMediator+DetailExtension.h */, 353 | B512FB91219304E4002D47BD /* CTMediator+DetailExtension.m */, 354 | ); 355 | path = Detail; 356 | sourceTree = ""; 357 | }; 358 | /* End PBXGroup section */ 359 | 360 | /* Begin PBXNativeTarget section */ 361 | B512FB082192ED2A002D47BD /* MediatorRouter */ = { 362 | isa = PBXNativeTarget; 363 | buildConfigurationList = B512FB1F2192ED2A002D47BD /* Build configuration list for PBXNativeTarget "MediatorRouter" */; 364 | buildPhases = ( 365 | B512FB052192ED2A002D47BD /* Sources */, 366 | B512FB062192ED2A002D47BD /* Frameworks */, 367 | B512FB072192ED2A002D47BD /* Resources */, 368 | ); 369 | buildRules = ( 370 | ); 371 | dependencies = ( 372 | ); 373 | name = MediatorRouter; 374 | productName = MediatorRouter; 375 | productReference = B512FB092192ED2A002D47BD /* MediatorRouter.app */; 376 | productType = "com.apple.product-type.application"; 377 | }; 378 | /* End PBXNativeTarget section */ 379 | 380 | /* Begin PBXProject section */ 381 | B512FB012192ED2A002D47BD /* Project object */ = { 382 | isa = PBXProject; 383 | attributes = { 384 | LastUpgradeCheck = 0920; 385 | ORGANIZATIONNAME = iCocos; 386 | TargetAttributes = { 387 | B512FB082192ED2A002D47BD = { 388 | CreatedOnToolsVersion = 9.2; 389 | ProvisioningStyle = Automatic; 390 | }; 391 | }; 392 | }; 393 | buildConfigurationList = B512FB042192ED2A002D47BD /* Build configuration list for PBXProject "MediatorRouter" */; 394 | compatibilityVersion = "Xcode 8.0"; 395 | developmentRegion = en; 396 | hasScannedForEncodings = 0; 397 | knownRegions = ( 398 | en, 399 | Base, 400 | ); 401 | mainGroup = B512FB002192ED2A002D47BD; 402 | productRefGroup = B512FB0A2192ED2A002D47BD /* Products */; 403 | projectDirPath = ""; 404 | projectRoot = ""; 405 | targets = ( 406 | B512FB082192ED2A002D47BD /* MediatorRouter */, 407 | ); 408 | }; 409 | /* End PBXProject section */ 410 | 411 | /* Begin PBXResourcesBuildPhase section */ 412 | B512FB072192ED2A002D47BD /* Resources */ = { 413 | isa = PBXResourcesBuildPhase; 414 | buildActionMask = 2147483647; 415 | files = ( 416 | B512FB192192ED2A002D47BD /* LaunchScreen.storyboard in Resources */, 417 | B512FB162192ED2A002D47BD /* Assets.xcassets in Resources */, 418 | B512FB142192ED2A002D47BD /* Main.storyboard in Resources */, 419 | ); 420 | runOnlyForDeploymentPostprocessing = 0; 421 | }; 422 | /* End PBXResourcesBuildPhase section */ 423 | 424 | /* Begin PBXSourcesBuildPhase section */ 425 | B512FB052192ED2A002D47BD /* Sources */ = { 426 | isa = PBXSourcesBuildPhase; 427 | buildActionMask = 2147483647; 428 | files = ( 429 | B512FB332192EEA6002D47BD /* MediatorMainViewController.m in Sources */, 430 | B512FB412192F37D002D47BD /* RouterDetailViewController.m in Sources */, 431 | B512FB8F219304D9002D47BD /* CTMediator+HomeExtension.m in Sources */, 432 | B512FB2F2192EE8E002D47BD /* RouterMainViewController.m in Sources */, 433 | B512FB112192ED2A002D47BD /* ViewController.m in Sources */, 434 | B512FB372192F33D002D47BD /* CommonRouter.m in Sources */, 435 | B512FB6821930386002D47BD /* Target_MediatorHomeService.m in Sources */, 436 | B512FB58219302A0002D47BD /* CTMediator+ModuleB.m in Sources */, 437 | B512FB2B2192EE4A002D47BD /* CTMediator.m in Sources */, 438 | B512FB6B21930396002D47BD /* Target_MediatorDetailService.m in Sources */, 439 | B512FB59219302A0002D47BD /* BViewController.m in Sources */, 440 | B512FB7A2193040B002D47BD /* Target_MediatorCategoryService.m in Sources */, 441 | B512FB7721930400002D47BD /* MediatorCategoryViewController.m in Sources */, 442 | B512FB74219303DC002D47BD /* MediatorDetailViewController.m in Sources */, 443 | B512FB60219302B2002D47BD /* SingleViewController.m in Sources */, 444 | B512FB92219304E4002D47BD /* CTMediator+DetailExtension.m in Sources */, 445 | B512FB8C219304D0002D47BD /* CTMediator+NextExtension.m in Sources */, 446 | B512FB442192F385002D47BD /* RouterHomeViewController.m in Sources */, 447 | B512FB89219304C4002D47BD /* CTMediator+CategoryExtension.m in Sources */, 448 | B512FB282192EE3D002D47BD /* MGJRouter.m in Sources */, 449 | B512FB1C2192ED2A002D47BD /* main.m in Sources */, 450 | B512FB3B2192F367002D47BD /* RouterCategoryViewController.m in Sources */, 451 | B512FB5B219302A0002D47BD /* AViewController.m in Sources */, 452 | B512FB5D219302A0002D47BD /* CTMediator+ModuleA.m in Sources */, 453 | B512FB802193043D002D47BD /* MediatorNextViewController.m in Sources */, 454 | B512FB3E2192F374002D47BD /* RouterNextViewController.m in Sources */, 455 | B512FB6E219303A3002D47BD /* MediatorHomeViewController.m in Sources */, 456 | B512FB5A219302A0002D47BD /* Target_ModuleB.m in Sources */, 457 | B512FB0E2192ED2A002D47BD /* AppDelegate.m in Sources */, 458 | B512FB5C219302A0002D47BD /* Target_ModuleA.m in Sources */, 459 | B512FB8321930468002D47BD /* Target_MediatorNextService.m in Sources */, 460 | ); 461 | runOnlyForDeploymentPostprocessing = 0; 462 | }; 463 | /* End PBXSourcesBuildPhase section */ 464 | 465 | /* Begin PBXVariantGroup section */ 466 | B512FB122192ED2A002D47BD /* Main.storyboard */ = { 467 | isa = PBXVariantGroup; 468 | children = ( 469 | B512FB132192ED2A002D47BD /* Base */, 470 | ); 471 | name = Main.storyboard; 472 | sourceTree = ""; 473 | }; 474 | B512FB172192ED2A002D47BD /* LaunchScreen.storyboard */ = { 475 | isa = PBXVariantGroup; 476 | children = ( 477 | B512FB182192ED2A002D47BD /* Base */, 478 | ); 479 | name = LaunchScreen.storyboard; 480 | sourceTree = ""; 481 | }; 482 | /* End PBXVariantGroup section */ 483 | 484 | /* Begin XCBuildConfiguration section */ 485 | B512FB1D2192ED2A002D47BD /* Debug */ = { 486 | isa = XCBuildConfiguration; 487 | buildSettings = { 488 | ALWAYS_SEARCH_USER_PATHS = NO; 489 | CLANG_ANALYZER_NONNULL = YES; 490 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 491 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 492 | CLANG_CXX_LIBRARY = "libc++"; 493 | CLANG_ENABLE_MODULES = YES; 494 | CLANG_ENABLE_OBJC_ARC = YES; 495 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 496 | CLANG_WARN_BOOL_CONVERSION = YES; 497 | CLANG_WARN_COMMA = YES; 498 | CLANG_WARN_CONSTANT_CONVERSION = YES; 499 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 500 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 501 | CLANG_WARN_EMPTY_BODY = YES; 502 | CLANG_WARN_ENUM_CONVERSION = YES; 503 | CLANG_WARN_INFINITE_RECURSION = YES; 504 | CLANG_WARN_INT_CONVERSION = YES; 505 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 506 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 507 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 508 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 509 | CLANG_WARN_STRICT_PROTOTYPES = YES; 510 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 511 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 512 | CLANG_WARN_UNREACHABLE_CODE = YES; 513 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 514 | CODE_SIGN_IDENTITY = "iPhone Developer"; 515 | COPY_PHASE_STRIP = NO; 516 | DEBUG_INFORMATION_FORMAT = dwarf; 517 | ENABLE_STRICT_OBJC_MSGSEND = YES; 518 | ENABLE_TESTABILITY = YES; 519 | GCC_C_LANGUAGE_STANDARD = gnu11; 520 | GCC_DYNAMIC_NO_PIC = NO; 521 | GCC_NO_COMMON_BLOCKS = YES; 522 | GCC_OPTIMIZATION_LEVEL = 0; 523 | GCC_PREPROCESSOR_DEFINITIONS = ( 524 | "DEBUG=1", 525 | "$(inherited)", 526 | ); 527 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 528 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 529 | GCC_WARN_UNDECLARED_SELECTOR = YES; 530 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 531 | GCC_WARN_UNUSED_FUNCTION = YES; 532 | GCC_WARN_UNUSED_VARIABLE = YES; 533 | IPHONEOS_DEPLOYMENT_TARGET = 11.2; 534 | MTL_ENABLE_DEBUG_INFO = YES; 535 | ONLY_ACTIVE_ARCH = YES; 536 | SDKROOT = iphoneos; 537 | }; 538 | name = Debug; 539 | }; 540 | B512FB1E2192ED2A002D47BD /* Release */ = { 541 | isa = XCBuildConfiguration; 542 | buildSettings = { 543 | ALWAYS_SEARCH_USER_PATHS = NO; 544 | CLANG_ANALYZER_NONNULL = YES; 545 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 546 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 547 | CLANG_CXX_LIBRARY = "libc++"; 548 | CLANG_ENABLE_MODULES = YES; 549 | CLANG_ENABLE_OBJC_ARC = YES; 550 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 551 | CLANG_WARN_BOOL_CONVERSION = YES; 552 | CLANG_WARN_COMMA = YES; 553 | CLANG_WARN_CONSTANT_CONVERSION = YES; 554 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 555 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 556 | CLANG_WARN_EMPTY_BODY = YES; 557 | CLANG_WARN_ENUM_CONVERSION = YES; 558 | CLANG_WARN_INFINITE_RECURSION = YES; 559 | CLANG_WARN_INT_CONVERSION = YES; 560 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 561 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 562 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 563 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 564 | CLANG_WARN_STRICT_PROTOTYPES = YES; 565 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 566 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 567 | CLANG_WARN_UNREACHABLE_CODE = YES; 568 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 569 | CODE_SIGN_IDENTITY = "iPhone Developer"; 570 | COPY_PHASE_STRIP = NO; 571 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 572 | ENABLE_NS_ASSERTIONS = NO; 573 | ENABLE_STRICT_OBJC_MSGSEND = YES; 574 | GCC_C_LANGUAGE_STANDARD = gnu11; 575 | GCC_NO_COMMON_BLOCKS = YES; 576 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 577 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 578 | GCC_WARN_UNDECLARED_SELECTOR = YES; 579 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 580 | GCC_WARN_UNUSED_FUNCTION = YES; 581 | GCC_WARN_UNUSED_VARIABLE = YES; 582 | IPHONEOS_DEPLOYMENT_TARGET = 11.2; 583 | MTL_ENABLE_DEBUG_INFO = NO; 584 | SDKROOT = iphoneos; 585 | VALIDATE_PRODUCT = YES; 586 | }; 587 | name = Release; 588 | }; 589 | B512FB202192ED2A002D47BD /* Debug */ = { 590 | isa = XCBuildConfiguration; 591 | buildSettings = { 592 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 593 | CODE_SIGN_STYLE = Automatic; 594 | DEVELOPMENT_TEAM = RCFEBWFYQR; 595 | INFOPLIST_FILE = MediatorRouter/Info.plist; 596 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 597 | PRODUCT_BUNDLE_IDENTIFIER = iCocos.MediatorRouter; 598 | PRODUCT_NAME = "$(TARGET_NAME)"; 599 | TARGETED_DEVICE_FAMILY = "1,2"; 600 | }; 601 | name = Debug; 602 | }; 603 | B512FB212192ED2A002D47BD /* Release */ = { 604 | isa = XCBuildConfiguration; 605 | buildSettings = { 606 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 607 | CODE_SIGN_STYLE = Automatic; 608 | DEVELOPMENT_TEAM = RCFEBWFYQR; 609 | INFOPLIST_FILE = MediatorRouter/Info.plist; 610 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 611 | PRODUCT_BUNDLE_IDENTIFIER = iCocos.MediatorRouter; 612 | PRODUCT_NAME = "$(TARGET_NAME)"; 613 | TARGETED_DEVICE_FAMILY = "1,2"; 614 | }; 615 | name = Release; 616 | }; 617 | /* End XCBuildConfiguration section */ 618 | 619 | /* Begin XCConfigurationList section */ 620 | B512FB042192ED2A002D47BD /* Build configuration list for PBXProject "MediatorRouter" */ = { 621 | isa = XCConfigurationList; 622 | buildConfigurations = ( 623 | B512FB1D2192ED2A002D47BD /* Debug */, 624 | B512FB1E2192ED2A002D47BD /* Release */, 625 | ); 626 | defaultConfigurationIsVisible = 0; 627 | defaultConfigurationName = Release; 628 | }; 629 | B512FB1F2192ED2A002D47BD /* Build configuration list for PBXNativeTarget "MediatorRouter" */ = { 630 | isa = XCConfigurationList; 631 | buildConfigurations = ( 632 | B512FB202192ED2A002D47BD /* Debug */, 633 | B512FB212192ED2A002D47BD /* Release */, 634 | ); 635 | defaultConfigurationIsVisible = 0; 636 | defaultConfigurationName = Release; 637 | }; 638 | /* End XCConfigurationList section */ 639 | }; 640 | rootObject = B512FB012192ED2A002D47BD /* Project object */; 641 | } 642 | -------------------------------------------------------------------------------- /MediatorRouter.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /MediatorRouter/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // MediatorRouter 4 | // 5 | // Created by iCocos on 2018/11/7. 6 | // Copyright © 2018年 iCocos. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /MediatorRouter/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // MediatorRouter 4 | // 5 | // Created by iCocos on 2018/11/7. 6 | // Copyright © 2018年 iCocos. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 19 | // Override point for customization after application launch. 20 | return YES; 21 | } 22 | 23 | 24 | - (void)applicationWillResignActive:(UIApplication *)application { 25 | // 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. 26 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 27 | } 28 | 29 | 30 | - (void)applicationDidEnterBackground:(UIApplication *)application { 31 | // 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. 32 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 33 | } 34 | 35 | 36 | - (void)applicationWillEnterForeground:(UIApplication *)application { 37 | // 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. 38 | } 39 | 40 | 41 | - (void)applicationDidBecomeActive:(UIApplication *)application { 42 | // 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. 43 | } 44 | 45 | 46 | - (void)applicationWillTerminate:(UIApplication *)application { 47 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 48 | } 49 | 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /MediatorRouter/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 | } -------------------------------------------------------------------------------- /MediatorRouter/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /MediatorRouter/Assets.xcassets/tabbar_mine_normal.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "tabbar_mine_normal@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "tabbar_mine_normal@3x.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /MediatorRouter/Assets.xcassets/tabbar_mine_normal.imageset/tabbar_mine_normal@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/al1020119/MediatorAndRouter/65482ac9fef4b46f849905f3139b2680f14dfa67/MediatorRouter/Assets.xcassets/tabbar_mine_normal.imageset/tabbar_mine_normal@2x.png -------------------------------------------------------------------------------- /MediatorRouter/Assets.xcassets/tabbar_mine_normal.imageset/tabbar_mine_normal@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/al1020119/MediatorAndRouter/65482ac9fef4b46f849905f3139b2680f14dfa67/MediatorRouter/Assets.xcassets/tabbar_mine_normal.imageset/tabbar_mine_normal@3x.png -------------------------------------------------------------------------------- /MediatorRouter/Assets.xcassets/tabbar_mine_select.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "tabbar_mine_select@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "tabbar_mine_select@3x.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /MediatorRouter/Assets.xcassets/tabbar_mine_select.imageset/tabbar_mine_select@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/al1020119/MediatorAndRouter/65482ac9fef4b46f849905f3139b2680f14dfa67/MediatorRouter/Assets.xcassets/tabbar_mine_select.imageset/tabbar_mine_select@2x.png -------------------------------------------------------------------------------- /MediatorRouter/Assets.xcassets/tabbar_mine_select.imageset/tabbar_mine_select@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/al1020119/MediatorAndRouter/65482ac9fef4b46f849905f3139b2680f14dfa67/MediatorRouter/Assets.xcassets/tabbar_mine_select.imageset/tabbar_mine_select@3x.png -------------------------------------------------------------------------------- /MediatorRouter/Assets.xcassets/tabbar_platform_normal.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "tabbar_platform_normal@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "tabbar_platform_normal@3x.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /MediatorRouter/Assets.xcassets/tabbar_platform_normal.imageset/tabbar_platform_normal@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/al1020119/MediatorAndRouter/65482ac9fef4b46f849905f3139b2680f14dfa67/MediatorRouter/Assets.xcassets/tabbar_platform_normal.imageset/tabbar_platform_normal@2x.png -------------------------------------------------------------------------------- /MediatorRouter/Assets.xcassets/tabbar_platform_normal.imageset/tabbar_platform_normal@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/al1020119/MediatorAndRouter/65482ac9fef4b46f849905f3139b2680f14dfa67/MediatorRouter/Assets.xcassets/tabbar_platform_normal.imageset/tabbar_platform_normal@3x.png -------------------------------------------------------------------------------- /MediatorRouter/Assets.xcassets/tabbar_platform_select.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "tabbar_platform_select@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "tabbar_platform_select@3x.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /MediatorRouter/Assets.xcassets/tabbar_platform_select.imageset/tabbar_platform_select@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/al1020119/MediatorAndRouter/65482ac9fef4b46f849905f3139b2680f14dfa67/MediatorRouter/Assets.xcassets/tabbar_platform_select.imageset/tabbar_platform_select@2x.png -------------------------------------------------------------------------------- /MediatorRouter/Assets.xcassets/tabbar_platform_select.imageset/tabbar_platform_select@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/al1020119/MediatorAndRouter/65482ac9fef4b46f849905f3139b2680f14dfa67/MediatorRouter/Assets.xcassets/tabbar_platform_select.imageset/tabbar_platform_select@3x.png -------------------------------------------------------------------------------- /MediatorRouter/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 | -------------------------------------------------------------------------------- /MediatorRouter/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /MediatorRouter/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 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /MediatorRouter/Mediator/CTMediator/CTMediator.h: -------------------------------------------------------------------------------- 1 | // 2 | // CTMediator.h 3 | // CTMediatorDemo 4 | // 5 | // Created by jiangxintong on 2018/10/23. 6 | // Copyright © 2018年 jiangxintong. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | extern NSString * const kCTMediatorParamsKeySwiftTargetModuleName; 15 | 16 | @interface CTMediator : NSObject 17 | 18 | + (instancetype)sharedInstance; 19 | 20 | /** 21 | * 远程App调用入口 22 | * @param url url接口 23 | * @param completion block回调 24 | */ 25 | - (id)performActionWithUrl:(NSURL *)url completion:(void(^)(NSDictionary *info))completion; 26 | 27 | /** 28 | * 本地组件调用入口 29 | * @param targetName 目标名字 30 | * @param actionName 方法名字 31 | * @param params 参数字典 32 | * @param shouldCacheTarget 是否缓存目标 33 | */ 34 | - (id)performTarget:(NSString *)targetName action:(NSString *)actionName params:(NSDictionary *)params shouldCacheTarget:(BOOL)shouldCacheTarget; 35 | 36 | /** 37 | * 释放已缓存的目标 通过目标名字 38 | * @param targetName 目标名字 39 | */ 40 | - (void)releaseCachedTargetWithTargetName:(NSString *)targetName; 41 | 42 | @end 43 | 44 | NS_ASSUME_NONNULL_END 45 | -------------------------------------------------------------------------------- /MediatorRouter/Mediator/CTMediator/CTMediator.m: -------------------------------------------------------------------------------- 1 | // 2 | // CTMediator.m 3 | // CTMediatorDemo 4 | // 5 | // Created by jiangxintong on 2018/10/23. 6 | // Copyright © 2018年 jiangxintong. All rights reserved. 7 | // 8 | 9 | #import "CTMediator.h" 10 | #import 11 | #import 12 | 13 | NSString * const kCTMediatorParamsKeySwiftTargetModuleName = @"kCTMediatorParamsKeySwiftTargetModuleName"; 14 | 15 | @interface CTMediator () 16 | 17 | @property (nonatomic, strong) NSMutableDictionary *cachedTarget; 18 | 19 | @end 20 | 21 | @implementation CTMediator 22 | 23 | #pragma mark - public methods 24 | + (instancetype)sharedInstance { 25 | static CTMediator *mediator; 26 | static dispatch_once_t onceToken; 27 | dispatch_once(&onceToken, ^{ 28 | mediator = [[CTMediator alloc] init]; 29 | }); 30 | return mediator; 31 | } 32 | 33 | /** 34 | * 远程App调用入口 35 | * @param url url接口 36 | * @param completion block回调 37 | */ 38 | //scheme://[target]/[action]?[params] 39 | //aaa://targetA/actionB?id=1234 40 | - (id)performActionWithUrl:(NSURL *)url completion:(void (^)(NSDictionary *))completion { 41 | 42 | NSMutableDictionary *params = [[NSMutableDictionary alloc] init]; 43 | 44 | NSString *urlString = [url query]; 45 | for (NSString *param in [urlString componentsSeparatedByString:@"&"]) { 46 | NSArray *elts = [param componentsSeparatedByString:@"="]; 47 | if([elts count] < 2) continue; 48 | [params setObject:[elts lastObject] forKey:[elts firstObject]]; 49 | } 50 | 51 | // 这里这么写主要是出于安全考虑,防止黑客通过远程方式调用本地模块,这里的做法足以应对绝大多数场景。如果要求更加严苛,也可以做更加复杂的安全逻辑。 52 | NSString *actionName = [url.path stringByReplacingOccurrencesOfString:@"/" withString:@""]; 53 | if ([actionName hasPrefix:@"native"]) { 54 | return @(NO); 55 | } 56 | 57 | // 这个demo针对URL的路由处理非常简单,就只是取对应的target名字和method名字,但这已经足以应对绝大部份需求。如果需要拓展,可以在这个方法调用之前加入完整的路由逻辑 58 | id result = [self performTarget:url.host action:actionName params:params shouldCacheTarget:NO]; 59 | if (completion) { 60 | if (result) { 61 | completion(@{@"result":result}); 62 | } else { 63 | completion(nil); 64 | } 65 | } 66 | return result; 67 | } 68 | 69 | /** 70 | * 本地组件调用入口 71 | * @param targetName 目标名字 72 | * @param actionName 方法名字 73 | * @param params 参数字典 74 | * @param shouldCacheTarget 是否缓存目标 75 | */ 76 | - (id)performTarget:(NSString *)targetName action:(NSString *)actionName params:(NSDictionary *)params shouldCacheTarget:(BOOL)shouldCacheTarget { 77 | // 1.通过targetName 获得target实例 78 | NSString *targetClassString = nil; 79 | // 如果当前模块语言为Swift语言 那么这里会取到内容 80 | NSString *swiftModuleName = params[kCTMediatorParamsKeySwiftTargetModuleName]; 81 | if (swiftModuleName.length > 0) { // 当前模块语言为Swift语言 82 | targetClassString = [NSString stringWithFormat:@"%@.Target_%@", swiftModuleName, targetName]; 83 | } else { 84 | targetClassString = [NSString stringWithFormat:@"Target_%@", targetName]; 85 | } 86 | NSLog(@"tt_targetClassString:%@", targetClassString); 87 | NSObject *target = self.cachedTarget[targetClassString]; // 先从缓存中获取target类字符串对应的target对象 88 | if (target == nil) { 89 | Class targetClass = NSClassFromString(targetClassString); // target类的字符串形式转换成target类 90 | target = [[targetClass alloc] init]; // 创建target类型的对象 91 | } 92 | 93 | // 2.通过actionName 获得action选择子 94 | NSString *actionString = [NSString stringWithFormat:@"Action_%@:", actionName]; 95 | NSLog(@"tt_actionString:%@", actionString); 96 | SEL action = NSSelectorFromString(actionString); 97 | 98 | /* 99 | 注意: 100 | 目标实例和方法选择子都是通过casa预先制定好的规范(根据事先规定 比如拼接字符串格式 从而命名文件或方法等)而获取 之后运用到个人项目时可以按照公司制定规范 101 | */ 102 | 103 | // 3.调用到目标业务提供的逻辑 104 | // 3.1 首先要确认是否有可以响应的target 105 | if (target == nil) { // target对象为nil 106 | // 这里是处理无响应请求的地方之一,这个demo做得比较简单,如果没有可以响应的target,就直接return了。 107 | // 实际开发过程中是可以事先给一个固定的target专门用于在这个时候顶上,然后处理这种请求的。 108 | [self NoTargetActionResponseWithTargetString:targetClassString selectorString:actionString originParams:params]; 109 | return nil; 110 | } 111 | 112 | // 是否需要缓存target 113 | if (shouldCacheTarget) { 114 | self.cachedTarget[targetClassString] = target; 115 | } 116 | 117 | // 3.2 target是否响应了action方法 118 | if ([target respondsToSelector:action]) { 119 | return [self safePerformAction:action target:target params:params]; 120 | } else { 121 | // 这里是处理无响应请求的地方,如果无响应,则尝试调用对应target的notFound方法统一处理 122 | SEL action = NSSelectorFromString(@"notFound:"); 123 | if ([target respondsToSelector:action]) { 124 | return [self safePerformAction:action target:target params:params]; 125 | } else { 126 | // 这里也是处理无响应请求的地方,在notFound都没有的时候,这个demo是直接return了。 127 | // 实际开发过程中,可以用前面提到的固定的target顶上的。 128 | [self NoTargetActionResponseWithTargetString:targetClassString selectorString:actionString originParams:params]; 129 | [self.cachedTarget removeObjectForKey:targetClassString]; // 移除缓存的target 130 | return nil; 131 | } 132 | } 133 | } 134 | 135 | /** 136 | * 释放已缓存的目标 通过目标名字 137 | * @param targetName 目标名字 138 | */ 139 | - (void)releaseCachedTargetWithTargetName:(NSString *)targetName { 140 | NSString *targetClassString = [NSString stringWithFormat:@"Target_%@", targetName]; 141 | [self.cachedTarget removeObjectForKey:targetClassString]; 142 | } 143 | 144 | #pragma mark - private methods 145 | /** 146 | * 没有响应的target或action的默认处理方式 - 可根据项目的实际情况来进行处理 147 | * @param targetString 目标类的字符串 148 | * @param selectorString 选择子的字符串描述 149 | * @param originParams 参数字典 150 | */ 151 | - (void)NoTargetActionResponseWithTargetString:(NSString *)targetString selectorString:(NSString *)selectorString originParams:(NSDictionary *)originParams { 152 | // 创建默认的action选择子 153 | SEL action = NSSelectorFromString(@"Action_response:"); 154 | // 初始化默认的target 155 | NSObject *target = [[NSClassFromString(@"Target_NoTargetAction") alloc] init]; 156 | // params保存待调用的入口信息 157 | NSMutableDictionary *params = [[NSMutableDictionary alloc] init]; 158 | params[@"targetString"] = targetString; 159 | params[@"selectorString"] = selectorString; 160 | params[@"originParams"] = originParams; 161 | 162 | [self safePerformAction:action target:target params:params]; 163 | } 164 | 165 | /** 166 | * 组件的调用 167 | * @param action 选择子 168 | * @param target 目标对象 169 | * @param params 参数字典 170 | */ 171 | - (id)safePerformAction:(SEL)action target:(NSObject *)target params:(NSDictionary *)params { 172 | // NSMethodSignature和NSInvocation是Foundation框架为我们提供的一种调用方法或者调用block的方式。 173 | // target对象调用action方法 174 | // 1.获取方法签名 175 | NSMethodSignature *methodSig = [target methodSignatureForSelector:action]; 176 | if (methodSig == nil) return nil; 177 | 178 | // 2.获得方法的返回值类型 179 | const char *retType = [methodSig methodReturnType]; 180 | 181 | // 3.针对不同的返回类型做处理 182 | if (strcmp(retType, @encode(void)) == 0) { // 如果返回类型为void 即没有返回值 183 | // 3.1 获取方法签名对应的invocation 184 | NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:methodSig]; 185 | // 3.2 设置消息接受者 186 | [invocation setTarget:target]; // 等价于[invocation setArgument:(__bridge void * _Nonnull)(target) atIndex:0]; 187 | // 3.3 设置要执行的selector 188 | [invocation setSelector:action]; // 等价于[invocation setArgument:action atIndex:1]; 189 | // 3.4 设置参数 190 | [invocation setArgument:¶ms atIndex:2]; 191 | // 3.5 开始执行 192 | [invocation invoke]; 193 | return nil; 194 | } 195 | 196 | if (strcmp(retType, @encode(NSInteger)) == 0) { // 如果返回类型为NSInteger 197 | NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:methodSig]; 198 | [invocation setTarget:target]; 199 | [invocation setSelector:action]; 200 | [invocation setArgument:¶ms atIndex:2]; 201 | [invocation invoke]; 202 | NSInteger result = 0; 203 | [invocation getReturnValue:&result]; 204 | return @(result); // 3.6 返回执行结果 205 | } 206 | 207 | if (strcmp(retType, @encode(BOOL)) == 0) { // 如果返回类型为BOOL 208 | NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:methodSig]; 209 | [invocation setTarget:target]; 210 | [invocation setSelector:action]; 211 | [invocation setArgument:¶ms atIndex:2]; 212 | [invocation invoke]; 213 | BOOL result = 0; 214 | [invocation getReturnValue:&result]; 215 | return @(result); 216 | } 217 | 218 | if (strcmp(retType, @encode(CGFloat)) == 0) { // 如果返回类型为CGFloat 219 | NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:methodSig]; 220 | [invocation setTarget:target]; 221 | [invocation setSelector:action]; 222 | [invocation setArgument:¶ms atIndex:2]; 223 | [invocation invoke]; 224 | CGFloat result = 0; 225 | [invocation getReturnValue:&result]; 226 | return @(result); 227 | } 228 | 229 | if (strcmp(retType, @encode(NSUInteger)) == 0) { // 如果返回类型为NSUInteger 230 | NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:methodSig]; 231 | [invocation setTarget:target]; 232 | [invocation setSelector:action]; 233 | [invocation setArgument:¶ms atIndex:2]; 234 | [invocation invoke]; 235 | NSUInteger result = 0; 236 | [invocation getReturnValue:&result]; 237 | return @(result); 238 | } 239 | 240 | #pragma clang diagnostic push 241 | #pragma clang diagnostic ignored "-Warc-performSelector-leaks" 242 | return [target performSelector:action withObject:params]; 243 | #pragma clang diagnostic pop 244 | } 245 | 246 | #pragma mark - getters and setters 247 | - (NSMutableDictionary *)cachedTarget { 248 | if (_cachedTarget == nil) { 249 | _cachedTarget = [[NSMutableDictionary alloc] init]; 250 | } 251 | return _cachedTarget; 252 | } 253 | 254 | @end 255 | -------------------------------------------------------------------------------- /MediatorRouter/Mediator/MediatorHome/MediatorMainViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // MediatorMainViewController.h 3 | // MediatorRouter 4 | // 5 | // Created by iCocos on 2018/11/7. 6 | // Copyright © 2018年 iCocos. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface MediatorMainViewController : UITabBarController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /MediatorRouter/Mediator/MediatorHome/MediatorMainViewController.m: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // MediatorMainViewController.m 4 | // MediatorRouter 5 | // 6 | // Created by iCocos on 2018/11/7. 7 | // Copyright © 2018年 iCocos. All rights reserved. 8 | // 9 | 10 | #import "MediatorMainViewController.h" 11 | #import "ViewController.h" 12 | 13 | #import "CTMediator+HomeExtension.h" 14 | #import "CTMediator+CategoryExtension.h" 15 | 16 | @interface MediatorMainViewController () 17 | 18 | @end 19 | 20 | @implementation MediatorMainViewController 21 | 22 | - (void)leftBarButtonItemAction { 23 | 24 | //将我们的storyBoard实例化,“Main”为StoryBoard的名称 25 | UIStoryboard *mainStoryBoard = [UIStoryboard storyboardWithName:@"Main" bundle:nil]; 26 | //将第二个控制器实例化,"SecondViewController"为我们设置的控制器的ID 27 | ViewController *vc = [mainStoryBoard instantiateViewControllerWithIdentifier:@"ViewController"]; 28 | 29 | UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:vc]; 30 | UIWindow *window = [[UIApplication sharedApplication] keyWindow]; 31 | window.rootViewController = nav; 32 | 33 | } 34 | 35 | - (void)viewDidLoad { 36 | [super viewDidLoad]; 37 | 38 | self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"返回" style:UIBarButtonItemStyleDone target:self action:@selector(leftBarButtonItemAction)]; 39 | 40 | [self addChildVC:[[CTMediator sharedInstance] getHomeVCWithTitle:@"首页1"] title:@"首页" image:@"tabbar_platform_normal" selectedImage:@"tabbar_platform_select"]; 41 | [self addChildVC:[[CTMediator sharedInstance] getCategoryVCWithTitle:@"分类1"] title:@"分类" image:@"tabbar_mine_normal" selectedImage:@"tabbar_mine_select"]; 42 | } 43 | 44 | - (void)addChildVC:(UIViewController *)vc title:(NSString *)title image:(NSString *)image selectedImage:(NSString *)selectedImage;{ 45 | UINavigationController * nav = [[UINavigationController alloc] initWithRootViewController:vc]; 46 | nav.tabBarItem.title = title; 47 | nav.tabBarItem.image = [[UIImage imageNamed:image] imageWithRenderingMode:(UIImageRenderingModeAlwaysOriginal)]; 48 | nav.tabBarItem.selectedImage = [[UIImage imageNamed:selectedImage] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]; 49 | [self addChildViewController:nav]; 50 | } 51 | 52 | @end 53 | -------------------------------------------------------------------------------- /MediatorRouter/Mediator/Models/Category/CTMediator+CategoryExtension.h: -------------------------------------------------------------------------------- 1 | // 2 | // CTMediator+CategoryExtension.h 3 | // MediatorRouter 4 | // 5 | // Created by iCocos on 2018/11/7. 6 | // Copyright © 2018年 iCocos. All rights reserved. 7 | // 8 | 9 | #import "CTMediator.h" 10 | 11 | @interface CTMediator (CategoryExtension) 12 | 13 | - (UIViewController *)getCategoryVCWithTitle:(NSString *)title; 14 | 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /MediatorRouter/Mediator/Models/Category/CTMediator+CategoryExtension.m: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // CTMediator+CategoryExtension.m 4 | // MediatorRouter 5 | // 6 | // Created by iCocos on 2018/11/7. 7 | // Copyright © 2018年 iCocos. All rights reserved. 8 | // 9 | 10 | #import "CTMediator+CategoryExtension.h" 11 | 12 | @implementation CTMediator (CategoryExtension) 13 | 14 | - (UIViewController *)getCategoryVCWithTitle:(NSString *)title; 15 | { 16 | NSMutableDictionary * dict = @{}.mutableCopy; 17 | [dict setValue:title forKey:@"title"]; 18 | return [self performTarget:@"MediatorCategoryViewController" action:@"MediatorCategoryViewController" params:dict shouldCacheTarget:NO]; 19 | } 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /MediatorRouter/Mediator/Models/Category/MediatorCategoryViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // MediatorCategoryViewController.h 3 | // MediatorRouter 4 | // 5 | // Created by iCocos on 2018/11/7. 6 | // Copyright © 2018年 iCocos. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface MediatorCategoryViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /MediatorRouter/Mediator/Models/Category/MediatorCategoryViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // MediatorCategoryViewController.m 3 | // MediatorRouter 4 | // 5 | // Created by iCocos on 2018/11/7. 6 | // Copyright © 2018年 iCocos. All rights reserved. 7 | // 8 | 9 | #import "MediatorCategoryViewController.h" 10 | 11 | #import "CTMediator+NextExtension.h" 12 | 13 | @interface MediatorCategoryViewController () 14 | 15 | @end 16 | 17 | @implementation MediatorCategoryViewController 18 | 19 | - (void)viewDidLoad { 20 | [super viewDidLoad]; 21 | self.view.backgroundColor = [UIColor whiteColor]; 22 | // Do any additional setup after loading the view. 23 | } 24 | 25 | - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { 26 | BOOL innerCallBack = YES; 27 | if (innerCallBack) { 28 | //1,本地调用 29 | [self.navigationController pushViewController: [[CTMediator sharedInstance] getNextVCWithTitle:@"next" block:^(NSString *name) { 30 | NSLog(@"---%@",name); 31 | }] animated:YES]; 32 | } else { 33 | //2,远程调用 34 | NSString * urlStr = @"App://MediatorCategoryViewController/MediatorCategoryViewController"; 35 | NSURL * url = [NSURL URLWithString:urlStr]; 36 | UIViewController * vc = [[CTMediator sharedInstance] performActionWithUrl:url completion:NULL]; 37 | [self.navigationController pushViewController:vc animated:YES]; 38 | } 39 | } 40 | 41 | 42 | 43 | @end 44 | -------------------------------------------------------------------------------- /MediatorRouter/Mediator/Models/Category/Next/CTMediator+NextExtension.h: -------------------------------------------------------------------------------- 1 | // 2 | // CTMediator+NextExtension.h 3 | // MediatorRouter 4 | // 5 | // Created by iCocos on 2018/11/7. 6 | // Copyright © 2018年 iCocos. All rights reserved. 7 | // 8 | 9 | #import "CTMediator.h" 10 | 11 | @interface CTMediator (NextExtension) 12 | 13 | - (UIViewController *)getNextVCWithTitle:(NSString *)title block:(void (^)(NSString *))block; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /MediatorRouter/Mediator/Models/Category/Next/CTMediator+NextExtension.m: -------------------------------------------------------------------------------- 1 | // 2 | // CTMediator+NextExtension.m 3 | // MediatorRouter 4 | // 5 | // Created by iCocos on 2018/11/7. 6 | // Copyright © 2018年 iCocos. All rights reserved. 7 | // 8 | 9 | #import "CTMediator+NextExtension.h" 10 | 11 | @implementation CTMediator (NextExtension) 12 | 13 | - (UIViewController *)getNextVCWithTitle:(NSString *)title block:(void (^)(NSString *))block; 14 | { 15 | NSMutableDictionary * dict = @{}.mutableCopy; 16 | [dict setValue:title forKey:@"title"]; 17 | [dict setValue:block forKey:@"block"]; 18 | return [self performTarget:@"MediatorNextViewController" action:@"MediatorNextViewController" params:dict shouldCacheTarget:NO]; 19 | } 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /MediatorRouter/Mediator/Models/Category/Next/MediatorNextViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // MediatorNextViewController.h 3 | // MediatorRouter 4 | // 5 | // Created by iCocos on 2018/11/7. 6 | // Copyright © 2018年 iCocos. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface MediatorNextViewController : UIViewController 12 | 13 | @property (nonatomic, copy) void(^ btnClickBlock)(NSString *); 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /MediatorRouter/Mediator/Models/Category/Next/MediatorNextViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // MediatorNextViewController.m 3 | // MediatorRouter 4 | // 5 | // Created by iCocos on 2018/11/7. 6 | // Copyright © 2018年 iCocos. All rights reserved. 7 | // 8 | 9 | #import "MediatorNextViewController.h" 10 | 11 | @implementation MediatorNextViewController 12 | 13 | - (void)viewDidLoad { 14 | [super viewDidLoad]; 15 | self.view.backgroundColor = [UIColor whiteColor]; 16 | // Do any additional setup after loading the view. 17 | 18 | UIButton *btn = [[UIButton alloc] initWithFrame:CGRectMake(100, 200, 200, 100)]; 19 | btn.backgroundColor = [UIColor yellowColor]; 20 | [btn addTarget:self action:@selector(blocked) forControlEvents:UIControlEventTouchUpInside]; 21 | [self.view addSubview:btn]; 22 | 23 | } 24 | 25 | 26 | - (void)blocked 27 | { 28 | if (self.btnClickBlock){ 29 | self.btnClickBlock(@"回调"); 30 | } 31 | [self.navigationController popViewControllerAnimated:YES]; 32 | } 33 | @end 34 | -------------------------------------------------------------------------------- /MediatorRouter/Mediator/Models/Category/Next/Target_MediatorNextViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // Target_MediatorNextService.h 3 | // MediatorRouter 4 | // 5 | // Created by iCocos on 2018/11/7. 6 | // Copyright © 2018年 iCocos. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface Target_MediatorNextViewController : NSObject 12 | 13 | - (UIViewController *)Action_MediatorNextViewController:(NSDictionary *)param; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /MediatorRouter/Mediator/Models/Category/Next/Target_MediatorNextViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // Target_MediatorNextService.m 3 | // MediatorRouter 4 | // 5 | // Created by iCocos on 2018/11/7. 6 | // Copyright © 2018年 iCocos. All rights reserved. 7 | // 8 | 9 | #import "Target_MediatorNextViewController.h" 10 | 11 | #import "MediatorNextViewController.h" 12 | 13 | @implementation Target_MediatorNextViewController 14 | 15 | - (UIViewController *)Action_MediatorNextViewController:(NSDictionary *)param; 16 | { 17 | MediatorNextViewController * vc = [[MediatorNextViewController alloc] init]; 18 | vc.navigationItem.title = param[@"title"]; 19 | void(^ clicked)(NSString *) = param[@"block"]; 20 | vc.btnClickBlock = clicked; 21 | return vc; 22 | } 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /MediatorRouter/Mediator/Models/Category/Target_MediatorCategoryViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // Target_MediatorCategoryService.h 3 | // MediatorRouter 4 | // 5 | // Created by iCocos on 2018/11/7. 6 | // Copyright © 2018年 iCocos. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface Target_MediatorCategoryViewController : NSObject 12 | 13 | - (UIViewController *)Action_MediatorCategoryViewController:(NSDictionary *)param; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /MediatorRouter/Mediator/Models/Category/Target_MediatorCategoryViewController.m: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // Target_MediatorCategoryService.m 4 | // MediatorRouter 5 | // 6 | // Created by iCocos on 2018/11/7. 7 | // Copyright © 2018年 iCocos. All rights reserved. 8 | // 9 | 10 | #import "Target_MediatorCategoryViewController.h" 11 | 12 | #import "MediatorCategoryViewController.h" 13 | 14 | @interface Target_MediatorCategoryViewController () 15 | 16 | @end 17 | 18 | @implementation Target_MediatorCategoryViewController 19 | 20 | - (UIViewController *)Action_MediatorCategoryViewController:(NSDictionary *)param; 21 | { 22 | 23 | MediatorCategoryViewController * vc = [[MediatorCategoryViewController alloc] init]; 24 | vc.navigationItem.title = param[@"title"]; 25 | return vc; 26 | 27 | } 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /MediatorRouter/Mediator/Models/Home/CTMediator+HomeExtension.h: -------------------------------------------------------------------------------- 1 | // 2 | // CTMediator+HomeExtension.h 3 | // MediatorRouter 4 | // 5 | // Created by iCocos on 2018/11/7. 6 | // Copyright © 2018年 iCocos. All rights reserved. 7 | // 8 | 9 | #import "CTMediator.h" 10 | 11 | @interface CTMediator (HomeExtension) 12 | 13 | - (UIViewController *)getHomeVCWithTitle:(NSString *)title; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /MediatorRouter/Mediator/Models/Home/CTMediator+HomeExtension.m: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // CTMediator+HomeExtension.m 4 | // MediatorRouter 5 | // 6 | // Created by iCocos on 2018/11/7. 7 | // Copyright © 2018年 iCocos. All rights reserved. 8 | // 9 | 10 | #import "CTMediator+HomeExtension.h" 11 | 12 | @implementation CTMediator (HomeExtension) 13 | 14 | - (UIViewController *)getHomeVCWithTitle:(NSString *)title; 15 | { 16 | NSMutableDictionary * dict = @{}.mutableCopy; 17 | [dict setValue:title forKey:@"title"]; 18 | return [self performTarget:@"MediatorHomeViewController" action:@"MediatorHomeViewController" params:dict shouldCacheTarget:NO]; 19 | } 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /MediatorRouter/Mediator/Models/Home/Detail/CTMediator+DetailExtension.h: -------------------------------------------------------------------------------- 1 | // 2 | // CTMediator+DetailExtension.h 3 | // MediatorRouter 4 | // 5 | // Created by iCocos on 2018/11/7. 6 | // Copyright © 2018年 iCocos. All rights reserved. 7 | // 8 | 9 | #import "CTMediator.h" 10 | 11 | @interface CTMediator (DetailExtension) 12 | 13 | - (UIViewController *)getDetailVCWithTitle:(NSString *)title name:(NSString *)name; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /MediatorRouter/Mediator/Models/Home/Detail/CTMediator+DetailExtension.m: -------------------------------------------------------------------------------- 1 | // 2 | // CTMediator+DetailExtension.m 3 | // MediatorRouter 4 | // 5 | // Created by iCocos on 2018/11/7. 6 | // Copyright © 2018年 iCocos. All rights reserved. 7 | // 8 | 9 | #import "CTMediator+DetailExtension.h" 10 | 11 | @implementation CTMediator (DetailExtension) 12 | 13 | - (UIViewController *)getDetailVCWithTitle:(NSString *)title name:(NSString *)name; 14 | { 15 | NSMutableDictionary * dict = @{}.mutableCopy; 16 | [dict setValue:name forKey:@"name"]; 17 | [dict setValue:title forKey:@"title"]; 18 | return [self performTarget:@"MediatorDetailViewController" action:@"MediatorDetailViewController" params:dict shouldCacheTarget:NO]; 19 | } 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /MediatorRouter/Mediator/Models/Home/Detail/MediatorDetailViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // MediatorDetailViewController.h 3 | // MediatorRouter 4 | // 5 | // Created by iCocos on 2018/11/7. 6 | // Copyright © 2018年 iCocos. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface MediatorDetailViewController : UIViewController 12 | 13 | @property (nonatomic, strong) NSString * name; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /MediatorRouter/Mediator/Models/Home/Detail/MediatorDetailViewController.m: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // MediatorDetailViewController.m 4 | // MediatorRouter 5 | // 6 | // Created by iCocos on 2018/11/7. 7 | // Copyright © 2018年 iCocos. All rights reserved. 8 | // 9 | 10 | #import "MediatorDetailViewController.h" 11 | 12 | @interface MediatorDetailViewController () 13 | 14 | @end 15 | 16 | @implementation MediatorDetailViewController 17 | 18 | - (void)viewDidLoad { 19 | [super viewDidLoad]; 20 | self.view.backgroundColor = [UIColor whiteColor]; 21 | NSLog(@"%@",self.name); 22 | } 23 | 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /MediatorRouter/Mediator/Models/Home/Detail/Target_MediatorDetailViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // Target_MediatorDetailService.h 3 | // MediatorRouter 4 | // 5 | // Created by iCocos on 2018/11/7. 6 | // Copyright © 2018年 iCocos. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface Target_MediatorDetailViewController : NSObject 12 | 13 | - (UIViewController *)Action_MediatorDetailViewController:(NSDictionary *)param; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /MediatorRouter/Mediator/Models/Home/Detail/Target_MediatorDetailViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // Target_MediatorDetailService.m 3 | // MediatorRouter 4 | // 5 | // Created by iCocos on 2018/11/7. 6 | // Copyright © 2018年 iCocos. All rights reserved. 7 | // 8 | 9 | #import "Target_MediatorDetailViewController.h" 10 | 11 | #import "MediatorDetailViewController.h" 12 | 13 | @interface Target_MediatorDetailViewController () 14 | 15 | @end 16 | 17 | @implementation Target_MediatorDetailViewController 18 | 19 | - (UIViewController *)Action_MediatorDetailViewController:(NSDictionary *)param; 20 | { 21 | MediatorDetailViewController * vc = [[MediatorDetailViewController alloc] init]; 22 | vc.name = param[@"name"]; 23 | vc.navigationItem.title = param[@"title"]; 24 | return vc; 25 | } 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /MediatorRouter/Mediator/Models/Home/MediatorHomeViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // MediatorHomeViewController.h 3 | // MediatorRouter 4 | // 5 | // Created by iCocos on 2018/11/7. 6 | // Copyright © 2018年 iCocos. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface MediatorHomeViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /MediatorRouter/Mediator/Models/Home/MediatorHomeViewController.m: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // MediatorHomeViewController.m 4 | // MediatorRouter 5 | // 6 | // Created by iCocos on 2018/11/7. 7 | // Copyright © 2018年 iCocos. All rights reserved. 8 | // 9 | 10 | #import "MediatorHomeViewController.h" 11 | 12 | #import "CTMediator+DetailExtension.h" 13 | 14 | @interface MediatorHomeViewController () 15 | 16 | @end 17 | 18 | @implementation MediatorHomeViewController 19 | 20 | - (void)viewDidLoad { 21 | [super viewDidLoad]; 22 | self.view.backgroundColor = [UIColor whiteColor]; 23 | // Do any additional setup after loading the view. 24 | } 25 | 26 | - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { 27 | BOOL innerCallBack = YES; 28 | if (innerCallBack) { 29 | //1,本地调用 30 | [self.navigationController pushViewController:[[CTMediator sharedInstance] getDetailVCWithTitle:@"详情" name:@"传值"] animated:YES]; 31 | } else { 32 | //ios : 区分安卓还是ios 33 | //teach: 教学中心,当模块之后,很难保证 多个模块里没有命名相同(url相同)的页面,所以加上一层判断, 34 | //productDetail : 商品详情页,如果其他的模块也有个商品详情页,所以前面加上模块名来区分。 35 | //App://home/productDetail?userId=xxx&studentId=xxx 36 | // NSString * urlStr = @"http://www.baid.com/ios/home/ProductDetail?userId=xxx&studentId=xxx"; 37 | //这个短链 38 | NSString * urlStr = @"App://MediatorHomeViewController/MediatorHomeViewController?Id=111"; 39 | NSURL * url = [NSURL URLWithString:[urlStr stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLFragmentAllowedCharacterSet]]]; 40 | 41 | NSString * query = [url query]; 42 | NSString * path = [url path]; 43 | NSDictionary * queryDict = [self zh_dictionaryWithParamString:query]; 44 | if ([path hasPrefix:@"/"]) { 45 | path = [path substringFromIndex:1]; 46 | } 47 | NSArray * paths = [path componentsSeparatedByString:@"/"]; 48 | NSLog(@"queryDict = %@",queryDict); 49 | NSLog(@"paths = %@",paths); 50 | 51 | //2,远程调用 52 | UIViewController * vc = [[CTMediator sharedInstance] performActionWithUrl:url completion:NULL]; 53 | [self.navigationController pushViewController:vc animated:YES]; 54 | } 55 | } 56 | 57 | - (NSDictionary *)zh_dictionaryWithParamString:(NSString *)zh_paramString { 58 | if (zh_paramString == nil || [zh_paramString isEqualToString:@""]) { 59 | return nil; 60 | } 61 | NSArray *arr = [zh_paramString componentsSeparatedByString:@"&"]; 62 | NSMutableDictionary *parameterDict = [NSMutableDictionary dictionary]; 63 | for (int i = 0; i < arr.count; i++) { 64 | NSArray *str = [arr[i] componentsSeparatedByString:@"="]; 65 | if (str.count == 2) { 66 | NSString *value = str[1]; 67 | value = [value stringByRemovingPercentEncoding]; 68 | [parameterDict setObject:value forKey:str[0]]; 69 | } 70 | else if (str.count > 2){ 71 | 72 | NSMutableString *appending = [[NSMutableString alloc] initWithCapacity:0]; 73 | for (NSUInteger j = str.count - 1; j == 1; j--) { 74 | [appending appendString:str[j]]; 75 | } 76 | 77 | NSString *value = [appending copy]; 78 | value = [value stringByRemovingPercentEncoding]; 79 | [parameterDict setObject:value forKey:str[0]]; 80 | } 81 | else { 82 | NSLog(@"没有等号的参数跳过"); 83 | } 84 | } 85 | return [parameterDict copy]; 86 | } 87 | 88 | @end 89 | -------------------------------------------------------------------------------- /MediatorRouter/Mediator/Models/Home/Target_MediatorHomeViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // Target_MediatorHomeService.h 3 | // MediatorRouter 4 | // 5 | // Created by iCocos on 2018/11/7. 6 | // Copyright © 2018年 iCocos. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface Target_MediatorHomeViewController : NSObject 12 | 13 | - (UIViewController *)Action_MediatorHomeViewController:(NSDictionary *)param; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /MediatorRouter/Mediator/Models/Home/Target_MediatorHomeViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // Target_MediatorHomeService.m 3 | // MediatorRouter 4 | // 5 | // Created by iCocos on 2018/11/7. 6 | // Copyright © 2018年 iCocos. All rights reserved. 7 | // 8 | 9 | #import "Target_MediatorHomeViewController.h" 10 | 11 | #import "MediatorHomeViewController.h" 12 | 13 | @interface Target_MediatorHomeViewController () 14 | 15 | @end 16 | 17 | @implementation Target_MediatorHomeViewController 18 | 19 | - (UIViewController *)Action_MediatorHomeViewController:(NSDictionary *)param; 20 | { 21 | MediatorHomeViewController * vc = [[MediatorHomeViewController alloc] init]; 22 | vc.navigationItem.title = param[@"title"]; 23 | return vc; 24 | } 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /MediatorRouter/Others/ModuleA/AViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // AViewController.h 3 | // CTMediatorDemo 4 | // 5 | // Created by jiangxintong on 2018/10/24. 6 | // Copyright © 2018年 jiangxintong. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface AViewController : UIViewController 14 | 15 | @end 16 | 17 | NS_ASSUME_NONNULL_END 18 | -------------------------------------------------------------------------------- /MediatorRouter/Others/ModuleA/AViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // AViewController.m 3 | // CTMediatorDemo 4 | // 5 | // Created by jiangxintong on 2018/10/24. 6 | // Copyright © 2018年 jiangxintong. All rights reserved. 7 | // 8 | 9 | #import "AViewController.h" 10 | 11 | @interface AViewController () 12 | 13 | @end 14 | 15 | @implementation AViewController 16 | 17 | - (void)viewDidLoad { 18 | [super viewDidLoad]; 19 | // Do any additional setup after loading the view. 20 | NSLog(@"AViewController"); 21 | self.view.backgroundColor = [UIColor redColor]; 22 | } 23 | 24 | /* 25 | #pragma mark - Navigation 26 | 27 | // In a storyboard-based application, you will often want to do a little preparation before navigation 28 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 29 | // Get the new view controller using [segue destinationViewController]. 30 | // Pass the selected object to the new view controller. 31 | } 32 | */ 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /MediatorRouter/Others/ModuleA/Target_ModuleA.h: -------------------------------------------------------------------------------- 1 | // 2 | // Target_ModuleA.h 3 | // CTMediatorDemo 4 | // 5 | // Created by jiangxintong on 2018/10/24. 6 | // Copyright © 2018年 jiangxintong. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | // NS_ASSUME_NONNULL_BEGIN和NS_ASSUME_NONNULL_END -> xcode 10.0创建文件时 会自动写这两个宏 14 | // 在这两个宏之间的代码 所有简单指针对象都被假定为nonnull 我们只需要去指定那些nullable的指针 15 | @interface Target_ModuleA : NSObject 16 | 17 | @end 18 | 19 | NS_ASSUME_NONNULL_END 20 | -------------------------------------------------------------------------------- /MediatorRouter/Others/ModuleA/Target_ModuleA.m: -------------------------------------------------------------------------------- 1 | // 2 | // Target_ModuleA.m 3 | // CTMediatorDemo 4 | // 5 | // Created by jiangxintong on 2018/10/24. 6 | // Copyright © 2018年 jiangxintong. All rights reserved. 7 | // 8 | 9 | #import "Target_ModuleA.h" 10 | #import "AViewController.h" 11 | 12 | @implementation Target_ModuleA 13 | 14 | - (UIViewController *)Action_Category_ViewController:(NSDictionary *)params { 15 | typedef void (^CallbackType)(NSString *); 16 | CallbackType callback = params[@"callback"]; 17 | if (callback) { 18 | callback(@"success"); 19 | } 20 | AViewController *viewController = [[AViewController alloc] init]; 21 | return viewController; 22 | } 23 | 24 | - (UIViewController *)Action_Extension_ViewController:(NSDictionary *)params { 25 | typedef void (^CallbackType)(NSString *); 26 | CallbackType callback = params[@"callback"]; 27 | if (callback) { 28 | callback(@"success"); 29 | } 30 | AViewController *viewController = [[AViewController alloc] init]; 31 | return viewController; 32 | } 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /MediatorRouter/Others/ModuleACategory/CTMediator+ModuleA.h: -------------------------------------------------------------------------------- 1 | // 2 | // CTMediator+ModuleA.h 3 | // CTMediatorDemo 4 | // 5 | // Created by jiangxintong on 2018/10/24. 6 | // Copyright © 2018年 jiangxintong. All rights reserved. 7 | // 8 | 9 | #import "CTMediator.h" 10 | #import 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | typedef void(^Callback)(NSString *result); 15 | 16 | @interface CTMediator (ModuleA) 17 | 18 | - (UIViewController *)ModuleA_Category_Objc_ViewControllerWithCallback:(Callback)callback; 19 | - (UIViewController *)ModuleA_Category_Swift_ViewControllerWithCallback:(Callback)callback; 20 | 21 | @end 22 | 23 | NS_ASSUME_NONNULL_END 24 | -------------------------------------------------------------------------------- /MediatorRouter/Others/ModuleACategory/CTMediator+ModuleA.m: -------------------------------------------------------------------------------- 1 | // 2 | // CTMediator+ModuleA.m 3 | // CTMediatorDemo 4 | // 5 | // Created by jiangxintong on 2018/10/24. 6 | // Copyright © 2018年 jiangxintong. All rights reserved. 7 | // 8 | 9 | #import "CTMediator+ModuleA.h" 10 | 11 | @implementation CTMediator (ModuleA) 12 | 13 | - (UIViewController *)ModuleA_Category_Objc_ViewControllerWithCallback:(Callback)callback { 14 | NSMutableDictionary *params = [[NSMutableDictionary alloc] init]; 15 | params[@"callback"] = callback; 16 | // 发起跨组件调用 17 | return [self performTarget:@"ModuleA" action:@"Category_ViewController" params:params shouldCacheTarget:NO]; 18 | } 19 | 20 | - (UIViewController *)ModuleA_Category_Swift_ViewControllerWithCallback:(Callback)callback { 21 | NSMutableDictionary *params = [[NSMutableDictionary alloc] init]; 22 | params[@"callback"] = callback; 23 | params[kCTMediatorParamsKeySwiftTargetModuleName] = @"ModuleA_swift"; 24 | return [self performTarget:@"ModuleA" action:@"Category_ViewController" params:params shouldCacheTarget:NO]; 25 | } 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /MediatorRouter/Others/ModuleB/BViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // BViewController.h 3 | // CTMediatorDemo 4 | // 5 | // Created by jiangxintong on 2018/10/26. 6 | // Copyright © 2018年 jiangxintong. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface BViewController : UIViewController 14 | 15 | @end 16 | 17 | NS_ASSUME_NONNULL_END 18 | -------------------------------------------------------------------------------- /MediatorRouter/Others/ModuleB/BViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // BViewController.m 3 | // CTMediatorDemo 4 | // 5 | // Created by jiangxintong on 2018/10/26. 6 | // Copyright © 2018年 jiangxintong. All rights reserved. 7 | // 8 | 9 | #import "BViewController.h" 10 | 11 | @interface BViewController () 12 | 13 | @end 14 | 15 | @implementation BViewController 16 | 17 | - (void)viewDidLoad { 18 | [super viewDidLoad]; 19 | // Do any additional setup after loading the view. 20 | NSLog(@"BViewController"); 21 | self.view.backgroundColor = [UIColor blueColor]; 22 | } 23 | 24 | /* 25 | #pragma mark - Navigation 26 | 27 | // In a storyboard-based application, you will often want to do a little preparation before navigation 28 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 29 | // Get the new view controller using [segue destinationViewController]. 30 | // Pass the selected object to the new view controller. 31 | } 32 | */ 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /MediatorRouter/Others/ModuleB/Target_ModuleB.h: -------------------------------------------------------------------------------- 1 | // 2 | // Target_ModuleB.h 3 | // CTMediatorDemo 4 | // 5 | // Created by jiangxintong on 2018/10/26. 6 | // Copyright © 2018年 jiangxintong. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface Target_ModuleB : NSObject 14 | 15 | @end 16 | 17 | NS_ASSUME_NONNULL_END 18 | -------------------------------------------------------------------------------- /MediatorRouter/Others/ModuleB/Target_ModuleB.m: -------------------------------------------------------------------------------- 1 | // 2 | // Target_ModuleB.m 3 | // CTMediatorDemo 4 | // 5 | // Created by jiangxintong on 2018/10/26. 6 | // Copyright © 2018年 jiangxintong. All rights reserved. 7 | // 8 | 9 | #import "Target_ModuleB.h" 10 | #import "BViewController.h" 11 | 12 | typedef void(^CallbackType)(NSString *result); 13 | 14 | @implementation Target_ModuleB 15 | 16 | - (UIViewController *)Action_Category_ViewController:(NSDictionary *)params { 17 | // typedef void (^CallbackType)(NSString *); 18 | CallbackType callback = params[@"callback"]; 19 | if (callback) { 20 | callback(@"success"); 21 | } 22 | BViewController *viewController = [[BViewController alloc] init]; 23 | return viewController; 24 | } 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /MediatorRouter/Others/ModuleBCategory/CTMediator+ModuleB.h: -------------------------------------------------------------------------------- 1 | // 2 | // CTMediator+ModuleB.h 3 | // CTMediatorDemo 4 | // 5 | // Created by jiangxintong on 2018/10/26. 6 | // Copyright © 2018年 jiangxintong. All rights reserved. 7 | // 8 | 9 | #import "CTMediator.h" 10 | #import 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | typedef void(^Callback)(NSString *result); 15 | 16 | @interface CTMediator (ModuleB) 17 | 18 | - (UIViewController *)ModuleB_Category_Objc_ViewControllerWithCallback:(Callback)callback; 19 | 20 | @end 21 | 22 | NS_ASSUME_NONNULL_END 23 | -------------------------------------------------------------------------------- /MediatorRouter/Others/ModuleBCategory/CTMediator+ModuleB.m: -------------------------------------------------------------------------------- 1 | // 2 | // CTMediator+ModuleB.m 3 | // CTMediatorDemo 4 | // 5 | // Created by jiangxintong on 2018/10/26. 6 | // Copyright © 2018年 jiangxintong. All rights reserved. 7 | // 8 | 9 | #import "CTMediator+ModuleB.h" 10 | 11 | @implementation CTMediator (ModuleB) 12 | 13 | - (UIViewController *)ModuleB_Category_Objc_ViewControllerWithCallback:(Callback)callback { 14 | NSMutableDictionary *params = [[NSMutableDictionary alloc] init]; 15 | params[@"callback"] = callback; 16 | return [self performTarget:@"ModuleB" action:@"Category_ViewController" params:params shouldCacheTarget:NO]; 17 | } 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /MediatorRouter/Others/SingleViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // CTMediatorDemo 4 | // 5 | // Created by jiangxintong on 2018/10/23. 6 | // Copyright © 2018年 jiangxintong. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface SingleViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /MediatorRouter/Others/SingleViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // CTMediatorDemo 4 | // 5 | // Created by jiangxintong on 2018/10/23. 6 | // Copyright © 2018年 jiangxintong. All rights reserved. 7 | // 8 | 9 | #import "SingleViewController.h" 10 | 11 | #import "CTMediator.h" 12 | #import "CTMediator+ModuleA.h" 13 | #import "CTMediator+ModuleB.h" 14 | 15 | //#import "CTMediator/CTMediator.h" 16 | //#import "ModuleA/CTMediator+ModuleA.h" 17 | //#import "ModuleB/CTMediator+ModuleB.h" 18 | 19 | @interface SingleViewController () 20 | 21 | @end 22 | 23 | @implementation SingleViewController 24 | 25 | - (void)viewDidLoad { 26 | [super viewDidLoad]; 27 | // Do any additional setup after loading the view, typically from a nib. 28 | NSLog(@"ViewController"); 29 | 30 | UIButton *button1 = [UIButton buttonWithType:(UIButtonTypeCustom)]; 31 | button1.frame = CGRectMake(100, 100, 100, 50); 32 | button1.backgroundColor = [UIColor orangeColor]; 33 | [button1 setTitleColor:[UIColor whiteColor] forState:(UIControlStateNormal)]; 34 | [button1 setTitle:@"进入模块A" forState:(UIControlStateNormal)]; 35 | [button1 addTarget:self action:@selector(button1Clicked:) forControlEvents:(UIControlEventTouchUpInside)]; 36 | [self.view addSubview:button1]; 37 | 38 | UIButton *button2 = [UIButton buttonWithType:(UIButtonTypeCustom)]; 39 | button2.frame = CGRectMake(100, 200, 100, 50); 40 | button2.backgroundColor = [UIColor orangeColor]; 41 | [button2 setTitleColor:[UIColor whiteColor] forState:(UIControlStateNormal)]; 42 | [button2 setTitle:@"进入模块B" forState:(UIControlStateNormal)]; 43 | [button2 addTarget:self action:@selector(button2Clicked:) forControlEvents:(UIControlEventTouchUpInside)]; 44 | [self.view addSubview:button2]; 45 | } 46 | 47 | - (void)button1Clicked:(UIButton *)button { 48 | UIViewController *aVC = [[CTMediator sharedInstance] ModuleA_Category_Objc_ViewControllerWithCallback:^(NSString *result) { 49 | NSLog(@"打开模块A入口VC:%@", result); 50 | }]; 51 | [self.navigationController pushViewController:aVC animated:YES]; 52 | } 53 | 54 | - (void)button2Clicked:(UIButton *)button { 55 | UIViewController *bVC = [[CTMediator sharedInstance] ModuleB_Category_Objc_ViewControllerWithCallback:^(NSString * _Nonnull result) { 56 | NSLog(@"打开模块B入口VC:%@", result); 57 | }]; 58 | [self.navigationController pushViewController:bVC animated:YES]; 59 | } 60 | 61 | @end 62 | -------------------------------------------------------------------------------- /MediatorRouter/Router/Common/CommonRouter.h: -------------------------------------------------------------------------------- 1 | // 2 | // CommonRouter.h 3 | // MediatorRouter 4 | // 5 | // Created by iCocos on 2018/11/7. 6 | // Copyright © 2018年 iCocos. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface CommonRouter : NSObject 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /MediatorRouter/Router/Common/CommonRouter.m: -------------------------------------------------------------------------------- 1 | // 2 | // CommonRouter.m 3 | // MediatorRouter 4 | // 5 | // Created by iCocos on 2018/11/7. 6 | // Copyright © 2018年 iCocos. All rights reserved. 7 | // 8 | 9 | #import "CommonRouter.h" 10 | 11 | #import "MGJRouter.h" 12 | 13 | #import "RouterHomeViewController.h" 14 | #import "RouterCategoryViewController.h" 15 | #import "RouterDetailViewController.h" 16 | #import "RouterNextViewController.h" 17 | 18 | @implementation CommonRouter 19 | 20 | + (void)load { 21 | 22 | [MGJRouter registerURLPattern:@"mgj://app/gethome" toObjectHandler:^id(NSDictionary *routerParameters) { 23 | NSString *title = routerParameters[MGJRouterParameterUserInfo][@"title"]; 24 | RouterHomeViewController *vc = [[RouterHomeViewController alloc] init]; 25 | vc.title = title; 26 | vc.navigationItem.title = title; 27 | return vc; 28 | }]; 29 | 30 | [MGJRouter registerURLPattern:@"mgj://app/getcategory" toObjectHandler:^id(NSDictionary *routerParameters) { 31 | NSString *title = routerParameters[MGJRouterParameterUserInfo][@"title"]; 32 | RouterCategoryViewController *vc = [[RouterCategoryViewController alloc] init]; 33 | vc.title = title; 34 | vc.navigationItem.title = title; 35 | return vc; 36 | }]; 37 | 38 | [MGJRouter registerURLPattern:@"mgj://app/godetail" toHandler:^(NSDictionary *routerParameters) { 39 | NSString *title = routerParameters[MGJRouterParameterUserInfo][@"title"]; 40 | UINavigationController *nav = routerParameters[MGJRouterParameterUserInfo][@"navigationVC"]; 41 | NSString *name = routerParameters[MGJRouterParameterUserInfo][@"name"]; 42 | RouterDetailViewController *vc = [[RouterDetailViewController alloc] init]; 43 | vc.title = title; 44 | vc.navigationItem.title = title; 45 | vc.name = name; 46 | vc.hidesBottomBarWhenPushed = YES; 47 | [nav pushViewController:vc animated:YES]; 48 | }]; 49 | 50 | [MGJRouter registerURLPattern:@"mgj://app/gonext" toHandler:^(NSDictionary *routerParameters) { 51 | NSString *title = routerParameters[MGJRouterParameterUserInfo][@"title"]; 52 | UINavigationController *nav = routerParameters[MGJRouterParameterUserInfo][@"navigationVC"]; 53 | void (^clicked)(NSString *) = routerParameters[MGJRouterParameterUserInfo][@"btnClickBlock"]; 54 | RouterNextViewController *vc = [[RouterNextViewController alloc] init]; 55 | vc.btnClickBlock = clicked; 56 | vc.title = title; 57 | vc.navigationItem.title = title; 58 | vc.hidesBottomBarWhenPushed = YES; 59 | [nav pushViewController:vc animated:YES]; 60 | }]; 61 | 62 | } 63 | 64 | @end 65 | -------------------------------------------------------------------------------- /MediatorRouter/Router/MGJRouter/MGJRouter.h: -------------------------------------------------------------------------------- 1 | // 2 | // MGJRouter.h 3 | // MGJFoundation 4 | // 5 | // Created by limboy on 12/9/14. 6 | // Copyright (c) 2014 juangua. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | extern NSString *const MGJRouterParameterURL; 12 | extern NSString *const MGJRouterParameterCompletion; 13 | extern NSString *const MGJRouterParameterUserInfo; 14 | 15 | /** 16 | * routerParameters 里内置的几个参数会用到上面定义的 string 17 | */ 18 | typedef void (^MGJRouterHandler)(NSDictionary *routerParameters); 19 | 20 | /** 21 | * 需要返回一个 object,配合 objectForURL: 使用 22 | */ 23 | typedef id (^MGJRouterObjectHandler)(NSDictionary *routerParameters); 24 | 25 | @interface MGJRouter : NSObject 26 | 27 | /** 28 | * 注册 URLPattern 对应的 Handler,在 handler 中可以初始化 VC,然后对 VC 做各种操作 29 | * 30 | * @param URLPattern 带上 scheme,如 mgj://beauty/:id 31 | * @param handler 该 block 会传一个字典,包含了注册的 URL 中对应的变量。 32 | * 假如注册的 URL 为 mgj://beauty/:id 那么,就会传一个 @{@"id": 4} 这样的字典过来 33 | */ 34 | + (void)registerURLPattern:(NSString *)URLPattern toHandler:(MGJRouterHandler)handler; 35 | 36 | /** 37 | * 注册 URLPattern 对应的 ObjectHandler,需要返回一个 object 给调用方 38 | * 39 | * @param URLPattern 带上 scheme,如 mgj://beauty/:id 40 | * @param handler 该 block 会传一个字典,包含了注册的 URL 中对应的变量。 41 | * 假如注册的 URL 为 mgj://beauty/:id 那么,就会传一个 @{@"id": 4} 这样的字典过来 42 | * 自带的 key 为 @"url" 和 @"completion" (如果有的话) 43 | */ 44 | + (void)registerURLPattern:(NSString *)URLPattern toObjectHandler:(MGJRouterObjectHandler)handler; 45 | 46 | /** 47 | * 取消注册某个 URL Pattern 48 | * 49 | * @param URLPattern URLPattern 50 | */ 51 | + (void)deregisterURLPattern:(NSString *)URLPattern; 52 | 53 | /** 54 | * 打开此 URL 55 | * 会在已注册的 URL -> Handler 中寻找,如果找到,则执行 Handler 56 | * 57 | * @param URL 带 Scheme,如 mgj://beauty/3 58 | */ 59 | + (void)openURL:(NSString *)URL; 60 | 61 | /** 62 | * 打开此 URL,同时当操作完成时,执行额外的代码 63 | * 64 | * @param URL 带 Scheme 的 URL,如 mgj://beauty/4 65 | * @param completion URL 处理完成后的 callback,完成的判定跟具体的业务相关 66 | */ 67 | + (void)openURL:(NSString *)URL completion:(void (^)(id result))completion; 68 | 69 | /** 70 | * 打开此 URL,带上附加信息,同时当操作完成时,执行额外的代码 71 | * 72 | * @param URL 带 Scheme 的 URL,如 mgj://beauty/4 73 | * @param userInfo 附加参数 74 | * @param completion URL 处理完成后的 callback,完成的判定跟具体的业务相关 75 | */ 76 | + (void)openURL:(NSString *)URL withUserInfo:(NSDictionary *)userInfo completion:(void (^)(id result))completion; 77 | 78 | /** 79 | * 查找谁对某个 URL 感兴趣,如果有的话,返回一个 object 80 | * 81 | * @param URL 带 Scheme,如 mgj://beauty/3 82 | */ 83 | + (id)objectForURL:(NSString *)URL; 84 | 85 | /** 86 | * 查找谁对某个 URL 感兴趣,如果有的话,返回一个 object 87 | * 88 | * @param URL 带 Scheme,如 mgj://beauty/3 89 | * @param userInfo 附加参数 90 | */ 91 | + (id)objectForURL:(NSString *)URL withUserInfo:(NSDictionary *)userInfo; 92 | 93 | /** 94 | * 是否可以打开URL 95 | * 96 | * @param URL 带 Scheme,如 mgj://beauty/3 97 | * 98 | * @return 返回BOOL值 99 | */ 100 | + (BOOL)canOpenURL:(NSString *)URL; 101 | + (BOOL)canOpenURL:(NSString *)URL matchExactly:(BOOL)exactly; 102 | 103 | /** 104 | * 调用此方法来拼接 urlpattern 和 parameters 105 | * 106 | * #define MGJ_ROUTE_BEAUTY @"beauty/:id" 107 | * [MGJRouter generateURLWithPattern:MGJ_ROUTE_BEAUTY, @[@13]]; 108 | * 109 | * 110 | * @param pattern url pattern 比如 @"beauty/:id" 111 | * @param parameters 一个数组,数量要跟 pattern 里的变量一致 112 | * 113 | * @return 返回生成的URL String 114 | */ 115 | + (NSString *)generateURLWithPattern:(NSString *)pattern parameters:(NSArray *)parameters; 116 | 117 | @end 118 | -------------------------------------------------------------------------------- /MediatorRouter/Router/MGJRouter/MGJRouter.m: -------------------------------------------------------------------------------- 1 | // 2 | // MGJRouter.m 3 | // MGJFoundation 4 | // 5 | // Created by limboy on 12/9/14. 6 | // Copyright (c) 2014 juangua. All rights reserved. 7 | // 8 | 9 | #import "MGJRouter.h" 10 | #import 11 | 12 | static NSString * const MGJ_ROUTER_WILDCARD_CHARACTER = @"~"; 13 | static NSString *specialCharacters = @"/?&."; 14 | 15 | NSString *const MGJRouterParameterURL = @"MGJRouterParameterURL"; 16 | NSString *const MGJRouterParameterCompletion = @"MGJRouterParameterCompletion"; 17 | NSString *const MGJRouterParameterUserInfo = @"MGJRouterParameterUserInfo"; 18 | 19 | @interface MGJRouter () 20 | 21 | /** 22 | * 保存了所有已注册的 URL 23 | * 结构类似 @{@"beauty": @{@":id": {@"_", [block copy]}}} 24 | */ 25 | @property (nonatomic) NSMutableDictionary *routes; 26 | 27 | @end 28 | 29 | @implementation MGJRouter 30 | 31 | + (instancetype)sharedInstance { 32 | static MGJRouter *instance = nil; 33 | static dispatch_once_t onceToken; 34 | dispatch_once(&onceToken, ^{ 35 | instance = [[self alloc] init]; 36 | }); 37 | return instance; 38 | } 39 | 40 | + (void)registerURLPattern:(NSString *)URLPattern toHandler:(MGJRouterHandler)handler { 41 | [[self sharedInstance] addURLPattern:URLPattern andHandler:handler]; 42 | } 43 | 44 | + (void)registerURLPattern:(NSString *)URLPattern toObjectHandler:(MGJRouterObjectHandler)handler { 45 | [[self sharedInstance] addURLPattern:URLPattern andObjectHandler:handler]; 46 | } 47 | 48 | + (void)deregisterURLPattern:(NSString *)URLPattern { 49 | [[self sharedInstance] removeURLPattern:URLPattern]; 50 | } 51 | 52 | + (void)openURL:(NSString *)URL { 53 | [self openURL:URL completion:nil]; 54 | } 55 | 56 | + (void)openURL:(NSString *)URL completion:(void (^)(id result))completion { 57 | [self openURL:URL withUserInfo:nil completion:completion]; 58 | } 59 | 60 | + (void)openURL:(NSString *)URL withUserInfo:(NSDictionary *)userInfo completion:(void (^)(id result))completion { 61 | URL = [URL stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; 62 | NSMutableDictionary *parameters = [[self sharedInstance] extractParametersFromURL:URL matchExactly:NO]; 63 | 64 | [parameters enumerateKeysAndObjectsUsingBlock:^(id key, NSString *obj, BOOL *stop) { 65 | if ([obj isKindOfClass:[NSString class]]) { 66 | parameters[key] = [obj stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; 67 | } 68 | }]; 69 | 70 | if (parameters) { 71 | MGJRouterHandler handler = parameters[@"block"]; 72 | if (completion) { 73 | parameters[MGJRouterParameterCompletion] = completion; 74 | } 75 | if (userInfo) { 76 | parameters[MGJRouterParameterUserInfo] = userInfo; 77 | } 78 | if (handler) { 79 | [parameters removeObjectForKey:@"block"]; 80 | handler(parameters); 81 | } 82 | } 83 | } 84 | 85 | + (BOOL)canOpenURL:(NSString *)URL { 86 | return [[self sharedInstance] extractParametersFromURL:URL matchExactly:NO] ? YES : NO; 87 | } 88 | 89 | + (BOOL)canOpenURL:(NSString *)URL matchExactly:(BOOL)exactly { 90 | return [[self sharedInstance] extractParametersFromURL:URL matchExactly:YES] ? YES : NO; 91 | } 92 | 93 | + (NSString *)generateURLWithPattern:(NSString *)pattern parameters:(NSArray *)parameters { 94 | NSInteger startIndexOfColon = 0; 95 | 96 | NSMutableArray *placeholders = [NSMutableArray array]; 97 | 98 | for (int i = 0; i < pattern.length; i++) { 99 | NSString *character = [NSString stringWithFormat:@"%c", [pattern characterAtIndex:i]]; 100 | if ([character isEqualToString:@":"]) { 101 | startIndexOfColon = i; 102 | } 103 | if ([specialCharacters rangeOfString:character].location != NSNotFound && i > (startIndexOfColon + 1) && startIndexOfColon) { 104 | NSRange range = NSMakeRange(startIndexOfColon, i - startIndexOfColon); 105 | NSString *placeholder = [pattern substringWithRange:range]; 106 | if (![self checkIfContainsSpecialCharacter:placeholder]) { 107 | [placeholders addObject:placeholder]; 108 | startIndexOfColon = 0; 109 | } 110 | } 111 | if (i == pattern.length - 1 && startIndexOfColon) { 112 | NSRange range = NSMakeRange(startIndexOfColon, i - startIndexOfColon + 1); 113 | NSString *placeholder = [pattern substringWithRange:range]; 114 | if (![self checkIfContainsSpecialCharacter:placeholder]) { 115 | [placeholders addObject:placeholder]; 116 | } 117 | } 118 | } 119 | 120 | __block NSString *parsedResult = pattern; 121 | 122 | [placeholders enumerateObjectsUsingBlock:^(NSString *obj, NSUInteger idx, BOOL * _Nonnull stop) { 123 | idx = parameters.count > idx ? idx : parameters.count - 1; 124 | parsedResult = [parsedResult stringByReplacingOccurrencesOfString:obj withString:parameters[idx]]; 125 | }]; 126 | 127 | return parsedResult; 128 | } 129 | 130 | + (id)objectForURL:(NSString *)URL withUserInfo:(NSDictionary *)userInfo { 131 | MGJRouter *router = [MGJRouter sharedInstance]; 132 | 133 | URL = [URL stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; 134 | NSMutableDictionary *parameters = [router extractParametersFromURL:URL matchExactly:NO]; 135 | MGJRouterObjectHandler handler = parameters[@"block"]; 136 | 137 | if (handler) { 138 | if (userInfo) { 139 | parameters[MGJRouterParameterUserInfo] = userInfo; 140 | } 141 | [parameters removeObjectForKey:@"block"]; 142 | return handler(parameters); 143 | } 144 | return nil; 145 | } 146 | 147 | + (id)objectForURL:(NSString *)URL { 148 | return [self objectForURL:URL withUserInfo:nil]; 149 | } 150 | 151 | - (void)addURLPattern:(NSString *)URLPattern andHandler:(MGJRouterHandler)handler { 152 | NSMutableDictionary *subRoutes = [self addURLPattern:URLPattern]; 153 | if (handler && subRoutes) { 154 | subRoutes[@"_"] = [handler copy]; 155 | } 156 | } 157 | 158 | - (void)addURLPattern:(NSString *)URLPattern andObjectHandler:(MGJRouterObjectHandler)handler { 159 | NSMutableDictionary *subRoutes = [self addURLPattern:URLPattern]; 160 | if (handler && subRoutes) { 161 | subRoutes[@"_"] = [handler copy]; 162 | } 163 | } 164 | 165 | - (NSMutableDictionary *)addURLPattern:(NSString *)URLPattern { 166 | NSArray *pathComponents = [self pathComponentsFromURL:URLPattern]; 167 | 168 | NSMutableDictionary* subRoutes = self.routes; 169 | 170 | for (NSString* pathComponent in pathComponents) { 171 | if (![subRoutes objectForKey:pathComponent]) { 172 | subRoutes[pathComponent] = [[NSMutableDictionary alloc] init]; 173 | } 174 | subRoutes = subRoutes[pathComponent]; 175 | } 176 | return subRoutes; 177 | } 178 | 179 | #pragma mark - Utils 180 | 181 | - (NSMutableDictionary *)extractParametersFromURL:(NSString *)url matchExactly:(BOOL)exactly { 182 | NSMutableDictionary* parameters = [NSMutableDictionary dictionary]; 183 | 184 | parameters[MGJRouterParameterURL] = url; 185 | 186 | NSMutableDictionary* subRoutes = self.routes; 187 | NSArray* pathComponents = [self pathComponentsFromURL:url]; 188 | 189 | BOOL found = NO; 190 | // borrowed from HHRouter(https://github.com/Huohua/HHRouter) 191 | for (NSString* pathComponent in pathComponents) { 192 | 193 | // 对 key 进行排序,这样可以把 ~ 放到最后 194 | NSArray *subRoutesKeys =[subRoutes.allKeys sortedArrayUsingComparator:^NSComparisonResult(NSString *obj1, NSString *obj2) { 195 | return [obj1 compare:obj2]; 196 | }]; 197 | 198 | for (NSString* key in subRoutesKeys) { 199 | if ([key isEqualToString:pathComponent] || [key isEqualToString:MGJ_ROUTER_WILDCARD_CHARACTER]) { 200 | found = YES; 201 | subRoutes = subRoutes[key]; 202 | break; 203 | } else if ([key hasPrefix:@":"]) { 204 | found = YES; 205 | subRoutes = subRoutes[key]; 206 | NSString *newKey = [key substringFromIndex:1]; 207 | NSString *newPathComponent = pathComponent; 208 | // 再做一下特殊处理,比如 :id.html -> :id 209 | if ([self.class checkIfContainsSpecialCharacter:key]) { 210 | NSCharacterSet *specialCharacterSet = [NSCharacterSet characterSetWithCharactersInString:specialCharacters]; 211 | NSRange range = [key rangeOfCharacterFromSet:specialCharacterSet]; 212 | if (range.location != NSNotFound) { 213 | // 把 pathComponent 后面的部分也去掉 214 | newKey = [newKey substringToIndex:range.location - 1]; 215 | NSString *suffixToStrip = [key substringFromIndex:range.location]; 216 | newPathComponent = [newPathComponent stringByReplacingOccurrencesOfString:suffixToStrip withString:@""]; 217 | } 218 | } 219 | parameters[newKey] = newPathComponent; 220 | break; 221 | } else if (exactly) { 222 | found = NO; 223 | } 224 | } 225 | 226 | // 如果没有找到该 pathComponent 对应的 handler,则以上一层的 handler 作为 fallback 227 | if (!found && !subRoutes[@"_"]) { 228 | return nil; 229 | } 230 | } 231 | 232 | // Extract Params From Query. 233 | NSArray *queryItems = [[NSURLComponents alloc] initWithURL:[[NSURL alloc] initWithString:url] resolvingAgainstBaseURL:false].queryItems; 234 | 235 | for (NSURLQueryItem *item in queryItems) { 236 | parameters[item.name] = item.value; 237 | } 238 | 239 | if (subRoutes[@"_"]) { 240 | parameters[@"block"] = [subRoutes[@"_"] copy]; 241 | } 242 | 243 | return parameters; 244 | } 245 | 246 | - (void)removeURLPattern:(NSString *)URLPattern { 247 | NSMutableArray *pathComponents = [NSMutableArray arrayWithArray:[self pathComponentsFromURL:URLPattern]]; 248 | 249 | // 只删除该 pattern 的最后一级 250 | if (pathComponents.count >= 1) { 251 | // 假如 URLPattern 为 a/b/c, components 就是 @"a.b.c" 正好可以作为 KVC 的 key 252 | NSString *components = [pathComponents componentsJoinedByString:@"."]; 253 | NSMutableDictionary *route = [self.routes valueForKeyPath:components]; 254 | 255 | if (route.count >= 1) { 256 | NSString *lastComponent = [pathComponents lastObject]; 257 | [pathComponents removeLastObject]; 258 | 259 | // 有可能是根 key,这样就是 self.routes 了 260 | route = self.routes; 261 | if (pathComponents.count) { 262 | NSString *componentsWithoutLast = [pathComponents componentsJoinedByString:@"."]; 263 | route = [self.routes valueForKeyPath:componentsWithoutLast]; 264 | } 265 | [route removeObjectForKey:lastComponent]; 266 | } 267 | } 268 | } 269 | 270 | - (NSArray*)pathComponentsFromURL:(NSString*)URL { 271 | NSMutableArray *pathComponents = [NSMutableArray array]; 272 | if ([URL rangeOfString:@"://"].location != NSNotFound) { 273 | NSArray *pathSegments = [URL componentsSeparatedByString:@"://"]; 274 | // 如果 URL 包含协议,那么把协议作为第一个元素放进去 275 | [pathComponents addObject:pathSegments[0]]; 276 | 277 | // 如果只有协议,那么放一个占位符 278 | URL = pathSegments.lastObject; 279 | if (!URL.length) { 280 | [pathComponents addObject:MGJ_ROUTER_WILDCARD_CHARACTER]; 281 | } 282 | } 283 | 284 | for (NSString *pathComponent in [[NSURL URLWithString:URL] pathComponents]) { 285 | if ([pathComponent isEqualToString:@"/"]) continue; 286 | if ([[pathComponent substringToIndex:1] isEqualToString:@"?"]) break; 287 | [pathComponents addObject:pathComponent]; 288 | } 289 | return [pathComponents copy]; 290 | } 291 | 292 | - (NSMutableDictionary *)routes { 293 | if (!_routes) { 294 | _routes = [[NSMutableDictionary alloc] init]; 295 | } 296 | return _routes; 297 | } 298 | 299 | #pragma mark - Utils 300 | 301 | + (BOOL)checkIfContainsSpecialCharacter:(NSString *)checkedString { 302 | NSCharacterSet *specialCharactersSet = [NSCharacterSet characterSetWithCharactersInString:specialCharacters]; 303 | return [checkedString rangeOfCharacterFromSet:specialCharactersSet].location != NSNotFound; 304 | } 305 | 306 | @end 307 | -------------------------------------------------------------------------------- /MediatorRouter/Router/Models/RouterCategoryViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // RouterCategoryViewController.h 3 | // MediatorRouter 4 | // 5 | // Created by iCocos on 2018/11/7. 6 | // Copyright © 2018年 iCocos. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface RouterCategoryViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /MediatorRouter/Router/Models/RouterCategoryViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // RouterCategoryViewController.m 3 | // MediatorRouter 4 | // 5 | // Created by iCocos on 2018/11/7. 6 | // Copyright © 2018年 iCocos. All rights reserved. 7 | // 8 | 9 | #import "RouterCategoryViewController.h" 10 | 11 | #import "MGJRouter.h" 12 | 13 | @interface RouterCategoryViewController () 14 | 15 | @end 16 | 17 | @implementation RouterCategoryViewController 18 | 19 | - (void)viewDidLoad { 20 | [super viewDidLoad]; 21 | self.view.backgroundColor = [UIColor whiteColor]; 22 | } 23 | 24 | - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { 25 | [MGJRouter openURL:@"mgj://app/gonext" withUserInfo:@{ 26 | @"title" : @"Next", 27 | @"navigationVC" : self.navigationController, 28 | @"btnClickBlock" : ^(NSString *title) { 29 | NSLog(@"---%@",title); 30 | } 31 | } completion:nil]; 32 | } 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /MediatorRouter/Router/Models/RouterDetailViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // RouterDetailViewController.h 3 | // MediatorRouter 4 | // 5 | // Created by iCocos on 2018/11/7. 6 | // Copyright © 2018年 iCocos. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface RouterDetailViewController : UIViewController 12 | 13 | @property (nonatomic, strong) NSString * name; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /MediatorRouter/Router/Models/RouterDetailViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // RouterDetailViewController.m 3 | // MediatorRouter 4 | // 5 | // Created by iCocos on 2018/11/7. 6 | // Copyright © 2018年 iCocos. All rights reserved. 7 | // 8 | 9 | #import "RouterDetailViewController.h" 10 | 11 | @interface RouterDetailViewController () 12 | 13 | @end 14 | 15 | @implementation RouterDetailViewController 16 | 17 | - (void)viewDidLoad { 18 | [super viewDidLoad]; 19 | self.view.backgroundColor = [UIColor whiteColor]; 20 | NSLog(@"%@",self.name); 21 | } 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /MediatorRouter/Router/Models/RouterHomeViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // RouterHomeViewController.h 3 | // MediatorRouter 4 | // 5 | // Created by iCocos on 2018/11/7. 6 | // Copyright © 2018年 iCocos. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface RouterHomeViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /MediatorRouter/Router/Models/RouterHomeViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // RouterHomeViewController.m 3 | // MediatorRouter 4 | // 5 | // Created by iCocos on 2018/11/7. 6 | // Copyright © 2018年 iCocos. All rights reserved. 7 | // 8 | 9 | #import "RouterHomeViewController.h" 10 | 11 | #import "MGJRouter.h" 12 | 13 | @interface RouterHomeViewController () 14 | 15 | @end 16 | 17 | @implementation RouterHomeViewController 18 | 19 | - (void)viewDidLoad { 20 | [super viewDidLoad]; 21 | self.view.backgroundColor = [UIColor whiteColor]; 22 | } 23 | 24 | - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { 25 | [MGJRouter openURL:@"mgj://app/godetail" withUserInfo:@{ 26 | @"title" : @"详情", 27 | @"navigationVC" : self.navigationController, 28 | @"name" : @"传值" 29 | } completion:nil]; 30 | } 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /MediatorRouter/Router/Models/RouterNextViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // RouterNextViewController.h 3 | // MediatorRouter 4 | // 5 | // Created by iCocos on 2018/11/7. 6 | // Copyright © 2018年 iCocos. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface RouterNextViewController : UIViewController 12 | 13 | @property (nonatomic, copy) void(^ btnClickBlock)(NSString *); 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /MediatorRouter/Router/Models/RouterNextViewController.m: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // RouterNextViewController.m 4 | // MediatorRouter 5 | // 6 | // Created by iCocos on 2018/11/7. 7 | // Copyright © 2018年 iCocos. All rights reserved. 8 | // 9 | 10 | #import "RouterNextViewController.h" 11 | 12 | @interface RouterNextViewController () 13 | 14 | @end 15 | 16 | @implementation RouterNextViewController 17 | 18 | - (void)viewDidLoad { 19 | [super viewDidLoad]; 20 | self.view.backgroundColor = [UIColor whiteColor]; 21 | 22 | UIButton *btn = [[UIButton alloc] initWithFrame:CGRectMake(100, 200, 200, 100)]; 23 | btn.backgroundColor = [UIColor yellowColor]; 24 | [btn addTarget:self action:@selector(blocked) forControlEvents:UIControlEventTouchUpInside]; 25 | [self.view addSubview:btn]; 26 | } 27 | 28 | - (void)blocked { 29 | if (self.btnClickBlock){ 30 | self.btnClickBlock(@"回调"); 31 | } 32 | [self.navigationController popViewControllerAnimated:YES]; 33 | } 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /MediatorRouter/Router/RootHome/RouterMainViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // RouterHomeViewController.h 3 | // MediatorRouter 4 | // 5 | // Created by iCocos on 2018/11/7. 6 | // Copyright © 2018年 iCocos. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface RouterMainViewController : UITabBarController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /MediatorRouter/Router/RootHome/RouterMainViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // RouterHomeViewController.m 3 | // MediatorRouter 4 | // 5 | // Created by iCocos on 2018/11/7. 6 | // Copyright © 2018年 iCocos. All rights reserved. 7 | // 8 | 9 | #import "RouterMainViewController.h" 10 | #import "ViewController.h" 11 | 12 | #import "MGJRouter.h" 13 | 14 | @interface RouterMainViewController () 15 | 16 | @end 17 | 18 | @implementation RouterMainViewController 19 | 20 | - (void)leftBarButtonItemAction { 21 | 22 | //将我们的storyBoard实例化,“Main”为StoryBoard的名称 23 | UIStoryboard *mainStoryBoard = [UIStoryboard storyboardWithName:@"Main" bundle:nil]; 24 | //将第二个控制器实例化,"SecondViewController"为我们设置的控制器的ID 25 | ViewController *vc = [mainStoryBoard instantiateViewControllerWithIdentifier:@"ViewController"]; 26 | 27 | UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:vc]; 28 | UIWindow *window = [[UIApplication sharedApplication] keyWindow]; 29 | window.rootViewController = nav; 30 | 31 | } 32 | 33 | - (void)viewDidLoad { 34 | [super viewDidLoad]; 35 | 36 | self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"返回" style:UIBarButtonItemStyleDone target:self action:@selector(leftBarButtonItemAction)]; 37 | 38 | [self addChildVC:[MGJRouter objectForURL:@"mgj://app/gethome" withUserInfo:@{@"title":@"首页标题参数"}] title:@"首页" image:@"tabbar_platform_normal" selectedImage:@"tabbar_platform_select"]; 39 | [self addChildVC:[MGJRouter objectForURL:@"mgj://app/getcategory" withUserInfo:@{@"title":@"分类标题参数"}] title:@"分类" image:@"tabbar_mine_normal" selectedImage:@"tabbar_mine_select"]; 40 | } 41 | 42 | - (void)addChildVC:(UIViewController *)vc title:(NSString *)title image:(NSString *)image selectedImage:(NSString *)selectedImage;{ 43 | UINavigationController * nav = [[UINavigationController alloc] initWithRootViewController:vc]; 44 | nav.tabBarItem.title = title; 45 | nav.tabBarItem.image = [[UIImage imageNamed:image] imageWithRenderingMode:(UIImageRenderingModeAlwaysOriginal)]; 46 | nav.tabBarItem.selectedImage = [[UIImage imageNamed:selectedImage] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]; 47 | [self addChildViewController:nav]; 48 | } 49 | 50 | @end 51 | -------------------------------------------------------------------------------- /MediatorRouter/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // MediatorRouter 4 | // 5 | // Created by iCocos on 2018/11/7. 6 | // Copyright © 2018年 iCocos. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /MediatorRouter/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // MediatorRouter 4 | // 5 | // Created by iCocos on 2018/11/7. 6 | // Copyright © 2018年 iCocos. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | 11 | #import "RouterMainViewController.h" 12 | #import "MediatorMainViewController.h" 13 | 14 | @interface ViewController () 15 | 16 | @end 17 | 18 | @implementation ViewController 19 | 20 | - (void)viewDidLoad { 21 | [super viewDidLoad]; 22 | // Do any additional setup after loading the view, typically from a nib. 23 | } 24 | 25 | - (IBAction)MediatorButtonAction:(id)sender { 26 | MediatorMainViewController * tabVC = [[MediatorMainViewController alloc] init]; 27 | UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:tabVC]; 28 | UIWindow *window = [[UIApplication sharedApplication] keyWindow]; 29 | window.rootViewController = nav; 30 | } 31 | 32 | - (IBAction)RouterButtonAction:(id)sender { 33 | RouterMainViewController * tabVC = [[RouterMainViewController alloc] init]; 34 | UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:tabVC]; 35 | UIWindow *window = [[UIApplication sharedApplication] keyWindow]; 36 | window.rootViewController = nav; 37 | } 38 | 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /MediatorRouter/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // MediatorRouter 4 | // 5 | // Created by iCocos on 2018/11/7. 6 | // Copyright © 2018年 iCocos. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # MediatorAndRouter 2 | App架构之组件化策略,MGJRouter(URLRouter) 和 CTMediator(Target-Action),实战与项目介入,相关细节实现 3 | 4 | ## 强烈推荐: 5 | 6 | ##### iOS组件化方案对比 https://blog.csdn.net/mlcldh/article/details/82887997?from=timeline&isappinstalled=0 7 | 8 | ##### 蘑菇街 App 的组件化之路 https://limboy.me/tech/2016/03/14/mgj-components-continued.html 9 | 10 | ##### iOS应用架构谈 组件化方案 https://casatwy.com/iOS-Modulization.html 11 | 12 | 13 | ## 组件化/模块化 14 | 15 | 16 | ### 1. 博客文章: 17 | 18 | 19 | + [[模块化与解耦](模块化与解耦 - 刘坤的技术博客)](https://blog.cnbluebox.com/blog/2015/11/28/module-and-decoupling/) 20 | 21 | 22 | + [[浅析 iOS 应用组件化设计](Skyline75489)](https://skyline75489.github.io/post/2016-3-16_ios_module_design.html) 23 | 24 | 25 | + [[iOS组件化思路-大神博客研读和思考](iOS组件化思路-大神博客研读和思考 - 简书)](https://www.jianshu.com/p/afb9b52143d4) 26 | 27 | 28 | + [[iOS组件化实践方案-LDBusMediator练就](iOS组件化实践方案-LDBusMediator炼就 - 简书)](https://www.jianshu.com/p/196f66d31543) 29 | 30 | 31 | + [[iOS组件化方案探索](iOS 组件化方案探索 « bang’s blog)](http://blog.cnbang.net/tech/3080/) 32 | 33 | 34 | + [[IOS-组件化架构漫谈](组件化架构漫谈 - 简书)](https://www.jianshu.com/p/67a6004f6930) 35 | 36 | 37 | + [[一个iOS模块化开发解决方案](一个iOS模块化开发解决方案 - CocoaChina_让移动开发更简单)](http://www.cocoachina.com/ios/20161103/17932.html) 38 | 39 | 40 | ### 2. 知名APP组件化方案 41 | 42 | 43 | + [[豆瓣App的模块化实践](豆瓣App的模块化实践 - CocoaChina_让移动开发更简单)](http://www.cocoachina.com/ios/20161103/17938.html) 44 | 45 | 46 | + [[手机天猫解耦之路](手机天猫解耦之路)](http://www.infoq.com/cn/articles/the-road-of-mobile-tmall-decoupling) 47 | 48 | 49 | + [[京东iOS客户端组件管理实践](京东iOS客户端组件管理实践)](http://www.infoq.com/cn/articles/jd-ios-component-management) 50 | 51 | 52 | + [[滴滴出行iOS客户端架构演进之路](滴滴出行)](https://mp.weixin.qq.com/s?__biz=MzUxMzcxMzE5Ng==&mid=2247488503&idx=1&sn=2c9a82593ebb06533f484f77035c4550&source=41#wechat_redirect) 53 | 54 | 55 | + [[蘑菇街 App 的组件化之路](蘑菇街APP组件化1) 推荐,讲的比较全面](https://limboy.me/tech/2016/03/10/mgj-components.html) 56 | 57 | 58 | + [[蘑菇街 App 的组件化之路·续](蘑菇街APP组件化2) 推荐,讲的比较全面](https://limboy.me/tech/2016/03/14/mgj-components-continued.html) 59 | 60 | 61 | + [[手机淘宝客户端架构探索实践](手机淘宝客户端架构探索实践-博客-云栖社区-阿里云 )](https://yq.aliyun.com/articles/129) 62 | 63 | 64 | + [[支付宝钱包客户端技术架构](支付宝钱包客户端技术架构-博客-云栖社区-阿里云 )](https://yq.aliyun.com/articles/128?spm=a2c4e.11153940.blogcont129.7.25f513ddyqFUKb) 65 | 66 | 67 | ### 3. 组件化实践 68 | 69 | 70 | + [[iOS组件化实践](组件化实践)](http://www.cocoachina.com/ios/20171120/21234.html) 71 | 72 | 73 | + [[谈谈我的理解-组件化/模块化](组件化/模块化)](https://www.jianshu.com/p/79e4df63f31f) 74 | 75 | 76 | + [[iOS组件化实践(一):简介](iOS组件化实践(一):简介 - 简书)](https://www.jianshu.com/p/568e875abd48) 77 | 78 | 79 | + [[iOS组件化实践(二):准备](iOS组件化实践(二):准备 - 简书)](https://www.jianshu.com/p/824d4227e123) 80 | 81 | 82 | + [[iOS组件化实践(一):简介](iOS组件化实践(一):简介 - 简书)](https://www.jianshu.com/p/568e875abd48) 83 | 84 | 85 | ### 4. 最后推荐几篇好的架构文章 86 | 87 | 88 | + [[iOS应用架构谈 开篇](iOS应用架构谈 开篇 - Casa Taloyum)](https://casatwy.com/iosying-yong-jia-gou-tan-kai-pian.html) 89 | 90 | 91 | + [[iOS应用架构谈 view层的组织和调用方案](iOS应用架构谈 view层的组织和调用方案 - Casa Taloyum)](https://casatwy.com/iosying-yong-jia-gou-tan-viewceng-de-zu-zhi-he-diao-yong-fang-an.html) 92 | 93 | 94 | + [[iOS应用架构谈 网络层设计方案](iOS应用架构谈 网络层设计方案 - Casa Taloyum)](https://casatwy.com/iosying-yong-jia-gou-tan-wang-luo-ceng-she-ji-fang-an.html) 95 | 96 | 97 | + [[iOS应用架构谈 本地持久化方案及动态部署](iOS应用架构谈 本地持久化方案及动态部署 - Casa Taloyum)](https://casatwy.com/iosying-yong-jia-gou-tan-ben-di-chi-jiu-hua-fang-an-ji-dong-tai-bu-shu.html) 98 | 99 | 100 | + [[iOS应用架构谈 组件化方案](组件化方案)](https://casatwy.com/iOS-Modulization.html) 101 | --------------------------------------------------------------------------------