├── .gitignore ├── CUArchitectureDemo.xcodeproj └── project.pbxproj ├── CUArchitectureDemo ├── Base.lproj │ └── Main.storyboard ├── CUAppDelegate.h ├── CUAppDelegate.m ├── CUArchitectureDemo-Info.plist ├── CUArchitectureDemo-Prefix.pch ├── CUNotification.h ├── CUNotification.m ├── Images.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ └── LaunchImage.launchimage │ │ └── Contents.json ├── en.lproj │ └── InfoPlist.strings └── main.m ├── CUArchitectureDemoTests ├── CUArchitectureDemoTests-Info.plist ├── CUArchitectureDemoTests.m └── en.lproj │ └── InfoPlist.strings ├── DataLayer ├── CUDataDAO.h └── CUDataDAO.m ├── LICENSE ├── Models ├── CUDataModel.h ├── CUDataModel.m ├── CUDataSource.h └── CUDataSource.m ├── README.md └── ViewControllers ├── CUDetailViewController.h ├── CUDetailViewController.m ├── CUMainViewController.h ├── CUMainViewController.m ├── CUOtherViewController.h └── CUOtherViewController.m /.gitignore: -------------------------------------------------------------------------------- 1 | # git ignore template from: http://cocoaheads.tumblr.com/post/1350304132/gitignore-template-for-xcode3-4 2 | # Mac OS X Finder 3 | 4 | .DS_Store 5 | 6 | # Sparkle distribution Private Key (Don’t check me in!) 7 | 8 | dsa_priv.pem 9 | 10 | # XCode (and ancestors) per-user config (very noisy, and not relevant) 11 | 12 | *.mode1 13 | 14 | *.mode1v3 15 | 16 | *.mode2v3 17 | 18 | *.perspective 19 | 20 | *.perspectivev3 21 | 22 | *.pbxuser 23 | 24 | # Xcode 4 25 | 26 | xcuserdata/ 27 | 28 | project.xcworkspace/ 29 | 30 | # Generated files 31 | 32 | VersionX-revision.h 33 | 34 | # build products 35 | 36 | build/ 37 | 38 | *.[o] 39 | 40 | # Other source repository archive directories (protects when importing) 41 | 42 | .hg 43 | 44 | .svn 45 | 46 | CVS 47 | 48 | # automatic backup files 49 | 50 | *~.nib 51 | 52 | *.swp 53 | 54 | *~ 55 | 56 | *(Autosaved).rtfd/ 57 | 58 | Backup[ ]of[ ]*.pages/ 59 | 60 | Backup[ ]of[ ]*.key/ 61 | 62 | Backup[ ]of[ ]*.numbers/ 63 | 64 | /baiduhealth/Payload/ 65 | 66 | *.ipa 67 | *.xccheckout 68 | *.idea 69 | -------------------------------------------------------------------------------- /CUArchitectureDemo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 13BCF53719B59BF400C51C2F /* CUDataSource.m in Sources */ = {isa = PBXBuildFile; fileRef = 13BCF53619B59BF400C51C2F /* CUDataSource.m */; }; 11 | 13C6315619B06D82005D3724 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 13C6315519B06D82005D3724 /* Foundation.framework */; }; 12 | 13C6315819B06D82005D3724 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 13C6315719B06D82005D3724 /* CoreGraphics.framework */; }; 13 | 13C6315A19B06D82005D3724 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 13C6315919B06D82005D3724 /* UIKit.framework */; }; 14 | 13C6316019B06D82005D3724 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 13C6315E19B06D82005D3724 /* InfoPlist.strings */; }; 15 | 13C6316219B06D82005D3724 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13C6316119B06D82005D3724 /* main.m */; }; 16 | 13C6316619B06D82005D3724 /* CUAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 13C6316519B06D82005D3724 /* CUAppDelegate.m */; }; 17 | 13C6316919B06D82005D3724 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 13C6316719B06D82005D3724 /* Main.storyboard */; }; 18 | 13C6316E19B06D82005D3724 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13C6316D19B06D82005D3724 /* Images.xcassets */; }; 19 | 13C6317519B06D82005D3724 /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 13C6317419B06D82005D3724 /* XCTest.framework */; }; 20 | 13C6317619B06D82005D3724 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 13C6315519B06D82005D3724 /* Foundation.framework */; }; 21 | 13C6317719B06D82005D3724 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 13C6315919B06D82005D3724 /* UIKit.framework */; }; 22 | 13C6317F19B06D82005D3724 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 13C6317D19B06D82005D3724 /* InfoPlist.strings */; }; 23 | 13C6318119B06D82005D3724 /* CUArchitectureDemoTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 13C6318019B06D82005D3724 /* CUArchitectureDemoTests.m */; }; 24 | 13C6319719B06EB2005D3724 /* CUDetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 13C6319219B06EB2005D3724 /* CUDetailViewController.m */; }; 25 | 13C6319819B06EB2005D3724 /* CUMainViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 13C6319419B06EB2005D3724 /* CUMainViewController.m */; }; 26 | 13C6319D19B06EDF005D3724 /* CUDataModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 13C6319C19B06EDF005D3724 /* CUDataModel.m */; }; 27 | 13C631A219B06F1D005D3724 /* CUDataDAO.m in Sources */ = {isa = PBXBuildFile; fileRef = 13C631A119B06F1D005D3724 /* CUDataDAO.m */; }; 28 | 13C631A519B09F3D005D3724 /* CUOtherViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 13C631A419B09F3D005D3724 /* CUOtherViewController.m */; }; 29 | 13C631A819B0A0AD005D3724 /* CUNotification.m in Sources */ = {isa = PBXBuildFile; fileRef = 13C631A719B0A0AD005D3724 /* CUNotification.m */; }; 30 | /* End PBXBuildFile section */ 31 | 32 | /* Begin PBXContainerItemProxy section */ 33 | 13C6317819B06D82005D3724 /* PBXContainerItemProxy */ = { 34 | isa = PBXContainerItemProxy; 35 | containerPortal = 13C6314A19B06D82005D3724 /* Project object */; 36 | proxyType = 1; 37 | remoteGlobalIDString = 13C6315119B06D82005D3724; 38 | remoteInfo = CUArchitectureDemo; 39 | }; 40 | /* End PBXContainerItemProxy section */ 41 | 42 | /* Begin PBXFileReference section */ 43 | 13BCF53519B59BF400C51C2F /* CUDataSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CUDataSource.h; sourceTree = ""; }; 44 | 13BCF53619B59BF400C51C2F /* CUDataSource.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CUDataSource.m; sourceTree = ""; }; 45 | 13C6315219B06D82005D3724 /* CUArchitectureDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CUArchitectureDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 46 | 13C6315519B06D82005D3724 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 47 | 13C6315719B06D82005D3724 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 48 | 13C6315919B06D82005D3724 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 49 | 13C6315D19B06D82005D3724 /* CUArchitectureDemo-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "CUArchitectureDemo-Info.plist"; sourceTree = ""; }; 50 | 13C6315F19B06D82005D3724 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 51 | 13C6316119B06D82005D3724 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 52 | 13C6316319B06D82005D3724 /* CUArchitectureDemo-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "CUArchitectureDemo-Prefix.pch"; sourceTree = ""; }; 53 | 13C6316419B06D82005D3724 /* CUAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CUAppDelegate.h; sourceTree = ""; }; 54 | 13C6316519B06D82005D3724 /* CUAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CUAppDelegate.m; sourceTree = ""; }; 55 | 13C6316819B06D82005D3724 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 56 | 13C6316D19B06D82005D3724 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 57 | 13C6317319B06D82005D3724 /* CUArchitectureDemoTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = CUArchitectureDemoTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 58 | 13C6317419B06D82005D3724 /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; 59 | 13C6317C19B06D82005D3724 /* CUArchitectureDemoTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "CUArchitectureDemoTests-Info.plist"; sourceTree = ""; }; 60 | 13C6317E19B06D82005D3724 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 61 | 13C6318019B06D82005D3724 /* CUArchitectureDemoTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CUArchitectureDemoTests.m; sourceTree = ""; }; 62 | 13C6319119B06EB2005D3724 /* CUDetailViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CUDetailViewController.h; sourceTree = ""; }; 63 | 13C6319219B06EB2005D3724 /* CUDetailViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CUDetailViewController.m; sourceTree = ""; }; 64 | 13C6319319B06EB2005D3724 /* CUMainViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CUMainViewController.h; sourceTree = ""; }; 65 | 13C6319419B06EB2005D3724 /* CUMainViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CUMainViewController.m; sourceTree = ""; }; 66 | 13C6319B19B06EDF005D3724 /* CUDataModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CUDataModel.h; sourceTree = ""; }; 67 | 13C6319C19B06EDF005D3724 /* CUDataModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CUDataModel.m; sourceTree = ""; }; 68 | 13C631A019B06F1D005D3724 /* CUDataDAO.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CUDataDAO.h; sourceTree = ""; }; 69 | 13C631A119B06F1D005D3724 /* CUDataDAO.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CUDataDAO.m; sourceTree = ""; }; 70 | 13C631A319B09F3D005D3724 /* CUOtherViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CUOtherViewController.h; sourceTree = ""; }; 71 | 13C631A419B09F3D005D3724 /* CUOtherViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CUOtherViewController.m; sourceTree = ""; }; 72 | 13C631A619B0A0AD005D3724 /* CUNotification.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CUNotification.h; sourceTree = ""; }; 73 | 13C631A719B0A0AD005D3724 /* CUNotification.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CUNotification.m; sourceTree = ""; }; 74 | /* End PBXFileReference section */ 75 | 76 | /* Begin PBXFrameworksBuildPhase section */ 77 | 13C6314F19B06D82005D3724 /* Frameworks */ = { 78 | isa = PBXFrameworksBuildPhase; 79 | buildActionMask = 2147483647; 80 | files = ( 81 | 13C6315819B06D82005D3724 /* CoreGraphics.framework in Frameworks */, 82 | 13C6315A19B06D82005D3724 /* UIKit.framework in Frameworks */, 83 | 13C6315619B06D82005D3724 /* Foundation.framework in Frameworks */, 84 | ); 85 | runOnlyForDeploymentPostprocessing = 0; 86 | }; 87 | 13C6317019B06D82005D3724 /* Frameworks */ = { 88 | isa = PBXFrameworksBuildPhase; 89 | buildActionMask = 2147483647; 90 | files = ( 91 | 13C6317519B06D82005D3724 /* XCTest.framework in Frameworks */, 92 | 13C6317719B06D82005D3724 /* UIKit.framework in Frameworks */, 93 | 13C6317619B06D82005D3724 /* Foundation.framework in Frameworks */, 94 | ); 95 | runOnlyForDeploymentPostprocessing = 0; 96 | }; 97 | /* End PBXFrameworksBuildPhase section */ 98 | 99 | /* Begin PBXGroup section */ 100 | 13C6314919B06D82005D3724 = { 101 | isa = PBXGroup; 102 | children = ( 103 | 13C6319F19B06F12005D3724 /* DataLayer */, 104 | 13C6319A19B06EC4005D3724 /* Models */, 105 | 13C6319019B06EB2005D3724 /* ViewControllers */, 106 | 13C6315B19B06D82005D3724 /* CUArchitectureDemo */, 107 | 13C6317A19B06D82005D3724 /* CUArchitectureDemoTests */, 108 | 13C6315419B06D82005D3724 /* Frameworks */, 109 | 13C6315319B06D82005D3724 /* Products */, 110 | ); 111 | sourceTree = ""; 112 | }; 113 | 13C6315319B06D82005D3724 /* Products */ = { 114 | isa = PBXGroup; 115 | children = ( 116 | 13C6315219B06D82005D3724 /* CUArchitectureDemo.app */, 117 | 13C6317319B06D82005D3724 /* CUArchitectureDemoTests.xctest */, 118 | ); 119 | name = Products; 120 | sourceTree = ""; 121 | }; 122 | 13C6315419B06D82005D3724 /* Frameworks */ = { 123 | isa = PBXGroup; 124 | children = ( 125 | 13C6315519B06D82005D3724 /* Foundation.framework */, 126 | 13C6315719B06D82005D3724 /* CoreGraphics.framework */, 127 | 13C6315919B06D82005D3724 /* UIKit.framework */, 128 | 13C6317419B06D82005D3724 /* XCTest.framework */, 129 | ); 130 | name = Frameworks; 131 | sourceTree = ""; 132 | }; 133 | 13C6315B19B06D82005D3724 /* CUArchitectureDemo */ = { 134 | isa = PBXGroup; 135 | children = ( 136 | 13C6316419B06D82005D3724 /* CUAppDelegate.h */, 137 | 13C6316519B06D82005D3724 /* CUAppDelegate.m */, 138 | 13C6316719B06D82005D3724 /* Main.storyboard */, 139 | 13C6316D19B06D82005D3724 /* Images.xcassets */, 140 | 13C6315C19B06D82005D3724 /* Supporting Files */, 141 | 13C631A619B0A0AD005D3724 /* CUNotification.h */, 142 | 13C631A719B0A0AD005D3724 /* CUNotification.m */, 143 | ); 144 | path = CUArchitectureDemo; 145 | sourceTree = ""; 146 | }; 147 | 13C6315C19B06D82005D3724 /* Supporting Files */ = { 148 | isa = PBXGroup; 149 | children = ( 150 | 13C6315D19B06D82005D3724 /* CUArchitectureDemo-Info.plist */, 151 | 13C6315E19B06D82005D3724 /* InfoPlist.strings */, 152 | 13C6316119B06D82005D3724 /* main.m */, 153 | 13C6316319B06D82005D3724 /* CUArchitectureDemo-Prefix.pch */, 154 | ); 155 | name = "Supporting Files"; 156 | sourceTree = ""; 157 | }; 158 | 13C6317A19B06D82005D3724 /* CUArchitectureDemoTests */ = { 159 | isa = PBXGroup; 160 | children = ( 161 | 13C6318019B06D82005D3724 /* CUArchitectureDemoTests.m */, 162 | 13C6317B19B06D82005D3724 /* Supporting Files */, 163 | ); 164 | path = CUArchitectureDemoTests; 165 | sourceTree = ""; 166 | }; 167 | 13C6317B19B06D82005D3724 /* Supporting Files */ = { 168 | isa = PBXGroup; 169 | children = ( 170 | 13C6317C19B06D82005D3724 /* CUArchitectureDemoTests-Info.plist */, 171 | 13C6317D19B06D82005D3724 /* InfoPlist.strings */, 172 | ); 173 | name = "Supporting Files"; 174 | sourceTree = ""; 175 | }; 176 | 13C6319019B06EB2005D3724 /* ViewControllers */ = { 177 | isa = PBXGroup; 178 | children = ( 179 | 13C6319119B06EB2005D3724 /* CUDetailViewController.h */, 180 | 13C6319219B06EB2005D3724 /* CUDetailViewController.m */, 181 | 13C6319319B06EB2005D3724 /* CUMainViewController.h */, 182 | 13C6319419B06EB2005D3724 /* CUMainViewController.m */, 183 | 13C631A319B09F3D005D3724 /* CUOtherViewController.h */, 184 | 13C631A419B09F3D005D3724 /* CUOtherViewController.m */, 185 | ); 186 | path = ViewControllers; 187 | sourceTree = ""; 188 | }; 189 | 13C6319A19B06EC4005D3724 /* Models */ = { 190 | isa = PBXGroup; 191 | children = ( 192 | 13C6319B19B06EDF005D3724 /* CUDataModel.h */, 193 | 13C6319C19B06EDF005D3724 /* CUDataModel.m */, 194 | 13BCF53519B59BF400C51C2F /* CUDataSource.h */, 195 | 13BCF53619B59BF400C51C2F /* CUDataSource.m */, 196 | ); 197 | path = Models; 198 | sourceTree = ""; 199 | }; 200 | 13C6319F19B06F12005D3724 /* DataLayer */ = { 201 | isa = PBXGroup; 202 | children = ( 203 | 13C631A019B06F1D005D3724 /* CUDataDAO.h */, 204 | 13C631A119B06F1D005D3724 /* CUDataDAO.m */, 205 | ); 206 | path = DataLayer; 207 | sourceTree = ""; 208 | }; 209 | /* End PBXGroup section */ 210 | 211 | /* Begin PBXNativeTarget section */ 212 | 13C6315119B06D82005D3724 /* CUArchitectureDemo */ = { 213 | isa = PBXNativeTarget; 214 | buildConfigurationList = 13C6318419B06D82005D3724 /* Build configuration list for PBXNativeTarget "CUArchitectureDemo" */; 215 | buildPhases = ( 216 | 13C6314E19B06D82005D3724 /* Sources */, 217 | 13C6314F19B06D82005D3724 /* Frameworks */, 218 | 13C6315019B06D82005D3724 /* Resources */, 219 | ); 220 | buildRules = ( 221 | ); 222 | dependencies = ( 223 | ); 224 | name = CUArchitectureDemo; 225 | productName = CUArchitectureDemo; 226 | productReference = 13C6315219B06D82005D3724 /* CUArchitectureDemo.app */; 227 | productType = "com.apple.product-type.application"; 228 | }; 229 | 13C6317219B06D82005D3724 /* CUArchitectureDemoTests */ = { 230 | isa = PBXNativeTarget; 231 | buildConfigurationList = 13C6318719B06D82005D3724 /* Build configuration list for PBXNativeTarget "CUArchitectureDemoTests" */; 232 | buildPhases = ( 233 | 13C6316F19B06D82005D3724 /* Sources */, 234 | 13C6317019B06D82005D3724 /* Frameworks */, 235 | 13C6317119B06D82005D3724 /* Resources */, 236 | ); 237 | buildRules = ( 238 | ); 239 | dependencies = ( 240 | 13C6317919B06D82005D3724 /* PBXTargetDependency */, 241 | ); 242 | name = CUArchitectureDemoTests; 243 | productName = CUArchitectureDemoTests; 244 | productReference = 13C6317319B06D82005D3724 /* CUArchitectureDemoTests.xctest */; 245 | productType = "com.apple.product-type.bundle.unit-test"; 246 | }; 247 | /* End PBXNativeTarget section */ 248 | 249 | /* Begin PBXProject section */ 250 | 13C6314A19B06D82005D3724 /* Project object */ = { 251 | isa = PBXProject; 252 | attributes = { 253 | CLASSPREFIX = CU; 254 | LastUpgradeCheck = 0510; 255 | ORGANIZATIONNAME = lion; 256 | TargetAttributes = { 257 | 13C6317219B06D82005D3724 = { 258 | TestTargetID = 13C6315119B06D82005D3724; 259 | }; 260 | }; 261 | }; 262 | buildConfigurationList = 13C6314D19B06D82005D3724 /* Build configuration list for PBXProject "CUArchitectureDemo" */; 263 | compatibilityVersion = "Xcode 3.2"; 264 | developmentRegion = English; 265 | hasScannedForEncodings = 0; 266 | knownRegions = ( 267 | en, 268 | Base, 269 | ); 270 | mainGroup = 13C6314919B06D82005D3724; 271 | productRefGroup = 13C6315319B06D82005D3724 /* Products */; 272 | projectDirPath = ""; 273 | projectRoot = ""; 274 | targets = ( 275 | 13C6315119B06D82005D3724 /* CUArchitectureDemo */, 276 | 13C6317219B06D82005D3724 /* CUArchitectureDemoTests */, 277 | ); 278 | }; 279 | /* End PBXProject section */ 280 | 281 | /* Begin PBXResourcesBuildPhase section */ 282 | 13C6315019B06D82005D3724 /* Resources */ = { 283 | isa = PBXResourcesBuildPhase; 284 | buildActionMask = 2147483647; 285 | files = ( 286 | 13C6316E19B06D82005D3724 /* Images.xcassets in Resources */, 287 | 13C6316019B06D82005D3724 /* InfoPlist.strings in Resources */, 288 | 13C6316919B06D82005D3724 /* Main.storyboard in Resources */, 289 | ); 290 | runOnlyForDeploymentPostprocessing = 0; 291 | }; 292 | 13C6317119B06D82005D3724 /* Resources */ = { 293 | isa = PBXResourcesBuildPhase; 294 | buildActionMask = 2147483647; 295 | files = ( 296 | 13C6317F19B06D82005D3724 /* InfoPlist.strings in Resources */, 297 | ); 298 | runOnlyForDeploymentPostprocessing = 0; 299 | }; 300 | /* End PBXResourcesBuildPhase section */ 301 | 302 | /* Begin PBXSourcesBuildPhase section */ 303 | 13C6314E19B06D82005D3724 /* Sources */ = { 304 | isa = PBXSourcesBuildPhase; 305 | buildActionMask = 2147483647; 306 | files = ( 307 | 13BCF53719B59BF400C51C2F /* CUDataSource.m in Sources */, 308 | 13C631A219B06F1D005D3724 /* CUDataDAO.m in Sources */, 309 | 13C6316619B06D82005D3724 /* CUAppDelegate.m in Sources */, 310 | 13C631A819B0A0AD005D3724 /* CUNotification.m in Sources */, 311 | 13C6319819B06EB2005D3724 /* CUMainViewController.m in Sources */, 312 | 13C631A519B09F3D005D3724 /* CUOtherViewController.m in Sources */, 313 | 13C6316219B06D82005D3724 /* main.m in Sources */, 314 | 13C6319719B06EB2005D3724 /* CUDetailViewController.m in Sources */, 315 | 13C6319D19B06EDF005D3724 /* CUDataModel.m in Sources */, 316 | ); 317 | runOnlyForDeploymentPostprocessing = 0; 318 | }; 319 | 13C6316F19B06D82005D3724 /* Sources */ = { 320 | isa = PBXSourcesBuildPhase; 321 | buildActionMask = 2147483647; 322 | files = ( 323 | 13C6318119B06D82005D3724 /* CUArchitectureDemoTests.m in Sources */, 324 | ); 325 | runOnlyForDeploymentPostprocessing = 0; 326 | }; 327 | /* End PBXSourcesBuildPhase section */ 328 | 329 | /* Begin PBXTargetDependency section */ 330 | 13C6317919B06D82005D3724 /* PBXTargetDependency */ = { 331 | isa = PBXTargetDependency; 332 | target = 13C6315119B06D82005D3724 /* CUArchitectureDemo */; 333 | targetProxy = 13C6317819B06D82005D3724 /* PBXContainerItemProxy */; 334 | }; 335 | /* End PBXTargetDependency section */ 336 | 337 | /* Begin PBXVariantGroup section */ 338 | 13C6315E19B06D82005D3724 /* InfoPlist.strings */ = { 339 | isa = PBXVariantGroup; 340 | children = ( 341 | 13C6315F19B06D82005D3724 /* en */, 342 | ); 343 | name = InfoPlist.strings; 344 | sourceTree = ""; 345 | }; 346 | 13C6316719B06D82005D3724 /* Main.storyboard */ = { 347 | isa = PBXVariantGroup; 348 | children = ( 349 | 13C6316819B06D82005D3724 /* Base */, 350 | ); 351 | name = Main.storyboard; 352 | sourceTree = ""; 353 | }; 354 | 13C6317D19B06D82005D3724 /* InfoPlist.strings */ = { 355 | isa = PBXVariantGroup; 356 | children = ( 357 | 13C6317E19B06D82005D3724 /* en */, 358 | ); 359 | name = InfoPlist.strings; 360 | sourceTree = ""; 361 | }; 362 | /* End PBXVariantGroup section */ 363 | 364 | /* Begin XCBuildConfiguration section */ 365 | 13C6318219B06D82005D3724 /* Debug */ = { 366 | isa = XCBuildConfiguration; 367 | buildSettings = { 368 | ALWAYS_SEARCH_USER_PATHS = NO; 369 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 370 | CLANG_CXX_LIBRARY = "libc++"; 371 | CLANG_ENABLE_MODULES = YES; 372 | CLANG_ENABLE_OBJC_ARC = YES; 373 | CLANG_WARN_BOOL_CONVERSION = YES; 374 | CLANG_WARN_CONSTANT_CONVERSION = YES; 375 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 376 | CLANG_WARN_EMPTY_BODY = YES; 377 | CLANG_WARN_ENUM_CONVERSION = YES; 378 | CLANG_WARN_INT_CONVERSION = YES; 379 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 380 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 381 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 382 | COPY_PHASE_STRIP = NO; 383 | GCC_C_LANGUAGE_STANDARD = gnu99; 384 | GCC_DYNAMIC_NO_PIC = NO; 385 | GCC_OPTIMIZATION_LEVEL = 0; 386 | GCC_PREPROCESSOR_DEFINITIONS = ( 387 | "DEBUG=1", 388 | "$(inherited)", 389 | ); 390 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 391 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 392 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 393 | GCC_WARN_UNDECLARED_SELECTOR = YES; 394 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 395 | GCC_WARN_UNUSED_FUNCTION = YES; 396 | GCC_WARN_UNUSED_VARIABLE = YES; 397 | IPHONEOS_DEPLOYMENT_TARGET = 7.1; 398 | ONLY_ACTIVE_ARCH = YES; 399 | SDKROOT = iphoneos; 400 | }; 401 | name = Debug; 402 | }; 403 | 13C6318319B06D82005D3724 /* Release */ = { 404 | isa = XCBuildConfiguration; 405 | buildSettings = { 406 | ALWAYS_SEARCH_USER_PATHS = NO; 407 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 408 | CLANG_CXX_LIBRARY = "libc++"; 409 | CLANG_ENABLE_MODULES = YES; 410 | CLANG_ENABLE_OBJC_ARC = YES; 411 | CLANG_WARN_BOOL_CONVERSION = YES; 412 | CLANG_WARN_CONSTANT_CONVERSION = YES; 413 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 414 | CLANG_WARN_EMPTY_BODY = YES; 415 | CLANG_WARN_ENUM_CONVERSION = YES; 416 | CLANG_WARN_INT_CONVERSION = YES; 417 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 418 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 419 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 420 | COPY_PHASE_STRIP = YES; 421 | ENABLE_NS_ASSERTIONS = NO; 422 | GCC_C_LANGUAGE_STANDARD = gnu99; 423 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 424 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 425 | GCC_WARN_UNDECLARED_SELECTOR = YES; 426 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 427 | GCC_WARN_UNUSED_FUNCTION = YES; 428 | GCC_WARN_UNUSED_VARIABLE = YES; 429 | IPHONEOS_DEPLOYMENT_TARGET = 7.1; 430 | SDKROOT = iphoneos; 431 | VALIDATE_PRODUCT = YES; 432 | }; 433 | name = Release; 434 | }; 435 | 13C6318519B06D82005D3724 /* Debug */ = { 436 | isa = XCBuildConfiguration; 437 | buildSettings = { 438 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 439 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 440 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 441 | GCC_PREFIX_HEADER = "CUArchitectureDemo/CUArchitectureDemo-Prefix.pch"; 442 | INFOPLIST_FILE = "CUArchitectureDemo/CUArchitectureDemo-Info.plist"; 443 | PRODUCT_NAME = "$(TARGET_NAME)"; 444 | WRAPPER_EXTENSION = app; 445 | }; 446 | name = Debug; 447 | }; 448 | 13C6318619B06D82005D3724 /* Release */ = { 449 | isa = XCBuildConfiguration; 450 | buildSettings = { 451 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 452 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 453 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 454 | GCC_PREFIX_HEADER = "CUArchitectureDemo/CUArchitectureDemo-Prefix.pch"; 455 | INFOPLIST_FILE = "CUArchitectureDemo/CUArchitectureDemo-Info.plist"; 456 | PRODUCT_NAME = "$(TARGET_NAME)"; 457 | WRAPPER_EXTENSION = app; 458 | }; 459 | name = Release; 460 | }; 461 | 13C6318819B06D82005D3724 /* Debug */ = { 462 | isa = XCBuildConfiguration; 463 | buildSettings = { 464 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/CUArchitectureDemo.app/CUArchitectureDemo"; 465 | FRAMEWORK_SEARCH_PATHS = ( 466 | "$(SDKROOT)/Developer/Library/Frameworks", 467 | "$(inherited)", 468 | "$(DEVELOPER_FRAMEWORKS_DIR)", 469 | ); 470 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 471 | GCC_PREFIX_HEADER = "CUArchitectureDemo/CUArchitectureDemo-Prefix.pch"; 472 | GCC_PREPROCESSOR_DEFINITIONS = ( 473 | "DEBUG=1", 474 | "$(inherited)", 475 | ); 476 | INFOPLIST_FILE = "CUArchitectureDemoTests/CUArchitectureDemoTests-Info.plist"; 477 | PRODUCT_NAME = "$(TARGET_NAME)"; 478 | TEST_HOST = "$(BUNDLE_LOADER)"; 479 | WRAPPER_EXTENSION = xctest; 480 | }; 481 | name = Debug; 482 | }; 483 | 13C6318919B06D82005D3724 /* Release */ = { 484 | isa = XCBuildConfiguration; 485 | buildSettings = { 486 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/CUArchitectureDemo.app/CUArchitectureDemo"; 487 | FRAMEWORK_SEARCH_PATHS = ( 488 | "$(SDKROOT)/Developer/Library/Frameworks", 489 | "$(inherited)", 490 | "$(DEVELOPER_FRAMEWORKS_DIR)", 491 | ); 492 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 493 | GCC_PREFIX_HEADER = "CUArchitectureDemo/CUArchitectureDemo-Prefix.pch"; 494 | INFOPLIST_FILE = "CUArchitectureDemoTests/CUArchitectureDemoTests-Info.plist"; 495 | PRODUCT_NAME = "$(TARGET_NAME)"; 496 | TEST_HOST = "$(BUNDLE_LOADER)"; 497 | WRAPPER_EXTENSION = xctest; 498 | }; 499 | name = Release; 500 | }; 501 | /* End XCBuildConfiguration section */ 502 | 503 | /* Begin XCConfigurationList section */ 504 | 13C6314D19B06D82005D3724 /* Build configuration list for PBXProject "CUArchitectureDemo" */ = { 505 | isa = XCConfigurationList; 506 | buildConfigurations = ( 507 | 13C6318219B06D82005D3724 /* Debug */, 508 | 13C6318319B06D82005D3724 /* Release */, 509 | ); 510 | defaultConfigurationIsVisible = 0; 511 | defaultConfigurationName = Release; 512 | }; 513 | 13C6318419B06D82005D3724 /* Build configuration list for PBXNativeTarget "CUArchitectureDemo" */ = { 514 | isa = XCConfigurationList; 515 | buildConfigurations = ( 516 | 13C6318519B06D82005D3724 /* Debug */, 517 | 13C6318619B06D82005D3724 /* Release */, 518 | ); 519 | defaultConfigurationIsVisible = 0; 520 | defaultConfigurationName = Release; 521 | }; 522 | 13C6318719B06D82005D3724 /* Build configuration list for PBXNativeTarget "CUArchitectureDemoTests" */ = { 523 | isa = XCConfigurationList; 524 | buildConfigurations = ( 525 | 13C6318819B06D82005D3724 /* Debug */, 526 | 13C6318919B06D82005D3724 /* Release */, 527 | ); 528 | defaultConfigurationIsVisible = 0; 529 | defaultConfigurationName = Release; 530 | }; 531 | /* End XCConfigurationList section */ 532 | }; 533 | rootObject = 13C6314A19B06D82005D3724 /* Project object */; 534 | } 535 | -------------------------------------------------------------------------------- /CUArchitectureDemo/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 29 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 66 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 129 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | -------------------------------------------------------------------------------- /CUArchitectureDemo/CUAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // CUAppDelegate.h 3 | // CUArchitectureDemo 4 | // 5 | // Created by yuguang on 29/8/14. 6 | // Copyright (c) 2014 lion. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface CUAppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /CUArchitectureDemo/CUAppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // CUAppDelegate.m 3 | // CUArchitectureDemo 4 | // 5 | // Created by yuguang on 29/8/14. 6 | // Copyright (c) 2014 lion. All rights reserved. 7 | // 8 | 9 | #import "CUAppDelegate.h" 10 | 11 | @implementation CUAppDelegate 12 | 13 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 14 | { 15 | // Override point for customization after application launch. 16 | return YES; 17 | } 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /CUArchitectureDemo/CUArchitectureDemo-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | lion.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /CUArchitectureDemo/CUArchitectureDemo-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header 3 | // 4 | // The contents of this file are implicitly included at the beginning of every source file. 5 | // 6 | 7 | #import 8 | 9 | #ifndef __IPHONE_5_0 10 | #warning "This project uses features only available in iOS SDK 5.0 and later." 11 | #endif 12 | 13 | #ifdef __OBJC__ 14 | #import 15 | #import 16 | #import "CUNotification.h" 17 | #endif 18 | -------------------------------------------------------------------------------- /CUArchitectureDemo/CUNotification.h: -------------------------------------------------------------------------------- 1 | // 2 | // CUNotification.h 3 | // CUArchitectureDemo 4 | // 5 | // Created by yuguang on 29/8/14. 6 | // Copyright (c) 2014 lion. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | extern NSString *const kCUDataChangedNotification; -------------------------------------------------------------------------------- /CUArchitectureDemo/CUNotification.m: -------------------------------------------------------------------------------- 1 | // 2 | // CUNotification.m 3 | // CUArchitectureDemo 4 | // 5 | // Created by yuguang on 29/8/14. 6 | // Copyright (c) 2014 lion. All rights reserved. 7 | // 8 | 9 | #import "CUNotification.h" 10 | 11 | NSString *const kCUDataChangedNotification = @"CUDataChangedNotification"; 12 | -------------------------------------------------------------------------------- /CUArchitectureDemo/Images.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" : "40x40", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "60x60", 16 | "scale" : "2x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /CUArchitectureDemo/Images.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "portrait", 5 | "idiom" : "iphone", 6 | "extent" : "full-screen", 7 | "minimum-system-version" : "7.0", 8 | "scale" : "2x" 9 | }, 10 | { 11 | "orientation" : "portrait", 12 | "idiom" : "iphone", 13 | "subtype" : "retina4", 14 | "extent" : "full-screen", 15 | "minimum-system-version" : "7.0", 16 | "scale" : "2x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /CUArchitectureDemo/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /CUArchitectureDemo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // CUArchitectureDemo 4 | // 5 | // Created by yuguang on 29/8/14. 6 | // Copyright (c) 2014 lion. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "CUAppDelegate.h" 12 | 13 | int main(int argc, char * argv[]) 14 | { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([CUAppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /CUArchitectureDemoTests/CUArchitectureDemoTests-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | lion.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | BNDL 15 | CFBundleShortVersionString 16 | 1.0 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /CUArchitectureDemoTests/CUArchitectureDemoTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // CUArchitectureDemoTests.m 3 | // CUArchitectureDemoTests 4 | // 5 | // Created by yuguang on 29/8/14. 6 | // Copyright (c) 2014 lion. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface CUArchitectureDemoTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation CUArchitectureDemoTests 16 | 17 | - (void)setUp 18 | { 19 | [super setUp]; 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | } 22 | 23 | - (void)tearDown 24 | { 25 | // Put teardown code here. This method is called after the invocation of each test method in the class. 26 | [super tearDown]; 27 | } 28 | 29 | - (void)testExample 30 | { 31 | XCTFail(@"No implementation for \"%s\"", __PRETTY_FUNCTION__); 32 | } 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /CUArchitectureDemoTests/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /DataLayer/CUDataDAO.h: -------------------------------------------------------------------------------- 1 | // 2 | // CUDataDAO.h 3 | // CUArchitectureDemo 4 | // 5 | // Created by yuguang on 29/8/14. 6 | // Copyright (c) 2014 lion. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class CUDataModel; 12 | @interface CUDataDAO : NSObject 13 | 14 | + (CUDataModel *)selectData; 15 | + (void)setData:(int)data; 16 | + (void)randomData; 17 | 18 | + (CUDataModel *)selectOtherData; 19 | + (void)setOtherData:(int)data; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /DataLayer/CUDataDAO.m: -------------------------------------------------------------------------------- 1 | // 2 | // CUDataDAO.m 3 | // CUArchitectureDemo 4 | // 5 | // Created by yuguang on 29/8/14. 6 | // Copyright (c) 2014 lion. All rights reserved. 7 | // 8 | 9 | #import "CUDataDAO.h" 10 | #import "CUDataModel.h" 11 | 12 | 13 | static int s_data = 55; 14 | static __strong NSTimer *s_timer = nil; 15 | 16 | static int s_otherData = 15; 17 | 18 | @implementation CUDataDAO 19 | 20 | + (void)initialize { 21 | // if (s_timer == nil) { 22 | // s_timer = [NSTimer scheduledTimerWithTimeInterval:1.0f 23 | // target:self 24 | // selector:@selector(mockProc) 25 | // userInfo:nil 26 | // repeats:YES]; 27 | // } 28 | } 29 | 30 | + (CUDataModel *)selectData { 31 | 32 | NSLog(@"%s", sel_getName(_cmd)); 33 | 34 | CUDataModel *model = [CUDataModel new]; 35 | model.data = @(s_data); 36 | return model; 37 | } 38 | 39 | + (void)randomData { 40 | s_data = arc4random() % 1000; 41 | } 42 | 43 | + (void)setData:(int)data { 44 | if (data != s_data) { 45 | s_data = data; 46 | } 47 | } 48 | 49 | + (CUDataModel *)selectOtherData { 50 | NSLog(@"%s", sel_getName(_cmd)); 51 | 52 | CUDataModel *model = [CUDataModel new]; 53 | model.data = @(s_otherData); 54 | return model; 55 | } 56 | 57 | + (void)setOtherData:(int)data { 58 | if (data != s_otherData) { 59 | s_otherData = data; 60 | } 61 | } 62 | 63 | + (void)mockProc { 64 | [CUDataDAO randomData]; 65 | } 66 | 67 | @end 68 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 curer 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 | -------------------------------------------------------------------------------- /Models/CUDataModel.h: -------------------------------------------------------------------------------- 1 | // 2 | // CUDataModel.h 3 | // CUArchitectureDemo 4 | // 5 | // Created by yuguang on 29/8/14. 6 | // Copyright (c) 2014 lion. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface CUDataModel : NSObject 12 | 13 | @property (nonatomic, strong) NSNumber *data; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Models/CUDataModel.m: -------------------------------------------------------------------------------- 1 | // 2 | // CUDataModel.m 3 | // CUArchitectureDemo 4 | // 5 | // Created by yuguang on 29/8/14. 6 | // Copyright (c) 2014 lion. All rights reserved. 7 | // 8 | 9 | #import "CUDataModel.h" 10 | 11 | @implementation CUDataModel 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Models/CUDataSource.h: -------------------------------------------------------------------------------- 1 | // 2 | // CUDataSource.h 3 | // CUArchitectureDemo 4 | // 5 | // Created by yuguang on 2/9/14. 6 | // Copyright (c) 2014 lion. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class CUDataModel; 12 | @interface CUDataSource : NSObject 13 | 14 | @property (nonatomic, strong, readonly) NSNumber *data; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /Models/CUDataSource.m: -------------------------------------------------------------------------------- 1 | // 2 | // CUDataSource.m 3 | // CUArchitectureDemo 4 | // 5 | // Created by yuguang on 2/9/14. 6 | // Copyright (c) 2014 lion. All rights reserved. 7 | // 8 | 9 | #import "CUDataSource.h" 10 | #import "CUDataModel.h" 11 | #import "CUDataDAO.h" 12 | 13 | @interface CUDataSource () 14 | 15 | @property (nonatomic, strong) NSNumber *data; 16 | 17 | @end 18 | 19 | @implementation CUDataSource 20 | 21 | - (instancetype)init { 22 | if (self = [super init]) { 23 | [[NSNotificationCenter defaultCenter] addObserver:self 24 | selector:@selector(handleDataChanged) 25 | name:kCUDataChangedNotification 26 | object:nil]; 27 | [self updateData]; 28 | } 29 | 30 | return self; 31 | } 32 | 33 | - (void)dealloc { 34 | [[NSNotificationCenter defaultCenter] removeObserver:self]; 35 | } 36 | 37 | - (void)updateData { 38 | CUDataModel *dataA = [CUDataDAO selectData]; 39 | CUDataModel *dataOther = [CUDataDAO selectOtherData]; 40 | 41 | self.data = @([dataA.data intValue] + [dataOther.data intValue]); 42 | } 43 | 44 | #pragma mark - notification 45 | 46 | - (void)handleDataChanged { 47 | [self updateData]; 48 | } 49 | 50 | @end 51 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | CUArchitectureDemo 2 | ================== 3 | 4 | more information on [blog](http://studentdeng.github.io/blog/2014/08/29/ios-architecture/) 5 | -------------------------------------------------------------------------------- /ViewControllers/CUDetailViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // CUDetailViewController.h 3 | // CUArchitectureDemo 4 | // 5 | // Created by yuguang on 29/8/14. 6 | // Copyright (c) 2014 lion. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class CUDetailViewController; 12 | 13 | @interface CUDetailViewController : UIViewController 14 | 15 | - (void)updateLabel; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /ViewControllers/CUDetailViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // CUDetailViewController.m 3 | // CUArchitectureDemo 4 | // 5 | // Created by yuguang on 29/8/14. 6 | // Copyright (c) 2014 lion. All rights reserved. 7 | // 8 | 9 | #import "CUDetailViewController.h" 10 | #import "CUDataDAO.h" 11 | #import "CUDataModel.h" 12 | #import "CUDataSource.h" 13 | 14 | @interface CUDetailViewController () 15 | 16 | @property (weak, nonatomic) IBOutlet UILabel *displayLabel; 17 | @property (strong, nonatomic) CUDataSource *dataSource; 18 | @end 19 | 20 | @implementation CUDetailViewController 21 | 22 | - (void)awakeFromNib { 23 | self.dataSource = [CUDataSource new]; 24 | [self.dataSource addObserver:self 25 | forKeyPath:@"data" 26 | options:NSKeyValueObservingOptionNew 27 | context:NULL]; 28 | } 29 | 30 | - (void)dealloc { 31 | [self.dataSource removeObserver:self forKeyPath:@"data"]; 32 | } 33 | 34 | - (void)viewDidLoad { 35 | [super viewDidLoad]; 36 | // Do any additional setup after loading the view. 37 | 38 | [self updateLabel]; 39 | } 40 | 41 | - (void)didReceiveMemoryWarning { 42 | [super didReceiveMemoryWarning]; 43 | // Dispose of any resources that can be recreated. 44 | } 45 | 46 | - (void)updateLabel { 47 | self.displayLabel.text = [self.dataSource.data stringValue]; 48 | } 49 | 50 | #pragma mark - action 51 | 52 | - (IBAction)changeButtonClicked:(id)sender { 53 | int value = arc4random() % 100; 54 | [CUDataDAO setData:value]; 55 | [[NSNotificationCenter defaultCenter] postNotificationName:kCUDataChangedNotification 56 | object:nil 57 | userInfo:nil]; 58 | } 59 | 60 | #pragma mark - Notification 61 | 62 | - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { 63 | if (object == self.dataSource && [keyPath isEqualToString:@"data"]) { 64 | [self updateLabel]; 65 | } 66 | } 67 | 68 | @end 69 | -------------------------------------------------------------------------------- /ViewControllers/CUMainViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // CUMainViewController.h 3 | // CUArchitectureDemo 4 | // 5 | // Created by yuguang on 29/8/14. 6 | // Copyright (c) 2014 lion. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface CUMainViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /ViewControllers/CUMainViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // CUMainViewController.m 3 | // CUArchitectureDemo 4 | // 5 | // Created by yuguang on 29/8/14. 6 | // Copyright (c) 2014 lion. All rights reserved. 7 | // 8 | 9 | #import "CUMainViewController.h" 10 | #import "CUDataDAO.h" 11 | #import "CUDataModel.h" 12 | #import "CUDataSource.h" 13 | 14 | @interface CUMainViewController () 15 | 16 | @property (weak, nonatomic) IBOutlet UILabel *displayLabel; 17 | @property (strong, nonatomic) CUDataSource *dataSource; 18 | 19 | @end 20 | 21 | @implementation CUMainViewController 22 | 23 | - (void)awakeFromNib { 24 | self.dataSource = [CUDataSource new]; 25 | [self.dataSource addObserver:self 26 | forKeyPath:@"data" 27 | options:NSKeyValueObservingOptionNew 28 | context:NULL]; 29 | } 30 | 31 | - (void)dealloc { 32 | [self.dataSource removeObserver:self forKeyPath:@"data"]; 33 | } 34 | 35 | - (void)viewDidLoad { 36 | [super viewDidLoad]; 37 | // Do any additional setup after loading the view. 38 | [self updateLabel]; 39 | } 40 | 41 | - (void)updateLabel { 42 | self.displayLabel.text = [self.dataSource.data stringValue]; 43 | } 44 | 45 | #pragma mark - Notification 46 | 47 | - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { 48 | if (object == self.dataSource && [keyPath isEqualToString:@"data"]) { 49 | [self updateLabel]; 50 | } 51 | } 52 | 53 | @end 54 | -------------------------------------------------------------------------------- /ViewControllers/CUOtherViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // CUOtherViewController.h 3 | // CUArchitectureDemo 4 | // 5 | // Created by yuguang on 29/8/14. 6 | // Copyright (c) 2014 lion. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface CUOtherViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /ViewControllers/CUOtherViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // CUOtherViewController.m 3 | // CUArchitectureDemo 4 | // 5 | // Created by yuguang on 29/8/14. 6 | // Copyright (c) 2014 lion. All rights reserved. 7 | // 8 | 9 | #import "CUOtherViewController.h" 10 | #import "CUDataDAO.h" 11 | #import "CUDataModel.h" 12 | #import "CUDataSource.h" 13 | 14 | @interface CUOtherViewController () 15 | 16 | @property (weak, nonatomic) IBOutlet UILabel *dataLabel; 17 | @property (strong, nonatomic) CUDataSource *dataSource; 18 | 19 | @end 20 | 21 | @implementation CUOtherViewController 22 | 23 | - (void)awakeFromNib { 24 | self.dataSource = [CUDataSource new]; 25 | [self.dataSource addObserver:self 26 | forKeyPath:@"data" 27 | options:NSKeyValueObservingOptionNew 28 | context:NULL]; 29 | } 30 | 31 | - (void)viewDidLoad { 32 | [super viewDidLoad]; 33 | // Do any additional setup after loading the view. 34 | [self updateLabel]; 35 | } 36 | 37 | - (void)updateLabel { 38 | self.dataLabel.text = [self.dataSource.data stringValue]; 39 | } 40 | 41 | #pragma mark - action 42 | 43 | - (IBAction)changeButtonClicked:(id)sender { 44 | [CUDataDAO setOtherData:arc4random() % 100]; 45 | 46 | [[NSNotificationCenter defaultCenter] postNotificationName:kCUDataChangedNotification 47 | object:nil 48 | userInfo:nil]; 49 | } 50 | 51 | #pragma mark - notification 52 | 53 | - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { 54 | if (object == self.dataSource && [keyPath isEqualToString:@"data"]) { 55 | [self updateLabel]; 56 | } 57 | } 58 | 59 | @end 60 | --------------------------------------------------------------------------------