├── .gitignore ├── .travis.yml ├── FRDModuleManager.podspec ├── FRDModuleManager.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ └── contents.xcworkspacedata └── xcshareddata │ └── xcschemes │ ├── FRDModuleManager.xcscheme │ └── FRDModuleManagerTests.xcscheme ├── FRDModuleManager ├── Info.plist └── Source │ ├── FRDModuleManager.h │ └── FRDModuleManager.m ├── FRDModuleManagerDemo ├── AppDelegate.h ├── AppDelegate.m ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── FRDGroupModule.h ├── FRDGroupModule.m ├── FRDTimelineModule.h ├── FRDTimelineModule.m ├── Info.plist ├── ModulesRegister.plist ├── ViewController.h ├── ViewController.m └── main.m ├── FRDModuleManagerTests ├── FRDModuleManagerTests.m ├── Info.plist ├── TestModule.h ├── TestModule.m └── TestModulesRegister.plist ├── LICENSE └── 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 | *.xcuserstate 23 | 24 | .DS_Store 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://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md 52 | 53 | fastlane/report.xml 54 | fastlane/screenshots 55 | 56 | #Code Injection 57 | # 58 | # After new code Injection tools there's a generated folder /iOSInjectionProject 59 | # https://github.com/johnno1962/injectionforxcode 60 | 61 | iOSInjectionProject/ 62 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | osx_image: xcode9.1 2 | language: objective-c 3 | script: 4 | - | 5 | xcodebuild test \ 6 | -project FRDModuleManager.xcodeproj \ 7 | -scheme FRDModuleManagerTests \ 8 | -destination 'platform=iOS Simulator,name=iPhone 7' 9 | -------------------------------------------------------------------------------- /FRDModuleManager.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | 3 | s.name = "FRDModuleManager" 4 | s.version = "0.1.0" 5 | s.summary = "FRDModuleManager can organise modules easily used by UIApplicationDelegate" 6 | s.description = "FRDModuleManager can organise modules easily in AppDelegate." 7 | s.homepage = "https://github.com/lincode/FRDModuleManager" 8 | s.license = { :type => 'MIT', :text => 'LICENSE' } 9 | s.author = { "lincode" => "guolin@douban.com" } 10 | 11 | s.platform = :ios, "7.0" 12 | s.source = { :git => "https://github.com/lincode/FRDModuleManager.git", 13 | :tag => "#{s.version}" } 14 | 15 | s.source_files = "FRDModuleManager/Source/**/*.{h,m}" 16 | s.frameworks = "UIKit" 17 | s.requires_arc = true 18 | 19 | end 20 | -------------------------------------------------------------------------------- /FRDModuleManager.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | A330D9D41DA64D9500BAB863 /* TestModulesRegister.plist in Resources */ = {isa = PBXBuildFile; fileRef = A330D9D31DA64D9500BAB863 /* TestModulesRegister.plist */; }; 11 | A330D9D71DA64DAE00BAB863 /* TestModule.m in Sources */ = {isa = PBXBuildFile; fileRef = A330D9D61DA64DAE00BAB863 /* TestModule.m */; }; 12 | A3372D771D9D010E006A97A1 /* FRDModuleManager.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A3372D6D1D9D010E006A97A1 /* FRDModuleManager.framework */; }; 13 | A3372D7C1D9D010E006A97A1 /* FRDModuleManagerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = A3372D7B1D9D010E006A97A1 /* FRDModuleManagerTests.m */; }; 14 | A3372D8F1D9D019F006A97A1 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = A3372D8E1D9D019F006A97A1 /* main.m */; }; 15 | A3372D921D9D019F006A97A1 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = A3372D911D9D019F006A97A1 /* AppDelegate.m */; }; 16 | A3372D951D9D019F006A97A1 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = A3372D941D9D019F006A97A1 /* ViewController.m */; }; 17 | A3372D981D9D019F006A97A1 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A3372D961D9D019F006A97A1 /* Main.storyboard */; }; 18 | A3372D9A1D9D019F006A97A1 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A3372D991D9D019F006A97A1 /* Assets.xcassets */; }; 19 | A3372D9D1D9D019F006A97A1 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A3372D9B1D9D019F006A97A1 /* LaunchScreen.storyboard */; }; 20 | A3372DAB1D9D02A3006A97A1 /* FRDModuleManager.h in Headers */ = {isa = PBXBuildFile; fileRef = A3372DA91D9D02A3006A97A1 /* FRDModuleManager.h */; settings = {ATTRIBUTES = (Public, ); }; }; 21 | A3372DAC1D9D02A3006A97A1 /* FRDModuleManager.m in Sources */ = {isa = PBXBuildFile; fileRef = A3372DAA1D9D02A3006A97A1 /* FRDModuleManager.m */; }; 22 | A3372DAF1D9D0CF1006A97A1 /* FRDTimelineModule.m in Sources */ = {isa = PBXBuildFile; fileRef = A3372DAE1D9D0CF1006A97A1 /* FRDTimelineModule.m */; }; 23 | A3372DB11D9D0FA8006A97A1 /* ModulesRegister.plist in Resources */ = {isa = PBXBuildFile; fileRef = A3372DB01D9D0FA8006A97A1 /* ModulesRegister.plist */; }; 24 | A3372DB41D9D0FD7006A97A1 /* FRDGroupModule.m in Sources */ = {isa = PBXBuildFile; fileRef = A3372DB31D9D0FD7006A97A1 /* FRDGroupModule.m */; }; 25 | A3372DB71D9D1222006A97A1 /* FRDModuleManager.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A3372D6D1D9D010E006A97A1 /* FRDModuleManager.framework */; }; 26 | /* End PBXBuildFile section */ 27 | 28 | /* Begin PBXContainerItemProxy section */ 29 | A3372D781D9D010E006A97A1 /* PBXContainerItemProxy */ = { 30 | isa = PBXContainerItemProxy; 31 | containerPortal = A3372D641D9D010E006A97A1 /* Project object */; 32 | proxyType = 1; 33 | remoteGlobalIDString = A3372D6C1D9D010E006A97A1; 34 | remoteInfo = FRDModuleManager; 35 | }; 36 | A3372DB51D9D1212006A97A1 /* PBXContainerItemProxy */ = { 37 | isa = PBXContainerItemProxy; 38 | containerPortal = A3372D641D9D010E006A97A1 /* Project object */; 39 | proxyType = 1; 40 | remoteGlobalIDString = A3372D6C1D9D010E006A97A1; 41 | remoteInfo = FRDModuleManager; 42 | }; 43 | /* End PBXContainerItemProxy section */ 44 | 45 | /* Begin PBXFileReference section */ 46 | A330D9D31DA64D9500BAB863 /* TestModulesRegister.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = TestModulesRegister.plist; sourceTree = ""; }; 47 | A330D9D51DA64DAE00BAB863 /* TestModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestModule.h; sourceTree = ""; }; 48 | A330D9D61DA64DAE00BAB863 /* TestModule.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TestModule.m; sourceTree = ""; }; 49 | A3372D6D1D9D010E006A97A1 /* FRDModuleManager.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = FRDModuleManager.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 50 | A3372D711D9D010E006A97A1 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 51 | A3372D761D9D010E006A97A1 /* FRDModuleManagerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = FRDModuleManagerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 52 | A3372D7B1D9D010E006A97A1 /* FRDModuleManagerTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FRDModuleManagerTests.m; sourceTree = ""; }; 53 | A3372D7D1D9D010E006A97A1 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 54 | A3372D8B1D9D019F006A97A1 /* FRDModuleManagerDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = FRDModuleManagerDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 55 | A3372D8E1D9D019F006A97A1 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 56 | A3372D901D9D019F006A97A1 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 57 | A3372D911D9D019F006A97A1 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 58 | A3372D931D9D019F006A97A1 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 59 | A3372D941D9D019F006A97A1 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 60 | A3372D971D9D019F006A97A1 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 61 | A3372D991D9D019F006A97A1 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 62 | A3372D9C1D9D019F006A97A1 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 63 | A3372D9E1D9D019F006A97A1 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 64 | A3372DA91D9D02A3006A97A1 /* FRDModuleManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FRDModuleManager.h; sourceTree = ""; }; 65 | A3372DAA1D9D02A3006A97A1 /* FRDModuleManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FRDModuleManager.m; sourceTree = ""; }; 66 | A3372DAD1D9D0CF1006A97A1 /* FRDTimelineModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FRDTimelineModule.h; sourceTree = ""; }; 67 | A3372DAE1D9D0CF1006A97A1 /* FRDTimelineModule.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FRDTimelineModule.m; sourceTree = ""; }; 68 | A3372DB01D9D0FA8006A97A1 /* ModulesRegister.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = ModulesRegister.plist; sourceTree = ""; }; 69 | A3372DB21D9D0FD7006A97A1 /* FRDGroupModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FRDGroupModule.h; sourceTree = ""; }; 70 | A3372DB31D9D0FD7006A97A1 /* FRDGroupModule.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FRDGroupModule.m; sourceTree = ""; }; 71 | /* End PBXFileReference section */ 72 | 73 | /* Begin PBXFrameworksBuildPhase section */ 74 | A3372D691D9D010E006A97A1 /* Frameworks */ = { 75 | isa = PBXFrameworksBuildPhase; 76 | buildActionMask = 2147483647; 77 | files = ( 78 | ); 79 | runOnlyForDeploymentPostprocessing = 0; 80 | }; 81 | A3372D731D9D010E006A97A1 /* Frameworks */ = { 82 | isa = PBXFrameworksBuildPhase; 83 | buildActionMask = 2147483647; 84 | files = ( 85 | A3372D771D9D010E006A97A1 /* FRDModuleManager.framework in Frameworks */, 86 | ); 87 | runOnlyForDeploymentPostprocessing = 0; 88 | }; 89 | A3372D881D9D019F006A97A1 /* Frameworks */ = { 90 | isa = PBXFrameworksBuildPhase; 91 | buildActionMask = 2147483647; 92 | files = ( 93 | A3372DB71D9D1222006A97A1 /* FRDModuleManager.framework in Frameworks */, 94 | ); 95 | runOnlyForDeploymentPostprocessing = 0; 96 | }; 97 | /* End PBXFrameworksBuildPhase section */ 98 | 99 | /* Begin PBXGroup section */ 100 | A3372D631D9D010E006A97A1 = { 101 | isa = PBXGroup; 102 | children = ( 103 | A3372D6F1D9D010E006A97A1 /* FRDModuleManager */, 104 | A3372D7A1D9D010E006A97A1 /* FRDModuleManagerTests */, 105 | A3372D8C1D9D019F006A97A1 /* FRDModuleManagerDemo */, 106 | A3372D6E1D9D010E006A97A1 /* Products */, 107 | ); 108 | sourceTree = ""; 109 | }; 110 | A3372D6E1D9D010E006A97A1 /* Products */ = { 111 | isa = PBXGroup; 112 | children = ( 113 | A3372D6D1D9D010E006A97A1 /* FRDModuleManager.framework */, 114 | A3372D761D9D010E006A97A1 /* FRDModuleManagerTests.xctest */, 115 | A3372D8B1D9D019F006A97A1 /* FRDModuleManagerDemo.app */, 116 | ); 117 | name = Products; 118 | sourceTree = ""; 119 | }; 120 | A3372D6F1D9D010E006A97A1 /* FRDModuleManager */ = { 121 | isa = PBXGroup; 122 | children = ( 123 | A3372DA61D9D01CE006A97A1 /* Source */, 124 | A3372D711D9D010E006A97A1 /* Info.plist */, 125 | ); 126 | path = FRDModuleManager; 127 | sourceTree = ""; 128 | }; 129 | A3372D7A1D9D010E006A97A1 /* FRDModuleManagerTests */ = { 130 | isa = PBXGroup; 131 | children = ( 132 | A3372D7B1D9D010E006A97A1 /* FRDModuleManagerTests.m */, 133 | A330D9D51DA64DAE00BAB863 /* TestModule.h */, 134 | A330D9D61DA64DAE00BAB863 /* TestModule.m */, 135 | A330D9D31DA64D9500BAB863 /* TestModulesRegister.plist */, 136 | A3372D7D1D9D010E006A97A1 /* Info.plist */, 137 | ); 138 | path = FRDModuleManagerTests; 139 | sourceTree = ""; 140 | }; 141 | A3372D8C1D9D019F006A97A1 /* FRDModuleManagerDemo */ = { 142 | isa = PBXGroup; 143 | children = ( 144 | A3372D901D9D019F006A97A1 /* AppDelegate.h */, 145 | A3372D911D9D019F006A97A1 /* AppDelegate.m */, 146 | A3372D931D9D019F006A97A1 /* ViewController.h */, 147 | A3372D941D9D019F006A97A1 /* ViewController.m */, 148 | A3372DAD1D9D0CF1006A97A1 /* FRDTimelineModule.h */, 149 | A3372DAE1D9D0CF1006A97A1 /* FRDTimelineModule.m */, 150 | A3372DB21D9D0FD7006A97A1 /* FRDGroupModule.h */, 151 | A3372DB31D9D0FD7006A97A1 /* FRDGroupModule.m */, 152 | A3372DB01D9D0FA8006A97A1 /* ModulesRegister.plist */, 153 | A3372D961D9D019F006A97A1 /* Main.storyboard */, 154 | A3372D991D9D019F006A97A1 /* Assets.xcassets */, 155 | A3372D9B1D9D019F006A97A1 /* LaunchScreen.storyboard */, 156 | A3372D9E1D9D019F006A97A1 /* Info.plist */, 157 | A3372D8D1D9D019F006A97A1 /* Supporting Files */, 158 | ); 159 | path = FRDModuleManagerDemo; 160 | sourceTree = ""; 161 | }; 162 | A3372D8D1D9D019F006A97A1 /* Supporting Files */ = { 163 | isa = PBXGroup; 164 | children = ( 165 | A3372D8E1D9D019F006A97A1 /* main.m */, 166 | ); 167 | name = "Supporting Files"; 168 | sourceTree = ""; 169 | }; 170 | A3372DA61D9D01CE006A97A1 /* Source */ = { 171 | isa = PBXGroup; 172 | children = ( 173 | A3372DA91D9D02A3006A97A1 /* FRDModuleManager.h */, 174 | A3372DAA1D9D02A3006A97A1 /* FRDModuleManager.m */, 175 | ); 176 | path = Source; 177 | sourceTree = ""; 178 | }; 179 | /* End PBXGroup section */ 180 | 181 | /* Begin PBXHeadersBuildPhase section */ 182 | A3372D6A1D9D010E006A97A1 /* Headers */ = { 183 | isa = PBXHeadersBuildPhase; 184 | buildActionMask = 2147483647; 185 | files = ( 186 | A3372DAB1D9D02A3006A97A1 /* FRDModuleManager.h in Headers */, 187 | ); 188 | runOnlyForDeploymentPostprocessing = 0; 189 | }; 190 | /* End PBXHeadersBuildPhase section */ 191 | 192 | /* Begin PBXNativeTarget section */ 193 | A3372D6C1D9D010E006A97A1 /* FRDModuleManager */ = { 194 | isa = PBXNativeTarget; 195 | buildConfigurationList = A3372D811D9D010E006A97A1 /* Build configuration list for PBXNativeTarget "FRDModuleManager" */; 196 | buildPhases = ( 197 | A3372D681D9D010E006A97A1 /* Sources */, 198 | A3372D691D9D010E006A97A1 /* Frameworks */, 199 | A3372D6A1D9D010E006A97A1 /* Headers */, 200 | A3372D6B1D9D010E006A97A1 /* Resources */, 201 | ); 202 | buildRules = ( 203 | ); 204 | dependencies = ( 205 | ); 206 | name = FRDModuleManager; 207 | productName = FRDModuleManager; 208 | productReference = A3372D6D1D9D010E006A97A1 /* FRDModuleManager.framework */; 209 | productType = "com.apple.product-type.framework"; 210 | }; 211 | A3372D751D9D010E006A97A1 /* FRDModuleManagerTests */ = { 212 | isa = PBXNativeTarget; 213 | buildConfigurationList = A3372D841D9D010E006A97A1 /* Build configuration list for PBXNativeTarget "FRDModuleManagerTests" */; 214 | buildPhases = ( 215 | A3372D721D9D010E006A97A1 /* Sources */, 216 | A3372D731D9D010E006A97A1 /* Frameworks */, 217 | A3372D741D9D010E006A97A1 /* Resources */, 218 | ); 219 | buildRules = ( 220 | ); 221 | dependencies = ( 222 | A3372D791D9D010E006A97A1 /* PBXTargetDependency */, 223 | ); 224 | name = FRDModuleManagerTests; 225 | productName = FRDModuleManagerTests; 226 | productReference = A3372D761D9D010E006A97A1 /* FRDModuleManagerTests.xctest */; 227 | productType = "com.apple.product-type.bundle.unit-test"; 228 | }; 229 | A3372D8A1D9D019F006A97A1 /* FRDModuleManagerDemo */ = { 230 | isa = PBXNativeTarget; 231 | buildConfigurationList = A3372D9F1D9D019F006A97A1 /* Build configuration list for PBXNativeTarget "FRDModuleManagerDemo" */; 232 | buildPhases = ( 233 | A3372D871D9D019F006A97A1 /* Sources */, 234 | A3372D881D9D019F006A97A1 /* Frameworks */, 235 | A3372D891D9D019F006A97A1 /* Resources */, 236 | ); 237 | buildRules = ( 238 | ); 239 | dependencies = ( 240 | A3372DB61D9D1212006A97A1 /* PBXTargetDependency */, 241 | ); 242 | name = FRDModuleManagerDemo; 243 | productName = FRDModuleManagerDemo; 244 | productReference = A3372D8B1D9D019F006A97A1 /* FRDModuleManagerDemo.app */; 245 | productType = "com.apple.product-type.application"; 246 | }; 247 | /* End PBXNativeTarget section */ 248 | 249 | /* Begin PBXProject section */ 250 | A3372D641D9D010E006A97A1 /* Project object */ = { 251 | isa = PBXProject; 252 | attributes = { 253 | LastUpgradeCheck = 0900; 254 | ORGANIZATIONNAME = "Douban Inc"; 255 | TargetAttributes = { 256 | A3372D6C1D9D010E006A97A1 = { 257 | CreatedOnToolsVersion = 8.0; 258 | DevelopmentTeam = 5DS6P2KWFQ; 259 | ProvisioningStyle = Automatic; 260 | }; 261 | A3372D751D9D010E006A97A1 = { 262 | CreatedOnToolsVersion = 8.0; 263 | DevelopmentTeam = 5DS6P2KWFQ; 264 | ProvisioningStyle = Automatic; 265 | }; 266 | A3372D8A1D9D019F006A97A1 = { 267 | CreatedOnToolsVersion = 8.0; 268 | DevelopmentTeam = 5DS6P2KWFQ; 269 | ProvisioningStyle = Automatic; 270 | }; 271 | }; 272 | }; 273 | buildConfigurationList = A3372D671D9D010E006A97A1 /* Build configuration list for PBXProject "FRDModuleManager" */; 274 | compatibilityVersion = "Xcode 3.2"; 275 | developmentRegion = English; 276 | hasScannedForEncodings = 0; 277 | knownRegions = ( 278 | en, 279 | Base, 280 | ); 281 | mainGroup = A3372D631D9D010E006A97A1; 282 | productRefGroup = A3372D6E1D9D010E006A97A1 /* Products */; 283 | projectDirPath = ""; 284 | projectRoot = ""; 285 | targets = ( 286 | A3372D6C1D9D010E006A97A1 /* FRDModuleManager */, 287 | A3372D751D9D010E006A97A1 /* FRDModuleManagerTests */, 288 | A3372D8A1D9D019F006A97A1 /* FRDModuleManagerDemo */, 289 | ); 290 | }; 291 | /* End PBXProject section */ 292 | 293 | /* Begin PBXResourcesBuildPhase section */ 294 | A3372D6B1D9D010E006A97A1 /* Resources */ = { 295 | isa = PBXResourcesBuildPhase; 296 | buildActionMask = 2147483647; 297 | files = ( 298 | ); 299 | runOnlyForDeploymentPostprocessing = 0; 300 | }; 301 | A3372D741D9D010E006A97A1 /* Resources */ = { 302 | isa = PBXResourcesBuildPhase; 303 | buildActionMask = 2147483647; 304 | files = ( 305 | A330D9D41DA64D9500BAB863 /* TestModulesRegister.plist in Resources */, 306 | ); 307 | runOnlyForDeploymentPostprocessing = 0; 308 | }; 309 | A3372D891D9D019F006A97A1 /* Resources */ = { 310 | isa = PBXResourcesBuildPhase; 311 | buildActionMask = 2147483647; 312 | files = ( 313 | A3372D9D1D9D019F006A97A1 /* LaunchScreen.storyboard in Resources */, 314 | A3372DB11D9D0FA8006A97A1 /* ModulesRegister.plist in Resources */, 315 | A3372D9A1D9D019F006A97A1 /* Assets.xcassets in Resources */, 316 | A3372D981D9D019F006A97A1 /* Main.storyboard in Resources */, 317 | ); 318 | runOnlyForDeploymentPostprocessing = 0; 319 | }; 320 | /* End PBXResourcesBuildPhase section */ 321 | 322 | /* Begin PBXSourcesBuildPhase section */ 323 | A3372D681D9D010E006A97A1 /* Sources */ = { 324 | isa = PBXSourcesBuildPhase; 325 | buildActionMask = 2147483647; 326 | files = ( 327 | A3372DAC1D9D02A3006A97A1 /* FRDModuleManager.m in Sources */, 328 | ); 329 | runOnlyForDeploymentPostprocessing = 0; 330 | }; 331 | A3372D721D9D010E006A97A1 /* Sources */ = { 332 | isa = PBXSourcesBuildPhase; 333 | buildActionMask = 2147483647; 334 | files = ( 335 | A3372D7C1D9D010E006A97A1 /* FRDModuleManagerTests.m in Sources */, 336 | A330D9D71DA64DAE00BAB863 /* TestModule.m in Sources */, 337 | ); 338 | runOnlyForDeploymentPostprocessing = 0; 339 | }; 340 | A3372D871D9D019F006A97A1 /* Sources */ = { 341 | isa = PBXSourcesBuildPhase; 342 | buildActionMask = 2147483647; 343 | files = ( 344 | A3372D951D9D019F006A97A1 /* ViewController.m in Sources */, 345 | A3372D921D9D019F006A97A1 /* AppDelegate.m in Sources */, 346 | A3372D8F1D9D019F006A97A1 /* main.m in Sources */, 347 | A3372DAF1D9D0CF1006A97A1 /* FRDTimelineModule.m in Sources */, 348 | A3372DB41D9D0FD7006A97A1 /* FRDGroupModule.m in Sources */, 349 | ); 350 | runOnlyForDeploymentPostprocessing = 0; 351 | }; 352 | /* End PBXSourcesBuildPhase section */ 353 | 354 | /* Begin PBXTargetDependency section */ 355 | A3372D791D9D010E006A97A1 /* PBXTargetDependency */ = { 356 | isa = PBXTargetDependency; 357 | target = A3372D6C1D9D010E006A97A1 /* FRDModuleManager */; 358 | targetProxy = A3372D781D9D010E006A97A1 /* PBXContainerItemProxy */; 359 | }; 360 | A3372DB61D9D1212006A97A1 /* PBXTargetDependency */ = { 361 | isa = PBXTargetDependency; 362 | target = A3372D6C1D9D010E006A97A1 /* FRDModuleManager */; 363 | targetProxy = A3372DB51D9D1212006A97A1 /* PBXContainerItemProxy */; 364 | }; 365 | /* End PBXTargetDependency section */ 366 | 367 | /* Begin PBXVariantGroup section */ 368 | A3372D961D9D019F006A97A1 /* Main.storyboard */ = { 369 | isa = PBXVariantGroup; 370 | children = ( 371 | A3372D971D9D019F006A97A1 /* Base */, 372 | ); 373 | name = Main.storyboard; 374 | sourceTree = ""; 375 | }; 376 | A3372D9B1D9D019F006A97A1 /* LaunchScreen.storyboard */ = { 377 | isa = PBXVariantGroup; 378 | children = ( 379 | A3372D9C1D9D019F006A97A1 /* Base */, 380 | ); 381 | name = LaunchScreen.storyboard; 382 | sourceTree = ""; 383 | }; 384 | /* End PBXVariantGroup section */ 385 | 386 | /* Begin XCBuildConfiguration section */ 387 | A3372D7F1D9D010E006A97A1 /* Debug */ = { 388 | isa = XCBuildConfiguration; 389 | buildSettings = { 390 | ALWAYS_SEARCH_USER_PATHS = NO; 391 | CLANG_ANALYZER_NONNULL = YES; 392 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 393 | CLANG_CXX_LIBRARY = "libc++"; 394 | CLANG_ENABLE_MODULES = YES; 395 | CLANG_ENABLE_OBJC_ARC = YES; 396 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 397 | CLANG_WARN_BOOL_CONVERSION = YES; 398 | CLANG_WARN_COMMA = YES; 399 | CLANG_WARN_CONSTANT_CONVERSION = YES; 400 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 401 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 402 | CLANG_WARN_EMPTY_BODY = YES; 403 | CLANG_WARN_ENUM_CONVERSION = YES; 404 | CLANG_WARN_INFINITE_RECURSION = YES; 405 | CLANG_WARN_INT_CONVERSION = YES; 406 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 407 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 408 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 409 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 410 | CLANG_WARN_STRICT_PROTOTYPES = YES; 411 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 412 | CLANG_WARN_SUSPICIOUS_MOVES = YES; 413 | CLANG_WARN_UNREACHABLE_CODE = YES; 414 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 415 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 416 | COPY_PHASE_STRIP = NO; 417 | CURRENT_PROJECT_VERSION = 1; 418 | DEBUG_INFORMATION_FORMAT = dwarf; 419 | ENABLE_STRICT_OBJC_MSGSEND = YES; 420 | ENABLE_TESTABILITY = YES; 421 | GCC_C_LANGUAGE_STANDARD = gnu99; 422 | GCC_DYNAMIC_NO_PIC = NO; 423 | GCC_NO_COMMON_BLOCKS = YES; 424 | GCC_OPTIMIZATION_LEVEL = 0; 425 | GCC_PREPROCESSOR_DEFINITIONS = ( 426 | "DEBUG=1", 427 | "$(inherited)", 428 | ); 429 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 430 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 431 | GCC_WARN_UNDECLARED_SELECTOR = YES; 432 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 433 | GCC_WARN_UNUSED_FUNCTION = YES; 434 | GCC_WARN_UNUSED_VARIABLE = YES; 435 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 436 | MTL_ENABLE_DEBUG_INFO = YES; 437 | ONLY_ACTIVE_ARCH = YES; 438 | SDKROOT = iphoneos; 439 | TARGETED_DEVICE_FAMILY = "1,2"; 440 | VERSIONING_SYSTEM = "apple-generic"; 441 | VERSION_INFO_PREFIX = ""; 442 | }; 443 | name = Debug; 444 | }; 445 | A3372D801D9D010E006A97A1 /* Release */ = { 446 | isa = XCBuildConfiguration; 447 | buildSettings = { 448 | ALWAYS_SEARCH_USER_PATHS = NO; 449 | CLANG_ANALYZER_NONNULL = YES; 450 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 451 | CLANG_CXX_LIBRARY = "libc++"; 452 | CLANG_ENABLE_MODULES = YES; 453 | CLANG_ENABLE_OBJC_ARC = YES; 454 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 455 | CLANG_WARN_BOOL_CONVERSION = YES; 456 | CLANG_WARN_COMMA = YES; 457 | CLANG_WARN_CONSTANT_CONVERSION = YES; 458 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 459 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 460 | CLANG_WARN_EMPTY_BODY = YES; 461 | CLANG_WARN_ENUM_CONVERSION = YES; 462 | CLANG_WARN_INFINITE_RECURSION = YES; 463 | CLANG_WARN_INT_CONVERSION = YES; 464 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 465 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 466 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 467 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 468 | CLANG_WARN_STRICT_PROTOTYPES = YES; 469 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 470 | CLANG_WARN_SUSPICIOUS_MOVES = YES; 471 | CLANG_WARN_UNREACHABLE_CODE = YES; 472 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 473 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 474 | COPY_PHASE_STRIP = NO; 475 | CURRENT_PROJECT_VERSION = 1; 476 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 477 | ENABLE_NS_ASSERTIONS = NO; 478 | ENABLE_STRICT_OBJC_MSGSEND = YES; 479 | GCC_C_LANGUAGE_STANDARD = gnu99; 480 | GCC_NO_COMMON_BLOCKS = YES; 481 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 482 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 483 | GCC_WARN_UNDECLARED_SELECTOR = YES; 484 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 485 | GCC_WARN_UNUSED_FUNCTION = YES; 486 | GCC_WARN_UNUSED_VARIABLE = YES; 487 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 488 | MTL_ENABLE_DEBUG_INFO = NO; 489 | SDKROOT = iphoneos; 490 | TARGETED_DEVICE_FAMILY = "1,2"; 491 | VALIDATE_PRODUCT = YES; 492 | VERSIONING_SYSTEM = "apple-generic"; 493 | VERSION_INFO_PREFIX = ""; 494 | }; 495 | name = Release; 496 | }; 497 | A3372D821D9D010E006A97A1 /* Debug */ = { 498 | isa = XCBuildConfiguration; 499 | buildSettings = { 500 | CODE_SIGN_IDENTITY = ""; 501 | DEFINES_MODULE = YES; 502 | DEVELOPMENT_TEAM = 5DS6P2KWFQ; 503 | DYLIB_COMPATIBILITY_VERSION = 1; 504 | DYLIB_CURRENT_VERSION = 1; 505 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 506 | INFOPLIST_FILE = FRDModuleManager/Info.plist; 507 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 508 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 509 | PRODUCT_BUNDLE_IDENTIFIER = com.douban.FRDModuleManager; 510 | PRODUCT_NAME = "$(TARGET_NAME)"; 511 | SKIP_INSTALL = YES; 512 | }; 513 | name = Debug; 514 | }; 515 | A3372D831D9D010E006A97A1 /* Release */ = { 516 | isa = XCBuildConfiguration; 517 | buildSettings = { 518 | CODE_SIGN_IDENTITY = ""; 519 | DEFINES_MODULE = YES; 520 | DEVELOPMENT_TEAM = 5DS6P2KWFQ; 521 | DYLIB_COMPATIBILITY_VERSION = 1; 522 | DYLIB_CURRENT_VERSION = 1; 523 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 524 | INFOPLIST_FILE = FRDModuleManager/Info.plist; 525 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 526 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 527 | PRODUCT_BUNDLE_IDENTIFIER = com.douban.FRDModuleManager; 528 | PRODUCT_NAME = "$(TARGET_NAME)"; 529 | SKIP_INSTALL = YES; 530 | }; 531 | name = Release; 532 | }; 533 | A3372D851D9D010E006A97A1 /* Debug */ = { 534 | isa = XCBuildConfiguration; 535 | buildSettings = { 536 | DEVELOPMENT_TEAM = 5DS6P2KWFQ; 537 | INFOPLIST_FILE = FRDModuleManagerTests/Info.plist; 538 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 539 | PRODUCT_BUNDLE_IDENTIFIER = com.douban.FRDModuleManagerTests; 540 | PRODUCT_NAME = "$(TARGET_NAME)"; 541 | }; 542 | name = Debug; 543 | }; 544 | A3372D861D9D010E006A97A1 /* Release */ = { 545 | isa = XCBuildConfiguration; 546 | buildSettings = { 547 | DEVELOPMENT_TEAM = 5DS6P2KWFQ; 548 | INFOPLIST_FILE = FRDModuleManagerTests/Info.plist; 549 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 550 | PRODUCT_BUNDLE_IDENTIFIER = com.douban.FRDModuleManagerTests; 551 | PRODUCT_NAME = "$(TARGET_NAME)"; 552 | }; 553 | name = Release; 554 | }; 555 | A3372DA01D9D019F006A97A1 /* Debug */ = { 556 | isa = XCBuildConfiguration; 557 | buildSettings = { 558 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 559 | DEVELOPMENT_TEAM = 5DS6P2KWFQ; 560 | INFOPLIST_FILE = FRDModuleManagerDemo/Info.plist; 561 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 562 | PRODUCT_BUNDLE_IDENTIFIER = com.douban.FRDModuleManagerDemo; 563 | PRODUCT_NAME = "$(TARGET_NAME)"; 564 | }; 565 | name = Debug; 566 | }; 567 | A3372DA11D9D019F006A97A1 /* Release */ = { 568 | isa = XCBuildConfiguration; 569 | buildSettings = { 570 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 571 | DEVELOPMENT_TEAM = 5DS6P2KWFQ; 572 | INFOPLIST_FILE = FRDModuleManagerDemo/Info.plist; 573 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 574 | PRODUCT_BUNDLE_IDENTIFIER = com.douban.FRDModuleManagerDemo; 575 | PRODUCT_NAME = "$(TARGET_NAME)"; 576 | }; 577 | name = Release; 578 | }; 579 | /* End XCBuildConfiguration section */ 580 | 581 | /* Begin XCConfigurationList section */ 582 | A3372D671D9D010E006A97A1 /* Build configuration list for PBXProject "FRDModuleManager" */ = { 583 | isa = XCConfigurationList; 584 | buildConfigurations = ( 585 | A3372D7F1D9D010E006A97A1 /* Debug */, 586 | A3372D801D9D010E006A97A1 /* Release */, 587 | ); 588 | defaultConfigurationIsVisible = 0; 589 | defaultConfigurationName = Release; 590 | }; 591 | A3372D811D9D010E006A97A1 /* Build configuration list for PBXNativeTarget "FRDModuleManager" */ = { 592 | isa = XCConfigurationList; 593 | buildConfigurations = ( 594 | A3372D821D9D010E006A97A1 /* Debug */, 595 | A3372D831D9D010E006A97A1 /* Release */, 596 | ); 597 | defaultConfigurationIsVisible = 0; 598 | defaultConfigurationName = Release; 599 | }; 600 | A3372D841D9D010E006A97A1 /* Build configuration list for PBXNativeTarget "FRDModuleManagerTests" */ = { 601 | isa = XCConfigurationList; 602 | buildConfigurations = ( 603 | A3372D851D9D010E006A97A1 /* Debug */, 604 | A3372D861D9D010E006A97A1 /* Release */, 605 | ); 606 | defaultConfigurationIsVisible = 0; 607 | defaultConfigurationName = Release; 608 | }; 609 | A3372D9F1D9D019F006A97A1 /* Build configuration list for PBXNativeTarget "FRDModuleManagerDemo" */ = { 610 | isa = XCConfigurationList; 611 | buildConfigurations = ( 612 | A3372DA01D9D019F006A97A1 /* Debug */, 613 | A3372DA11D9D019F006A97A1 /* Release */, 614 | ); 615 | defaultConfigurationIsVisible = 0; 616 | defaultConfigurationName = Release; 617 | }; 618 | /* End XCConfigurationList section */ 619 | }; 620 | rootObject = A3372D641D9D010E006A97A1 /* Project object */; 621 | } 622 | -------------------------------------------------------------------------------- /FRDModuleManager.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /FRDModuleManager.xcodeproj/xcshareddata/xcschemes/FRDModuleManager.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 31 | 32 | 34 | 40 | 41 | 42 | 43 | 44 | 50 | 51 | 52 | 53 | 54 | 55 | 66 | 67 | 73 | 74 | 75 | 76 | 77 | 78 | 84 | 85 | 91 | 92 | 93 | 94 | 96 | 97 | 100 | 101 | 102 | -------------------------------------------------------------------------------- /FRDModuleManager.xcodeproj/xcshareddata/xcschemes/FRDModuleManagerTests.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 16 | 18 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 41 | 42 | 43 | 44 | 50 | 51 | 53 | 54 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /FRDModuleManager/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | $(CURRENT_PROJECT_VERSION) 21 | NSPrincipalClass 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /FRDModuleManager/Source/FRDModuleManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // FRDModuleManager.h 3 | // FRDModuleManager 4 | // 5 | // Created by GUO Lin on 9/29/16. 6 | // Copyright © 2016 Douban Inc. All rights reserved. 7 | // 8 | 9 | @import UIKit; 10 | @import UserNotifications; 11 | 12 | @protocol FRDModule 13 | 14 | @end 15 | 16 | 17 | @interface FRDModuleManager : NSObject 18 | 19 | + (instancetype)sharedInstance; 20 | 21 | - (void)loadModulesWithPlistFile:(NSString *)plistFile; 22 | 23 | - (NSArray> *)allModules; 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /FRDModuleManager/Source/FRDModuleManager.m: -------------------------------------------------------------------------------- 1 | // 2 | // FRDModuleManager.m 3 | // FRDModuleManager 4 | // 5 | // Created by GUO Lin on 9/29/16. 6 | // Copyright © 2016 Douban Inc. All rights reserved. 7 | // 8 | 9 | @import UserNotifications; 10 | 11 | #import "FRDModuleManager.h" 12 | 13 | @interface FRDModuleManager () 14 | 15 | @property (nonatomic, strong) NSMutableArray> *modules; 16 | 17 | @end 18 | 19 | @implementation FRDModuleManager 20 | 21 | + (instancetype)sharedInstance 22 | { 23 | static FRDModuleManager *instance = nil; 24 | static dispatch_once_t onceToken; 25 | dispatch_once(&onceToken, ^{ 26 | instance = [[[self class] alloc] init]; 27 | }); 28 | return instance; 29 | } 30 | 31 | 32 | - (NSMutableArray> *)modules 33 | { 34 | if (!_modules) { 35 | _modules = [NSMutableArray array]; 36 | } 37 | return _modules; 38 | } 39 | 40 | - (void)addModule:(id) module 41 | { 42 | if (![self.modules containsObject:module]) { 43 | [self.modules addObject:module]; 44 | } 45 | } 46 | 47 | - (void)loadModulesWithPlistFile:(NSString *)plistFile 48 | { 49 | NSArray *moduleNames = [NSArray arrayWithContentsOfFile:plistFile]; 50 | for (NSString *moduleName in moduleNames) { 51 | id module = [[NSClassFromString(moduleName) alloc] init]; 52 | [self addModule:module]; 53 | } 54 | } 55 | 56 | - (NSArray> *)allModules 57 | { 58 | return self.modules; 59 | } 60 | 61 | #pragma mark - State Transitions / Launch time: 62 | 63 | - (BOOL)application:(UIApplication *)application willFinishLaunchingWithOptions:(NSDictionary *)launchOptions 64 | { 65 | for (id module in self.modules) { 66 | if ([module respondsToSelector:_cmd]) { 67 | [module application:application willFinishLaunchingWithOptions:launchOptions]; 68 | } 69 | } 70 | return YES; 71 | } 72 | 73 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 74 | { 75 | for (id module in self.modules) { 76 | if ([module respondsToSelector:_cmd]) { 77 | [module application:application didFinishLaunchingWithOptions:launchOptions]; 78 | } 79 | } 80 | return YES; 81 | } 82 | 83 | #pragma mark - State Transitions / Transitioning to the foreground: 84 | 85 | - (void)applicationDidBecomeActive:(UIApplication *)application 86 | { 87 | for (id module in self.modules) { 88 | if ([module respondsToSelector:_cmd]) { 89 | [module applicationDidBecomeActive:application]; 90 | } 91 | } 92 | } 93 | 94 | #pragma mark - State Transitions / Transitioning to the foreground: 95 | 96 | - (void)applicationDidEnterBackground:(UIApplication *)application 97 | { 98 | for (id module in self.modules) { 99 | if ([module respondsToSelector:_cmd]) { 100 | [module applicationDidEnterBackground:application]; 101 | } 102 | } 103 | } 104 | 105 | #pragma mark - State Transitions / Transitioning to the inactive state: 106 | 107 | // Called when leaving the foreground state. 108 | - (void)applicationWillResignActive:(UIApplication *)application 109 | { 110 | for (id module in self.modules) { 111 | if ([module respondsToSelector:_cmd]) { 112 | [module applicationWillResignActive:application]; 113 | } 114 | } 115 | } 116 | 117 | // Called when transitioning out of the background state. 118 | - (void)applicationWillEnterForeground:(UIApplication *)application 119 | { 120 | for (id module in self.modules) { 121 | if ([module respondsToSelector:_cmd]) { 122 | [module applicationWillEnterForeground:application]; 123 | } 124 | } 125 | } 126 | 127 | #pragma mark - State Transitions / Termination: 128 | 129 | - (void)applicationWillTerminate:(UIApplication *)application 130 | { 131 | for (id module in self.modules) { 132 | if ([module respondsToSelector:_cmd]) { 133 | [module applicationWillTerminate:application]; 134 | } 135 | } 136 | } 137 | 138 | #pragma mark - Handling Remote Notification 139 | 140 | - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken 141 | { 142 | for (id module in self.modules) { 143 | if ([module respondsToSelector:_cmd]) { 144 | [module application:application didRegisterForRemoteNotificationsWithDeviceToken:deviceToken]; 145 | } 146 | } 147 | } 148 | 149 | - (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error 150 | { 151 | for (id module in self.modules) { 152 | if ([module respondsToSelector:_cmd]) { 153 | [module application:application didFailToRegisterForRemoteNotificationsWithError:error]; 154 | } 155 | } 156 | } 157 | 158 | - (void)application:(UIApplication *)application 159 | didReceiveRemoteNotification:(NSDictionary *)userInfo 160 | fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))completionHandler; 161 | { 162 | for (id module in self.modules) { 163 | if ([module respondsToSelector:_cmd]) { 164 | [module application:application didReceiveRemoteNotification:userInfo fetchCompletionHandler:completionHandler]; 165 | } 166 | } 167 | } 168 | 169 | // Deprecated from iOS 10.0 170 | - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo 171 | { 172 | for (id module in self.modules) { 173 | if ([module respondsToSelector:_cmd]) { 174 | [module application:application didReceiveRemoteNotification:userInfo]; 175 | } 176 | } 177 | } 178 | 179 | - (void)application:(UIApplication *)application 180 | handleActionWithIdentifier:(NSString *)identifier 181 | forRemoteNotification:(NSDictionary *)userInfo 182 | completionHandler:(void (^)(void))completionHandler 183 | { 184 | for (id module in self.modules) { 185 | if ([module respondsToSelector:_cmd]) { 186 | [module application:application 187 | handleActionWithIdentifier:identifier 188 | forRemoteNotification:userInfo 189 | completionHandler:completionHandler]; 190 | } 191 | } 192 | } 193 | 194 | - (void)application:(UIApplication *)application 195 | handleActionWithIdentifier:(NSString *)identifier 196 | forRemoteNotification:(NSDictionary *)userInfo 197 | withResponseInfo:(NSDictionary *)responseInfo 198 | completionHandler:(void (^)(void))completionHandler 199 | { 200 | for (id module in self.modules) { 201 | if ([module respondsToSelector:_cmd]) { 202 | [module application:application 203 | handleActionWithIdentifier:identifier 204 | forRemoteNotification:userInfo 205 | withResponseInfo:responseInfo 206 | completionHandler:completionHandler]; 207 | } 208 | } 209 | } 210 | 211 | #pragma mark - Handling Local Notification 212 | 213 | - (void)userNotificationCenter:(UNUserNotificationCenter *)center 214 | willPresentNotification:(UNNotification *)notification 215 | withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler 216 | { 217 | for (id module in self.modules) { 218 | if ([module respondsToSelector:_cmd]) { 219 | [module userNotificationCenter:center 220 | willPresentNotification:notification 221 | withCompletionHandler:completionHandler]; 222 | } 223 | } 224 | } 225 | 226 | - (void)userNotificationCenter:(UNUserNotificationCenter *)center 227 | didReceiveNotificationResponse:(UNNotificationResponse *)response 228 | withCompletionHandler:(void (^)(void))completionHandler 229 | { 230 | for (id module in self.modules) { 231 | if ([module respondsToSelector:_cmd]) { 232 | [module userNotificationCenter:center 233 | didReceiveNotificationResponse:response 234 | withCompletionHandler:completionHandler]; 235 | } 236 | } 237 | } 238 | 239 | // Deprecated from iOS 10.0 240 | - (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification 241 | { 242 | for (id module in self.modules) { 243 | if ([module respondsToSelector:_cmd]) { 244 | [module application:application didReceiveLocalNotification:notification]; 245 | } 246 | } 247 | } 248 | 249 | - (void)application:(UIApplication *)application 250 | handleActionWithIdentifier:(NSString *)identifier 251 | forLocalNotification:(UILocalNotification *)notification 252 | completionHandler:(void (^)(void))completionHandler 253 | { 254 | for (id module in self.modules) { 255 | if ([module respondsToSelector:_cmd]) { 256 | [module application:application 257 | handleActionWithIdentifier:identifier 258 | forLocalNotification:notification 259 | completionHandler:completionHandler]; 260 | } 261 | } 262 | } 263 | 264 | - (void)application:(UIApplication *)application 265 | handleActionWithIdentifier:(NSString *)identifier 266 | forLocalNotification:(UILocalNotification *)notification 267 | withResponseInfo:(NSDictionary *)responseInfo 268 | completionHandler:(void (^)(void))completionHandler 269 | { 270 | for (id module in self.modules) { 271 | if ([module respondsToSelector:_cmd]) { 272 | [module application:application 273 | handleActionWithIdentifier:identifier 274 | forLocalNotification:notification 275 | withResponseInfo:responseInfo 276 | completionHandler:completionHandler]; 277 | } 278 | } 279 | } 280 | 281 | - (void)application:(UIApplication *)application 282 | didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings 283 | { 284 | for (id module in self.modules) { 285 | if ([module respondsToSelector:_cmd]) { 286 | [module application:application didRegisterUserNotificationSettings:notificationSettings]; 287 | } 288 | } 289 | } 290 | 291 | #pragma mark - Handling Continuing User Activity and Handling Quick Actions 292 | 293 | - (BOOL)application:(UIApplication *)application 294 | willContinueUserActivityWithType:(NSString *)userActivityType 295 | { 296 | BOOL result = NO; 297 | for (id module in self.modules) { 298 | if ([module respondsToSelector:_cmd]) { 299 | result = result || [module application:application willContinueUserActivityWithType:userActivityType]; 300 | } 301 | } 302 | return result; 303 | } 304 | 305 | - (BOOL)application:(UIApplication *)application 306 | continueUserActivity:(NSUserActivity *)userActivity 307 | restorationHandler:(void (^)(NSArray *restorableObjects))restorationHandler 308 | { 309 | BOOL result = NO; 310 | for (id module in self.modules) { 311 | if ([module respondsToSelector:_cmd]) { 312 | result = result || [module application:application continueUserActivity:userActivity restorationHandler:restorationHandler]; 313 | } 314 | } 315 | return result; 316 | } 317 | 318 | - (void)application:(UIApplication *)application 319 | didUpdateUserActivity:(NSUserActivity *)userActivity 320 | { 321 | for (id module in self.modules) { 322 | if ([module respondsToSelector:_cmd]) { 323 | [module application:application didUpdateUserActivity:userActivity]; 324 | } 325 | } 326 | } 327 | 328 | - (void)application:(UIApplication *)application 329 | didFailToContinueUserActivityWithType:(NSString *)userActivityType 330 | error:(NSError *)error 331 | { 332 | for (id module in self.modules) { 333 | if ([module respondsToSelector:_cmd]) { 334 | [module application:application didFailToContinueUserActivityWithType:userActivityType error:error]; 335 | } 336 | } 337 | } 338 | 339 | - (void)application:(UIApplication *)application 340 | performActionForShortcutItem:(UIApplicationShortcutItem *)shortcutItem 341 | completionHandler:(void (^)(BOOL succeeded))completionHandler 342 | { 343 | for (id module in self.modules) { 344 | if ([module respondsToSelector:_cmd]) { 345 | [module application:application performActionForShortcutItem:shortcutItem completionHandler:completionHandler]; 346 | } 347 | } 348 | } 349 | 350 | @end 351 | -------------------------------------------------------------------------------- /FRDModuleManagerDemo/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // FRDModuleManagerDemo 4 | // 5 | // Created by GUO Lin on 9/29/16. 6 | // Copyright © 2016 Douban Inc. 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 | -------------------------------------------------------------------------------- /FRDModuleManagerDemo/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // FRDModuleManagerDemo 4 | // 5 | // Created by GUO Lin on 9/29/16. 6 | // Copyright © 2016 Douban Inc. All rights reserved. 7 | // 8 | 9 | @import UserNotifications; 10 | 11 | #import 12 | #import "AppDelegate.h" 13 | 14 | @interface AppDelegate () 15 | 16 | @end 17 | 18 | @implementation AppDelegate 19 | 20 | #pragma mark - State Transitions 21 | 22 | - (BOOL)application:(UIApplication *)application willFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 23 | 24 | NSString* plistPath = [[NSBundle mainBundle] pathForResource:@"ModulesRegister" ofType:@"plist"]; 25 | 26 | FRDModuleManager *manager = [FRDModuleManager sharedInstance]; 27 | [manager loadModulesWithPlistFile:plistPath]; 28 | 29 | [manager application:application willFinishLaunchingWithOptions:launchOptions]; 30 | 31 | return YES; 32 | } 33 | 34 | 35 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 36 | 37 | [[FRDModuleManager sharedInstance] application:application didFinishLaunchingWithOptions:launchOptions]; 38 | 39 | return YES; 40 | } 41 | 42 | - (void)applicationWillResignActive:(UIApplication *)application { 43 | // 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. 44 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 45 | 46 | [[FRDModuleManager sharedInstance] applicationWillResignActive:application]; 47 | } 48 | 49 | - (void)applicationDidEnterBackground:(UIApplication *)application { 50 | // 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. 51 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 52 | [[FRDModuleManager sharedInstance] applicationDidEnterBackground:application]; 53 | } 54 | 55 | - (void)applicationWillEnterForeground:(UIApplication *)application { 56 | // 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. 57 | [[FRDModuleManager sharedInstance] applicationWillEnterForeground:application]; 58 | } 59 | 60 | - (void)applicationDidBecomeActive:(UIApplication *)application { 61 | // 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. 62 | [[FRDModuleManager sharedInstance] applicationDidBecomeActive:application]; 63 | } 64 | 65 | - (void)applicationWillTerminate:(UIApplication *)application { 66 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 67 | [[FRDModuleManager sharedInstance] applicationWillTerminate:application]; 68 | } 69 | 70 | #pragma mark - Handling Remote Notification 71 | 72 | - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken { 73 | [[FRDModuleManager sharedInstance] application:application didRegisterForRemoteNotificationsWithDeviceToken:deviceToken]; 74 | } 75 | 76 | - (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error { 77 | [[FRDModuleManager sharedInstance] application:application didFailToRegisterForRemoteNotificationsWithError:error]; 78 | } 79 | 80 | - (void)application:(UIApplication *)application 81 | didReceiveRemoteNotification:(NSDictionary *)userInfo 82 | fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))completionHandler 83 | { 84 | [[FRDModuleManager sharedInstance] application:application 85 | didReceiveRemoteNotification:userInfo 86 | fetchCompletionHandler:completionHandler]; 87 | 88 | } 89 | 90 | #pragma mark - Handling Local Notification 91 | 92 | - (void)userNotificationCenter:(UNUserNotificationCenter *)center 93 | willPresentNotification:(UNNotification *)notification 94 | withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler 95 | { 96 | [[FRDModuleManager sharedInstance] userNotificationCenter:center 97 | willPresentNotification:notification 98 | withCompletionHandler:completionHandler]; 99 | } 100 | 101 | - (void)userNotificationCenter:(UNUserNotificationCenter *)center 102 | didReceiveNotificationResponse:(UNNotificationResponse *)response 103 | withCompletionHandler:(void (^)())completionHandler 104 | { 105 | [[FRDModuleManager sharedInstance] userNotificationCenter:center 106 | didReceiveNotificationResponse:response 107 | withCompletionHandler:completionHandler]; 108 | } 109 | 110 | @end 111 | -------------------------------------------------------------------------------- /FRDModuleManagerDemo/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /FRDModuleManagerDemo/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 | 27 | 28 | -------------------------------------------------------------------------------- /FRDModuleManagerDemo/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 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /FRDModuleManagerDemo/FRDGroupModule.h: -------------------------------------------------------------------------------- 1 | // 2 | // FRDGroupModule.h 3 | // FRDModuleManager 4 | // 5 | // Created by GUO Lin on 9/29/16. 6 | // Copyright © 2016 Douban Inc. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface FRDGroupModule : NSObject 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /FRDModuleManagerDemo/FRDGroupModule.m: -------------------------------------------------------------------------------- 1 | // 2 | // FRDGroupModule.m 3 | // FRDModuleManager 4 | // 5 | // Created by GUO Lin on 9/29/16. 6 | // Copyright © 2016 Douban Inc. All rights reserved. 7 | // 8 | 9 | #import "FRDGroupModule.h" 10 | 11 | @implementation FRDGroupModule 12 | 13 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 14 | { 15 | NSLog(@"%@ Group", NSStringFromSelector(_cmd)); 16 | return YES; 17 | } 18 | 19 | - (void)applicationWillResignActive:(UIApplication *)application 20 | { 21 | NSLog(@"%@ Group", NSStringFromSelector(_cmd)); 22 | } 23 | 24 | - (void)applicationDidEnterBackground:(UIApplication *)application 25 | { 26 | NSLog(@"%@ Group", NSStringFromSelector(_cmd)); 27 | } 28 | 29 | - (void)applicationWillEnterForeground:(UIApplication *)application 30 | { 31 | NSLog(@"%@ Group", NSStringFromSelector(_cmd)); 32 | } 33 | 34 | - (void)applicationDidBecomeActive:(UIApplication *)application 35 | { 36 | NSLog(@"%@ Group", NSStringFromSelector(_cmd)); 37 | } 38 | 39 | - (void)applicationWillTerminate:(UIApplication *)application 40 | { 41 | NSLog(@"%@ Group", NSStringFromSelector(_cmd)); 42 | } 43 | 44 | @end 45 | -------------------------------------------------------------------------------- /FRDModuleManagerDemo/FRDTimelineModule.h: -------------------------------------------------------------------------------- 1 | // 2 | // FRDTimelineModule.h 3 | // FRDModuleManager 4 | // 5 | // Created by GUO Lin on 9/29/16. 6 | // Copyright © 2016 Douban Inc. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface FRDTimelineModule : NSObject 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /FRDModuleManagerDemo/FRDTimelineModule.m: -------------------------------------------------------------------------------- 1 | // 2 | // FRDTimelineModule.m 3 | // FRDModuleManager 4 | // 5 | // Created by GUO Lin on 9/29/16. 6 | // Copyright © 2016 Douban Inc. All rights reserved. 7 | // 8 | 9 | #import "FRDTimelineModule.h" 10 | 11 | @implementation FRDTimelineModule 12 | 13 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 14 | { 15 | NSLog(@"%@ Timeline", NSStringFromSelector(_cmd)); 16 | return YES; 17 | } 18 | 19 | - (void)applicationWillResignActive:(UIApplication *)application 20 | { 21 | NSLog(@"%@ Timeline", NSStringFromSelector(_cmd)); 22 | } 23 | 24 | - (void)applicationDidEnterBackground:(UIApplication *)application 25 | { 26 | NSLog(@"%@ Timeline", NSStringFromSelector(_cmd)); 27 | } 28 | 29 | - (void)applicationWillEnterForeground:(UIApplication *)application 30 | { 31 | NSLog(@"%@ Timeline", NSStringFromSelector(_cmd)); 32 | } 33 | 34 | - (void)applicationDidBecomeActive:(UIApplication *)application 35 | { 36 | NSLog(@"%@ Timeline", NSStringFromSelector(_cmd)); 37 | } 38 | 39 | - (void)applicationWillTerminate:(UIApplication *)application 40 | { 41 | NSLog(@"%@ Timeline", NSStringFromSelector(_cmd)); 42 | } 43 | 44 | - (void)application:(UIApplication *)application 45 | didReceiveRemoteNotification:(NSDictionary *)userInfo 46 | fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))completionHandler; 47 | { 48 | NSLog(@"%@ Timeline", NSStringFromSelector(_cmd)); 49 | } 50 | 51 | 52 | @end 53 | -------------------------------------------------------------------------------- /FRDModuleManagerDemo/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 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 | 38 | 39 | -------------------------------------------------------------------------------- /FRDModuleManagerDemo/ModulesRegister.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | FRDGroupModule 6 | FRDTimelineModule 7 | 8 | 9 | -------------------------------------------------------------------------------- /FRDModuleManagerDemo/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // FRDModuleManagerDemo 4 | // 5 | // Created by GUO Lin on 9/29/16. 6 | // Copyright © 2016 Douban Inc. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /FRDModuleManagerDemo/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // FRDModuleManagerDemo 4 | // 5 | // Created by GUO Lin on 9/29/16. 6 | // Copyright © 2016 Douban Inc. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | 11 | @interface ViewController () 12 | 13 | @end 14 | 15 | @implementation ViewController 16 | 17 | - (void)viewDidLoad { 18 | [super viewDidLoad]; 19 | // Do any additional setup after loading the view, typically from a nib. 20 | } 21 | 22 | 23 | - (void)didReceiveMemoryWarning { 24 | [super didReceiveMemoryWarning]; 25 | // Dispose of any resources that can be recreated. 26 | } 27 | 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /FRDModuleManagerDemo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // FRDModuleManagerDemo 4 | // 5 | // Created by GUO Lin on 9/29/16. 6 | // Copyright © 2016 Douban Inc. 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 | -------------------------------------------------------------------------------- /FRDModuleManagerTests/FRDModuleManagerTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // FRDModuleManagerTests.m 3 | // FRDModuleManagerTests 4 | // 5 | // Created by GUO Lin on 9/29/16. 6 | // Copyright © 2016 Douban Inc. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "FRDModuleManager.h" 12 | #import "TestModule.h" 13 | 14 | @interface FRDModuleManagerTests : XCTestCase 15 | 16 | @end 17 | 18 | @implementation FRDModuleManagerTests 19 | 20 | 21 | - (void)testModuleManager { 22 | 23 | NSBundle *bundle = [NSBundle bundleForClass:[self class]]; 24 | NSString* plistPath = [bundle pathForResource:@"TestModulesRegister" ofType:@"plist"]; 25 | [[FRDModuleManager sharedInstance] loadModulesWithPlistFile:plistPath]; 26 | NSArray *modules = [[FRDModuleManager sharedInstance] allModules]; 27 | XCTAssert(modules.count == 1); 28 | 29 | id module = [modules firstObject]; 30 | 31 | XCTAssert([module isKindOfClass:[TestModule class]]); 32 | 33 | } 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /FRDModuleManagerTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /FRDModuleManagerTests/TestModule.h: -------------------------------------------------------------------------------- 1 | // 2 | // TestModule.h 3 | // FRDModuleManager 4 | // 5 | // Created by GUO Lin on 10/6/16. 6 | // Copyright © 2016 Douban Inc. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "FRDModuleManager.h" 11 | 12 | @interface TestModule : NSObject 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /FRDModuleManagerTests/TestModule.m: -------------------------------------------------------------------------------- 1 | // 2 | // TestModule.m 3 | // FRDModuleManager 4 | // 5 | // Created by GUO Lin on 10/6/16. 6 | // Copyright © 2016 Douban Inc. All rights reserved. 7 | // 8 | 9 | #import "TestModule.h" 10 | 11 | @implementation TestModule 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /FRDModuleManagerTests/TestModulesRegister.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | TestModule 6 | 7 | 8 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 GUO Lin 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # FRDModuleManager 2 | 3 | [![Test Status](https://travis-ci.org/lincode/FRDModuleManager.svg?branch=master)](https://travis-ci.org/lincode/FRDModuleManager) 4 | [![IDE](https://img.shields.io/badge/XCode-8-blue.svg)]() 5 | [![iOS](https://img.shields.io/badge/iOS-7.0-blue.svg)]() 6 | [![Language](https://img.shields.io/badge/language-ObjC-blue.svg)](https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/ProgrammingWithObjectiveC/Introduction/Introduction.html) 7 | 8 | ## 简介 9 | 10 | **FRDModuleManager** 是一个简单的 iOS 模块管理工具。如果你发现自己项目中实现了协议 UIApplicationDelegate 的 AppDelegate 变得越来越臃肿,你可能会需要这个小工具;如果你的项目实施了组件化或者模块化,你需要为各个模块在 UIApplicationDelegate 定义的各个方法内留下钩子(hook),以便模块可以知晓整个应用的生命周期,你可能会需要这个小工具。 11 | 12 | FRDModuleManager 可以减小 AppDelegate 的代码量,把很多职责拆分至各个模块中去。这样 AppDelegate 会变得容易维护。 13 | 14 | FRDModuleManager 可以使得留在 AppDelegate 的钩子方法被统一管理。实现了协议 UIApplicationDelegate 的 AppDelegate 是我知晓应用生命周期的重要途径。如果,某个模块需要在应用启动时初始化,那么我们就需要在 AppDelegate 的 15 | `application:didFinishLaunchingWithOptions:` 调用一个该模块的初始化方法。模块多了,调用的初始化方法也会增多。最后,AppDelegate 会越来越臃肿。FRDModuleManager 提供了一个统一的接口,让各模块知晓应用的生命周期。在 AppDelegate 中留下钩子,在特定的生命周期调用模块的对应方法。这样将使得 AppDelegate 更简单。对于应用生命周期的使用也更清晰。 16 | 17 | 18 | ## 安装 19 | 20 | ### 安装 Cocoapods 21 | 22 | [CocoaPods](http://cocoapods.org) 是一个 Objective-c 和 Swift 的依赖管理工具。你可以通过以下命令安装 CocoaPods: 23 | 24 | ```bash 25 | $ gem install cocoapods 26 | ``` 27 | 28 | ### Podfile 29 | 30 | ```ruby 31 | target 'TargetName' do 32 | pod 'FRDModuleManager', :git => 'https://github.com/lincode/FRDModuleManager.git', :commit => '0.1.0' 33 | end 34 | ``` 35 | 36 | 然后,运行以下命令: 37 | 38 | ```bash 39 | $ pod install 40 | ``` 41 | 42 | ## 使用 43 | 44 | 你可以查看 Demo 中的例子。了解如何使用 FRDModuleManager。Demo 给出了完善的示例。 45 | 46 | ### 加载所有模块 47 | 48 | ```Objective-C 49 | NSString* plistPath = [[NSBundle mainBundle] pathForResource:@"ModulesRegister" ofType:@"plist"]; 50 | FRDModuleManager *manager = [FRDModuleManager sharedInstance]; 51 | [manager loadModulesWithPlistFile:plistPath]; 52 | ``` 53 | 54 | FRDModuleManager 使用一个 plist 文件注册所有模块。你可以查看 Demo 中的 `ModulesRegister.plist` 文件查看注册模块的方法。该 plist 文件很简单,只有一个包含所有模块名的数组。 55 | 56 | ### 在 UIApplicationDelegate 各方法中留下钩子 57 | 58 | ```Objective-C 59 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 60 | 61 | NSString* plistPath = [[NSBundle mainBundle] pathForResource:@"ModulesRegister" ofType:@"plist"]; 62 | FRDModuleManager *manager = [FRDModuleManager sharedInstance]; 63 | [manager loadModulesWithPlistFile:plistPath]; 64 | 65 | [manager application:application didFinishLaunchingWithOptions:launchOptions]; 66 | 67 | return YES; 68 | } 69 | 70 | 71 | - (void)applicationWillResignActive:(UIApplication *)application { 72 | [[FRDModuleManager sharedInstance] applicationWillResignActive:application]; 73 | } 74 | 75 | - (void)applicationDidEnterBackground:(UIApplication *)application { 76 | [[FRDModuleManager sharedInstance] applicationDidEnterBackground:application]; 77 | } 78 | 79 | - (void)applicationWillEnterForeground:(UIApplication *)application { 80 | [[FRDModuleManager sharedInstance] applicationWillEnterForeground:application]; 81 | } 82 | 83 | - (void)applicationDidBecomeActive:(UIApplication *)application { 84 | [[FRDModuleManager sharedInstance] applicationDidBecomeActive:application]; 85 | } 86 | 87 | - (void)applicationWillTerminate:(UIApplication *)application { 88 | [[FRDModuleManager sharedInstance] applicationWillTerminate:application]; 89 | } 90 | 91 | #pragma mark - Handling Remote Notification 92 | 93 | - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken { 94 | [[FRDModuleManager sharedInstance] application:application didRegisterForRemoteNotificationsWithDeviceToken:deviceToken]; 95 | } 96 | 97 | - (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error { 98 | [[FRDModuleManager sharedInstance] application:application didFailToRegisterForRemoteNotificationsWithError:error]; 99 | } 100 | 101 | - (void)application:(UIApplication *)application 102 | didReceiveRemoteNotification:(NSDictionary *)userInfo 103 | fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))completionHandler 104 | { 105 | [[FRDModuleManager sharedInstance] application:application 106 | didReceiveRemoteNotification:userInfo 107 | fetchCompletionHandler:completionHandler]; 108 | } 109 | 110 | - (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification { 111 | [[FRDModuleManager sharedInstance] application:application 112 | didReceiveLocalNotification:notification]; 113 | } 114 | 115 | - (void)userNotificationCenter:(UNUserNotificationCenter *)center 116 | willPresentNotification:(UNNotification *)notification 117 | withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler 118 | { 119 | [[FRDModuleManager sharedInstance] userNotificationCenter:center 120 | willPresentNotification:notification 121 | withCompletionHandler:completionHandler]; 122 | } 123 | 124 | - (void)userNotificationCenter:(UNUserNotificationCenter *)center 125 | didReceiveNotificationResponse:(UNNotificationResponse *)response 126 | withCompletionHandler:(void (^)())completionHandler 127 | { 128 | [[FRDModuleManager sharedInstance] userNotificationCenter:center 129 | didReceiveNotificationResponse:response 130 | withCompletionHandler:completionHandler]; 131 | } 132 | 133 | ``` 134 | 135 | 在 FRDModuleManager 被 UIApplicationDelegate 各方法内留下的钩子调用时,会调用注册的每个模块的相同的方法。这样每个模块就都知晓了应用的生命周期。 136 | 137 | ## License 138 | 139 | FRDModuleManager is released under the MIT license. See LICENSE for details. 140 | --------------------------------------------------------------------------------