├── MVPDemo.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ └── contents.xcworkspacedata └── xcuserdata │ └── hewei.xcuserdatad │ ├── xcdebugger │ └── Breakpoints_v2.xcbkptlist │ └── xcschemes │ ├── MVPDemo.xcscheme │ └── xcschememanagement.plist ├── MVPDemo ├── AppDelegate.h ├── AppDelegate.m ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── Info.plist ├── Presenter.h ├── Presenter.m ├── UserService.h ├── UserService.m ├── UserViewProtocol.h ├── ViewController.h ├── ViewController.m └── main.m ├── MVPDemoTests ├── Info.plist └── MVPDemoTests.m ├── MVPDemoUITests ├── Info.plist └── MVPDemoUITests.m └── README.md /MVPDemo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 5DB103B71D700F95003CB514 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 5DB103B61D700F95003CB514 /* main.m */; }; 11 | 5DB103BA1D700F95003CB514 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 5DB103B91D700F95003CB514 /* AppDelegate.m */; }; 12 | 5DB103BD1D700F95003CB514 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5DB103BC1D700F95003CB514 /* ViewController.m */; }; 13 | 5DB103C01D700F95003CB514 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 5DB103BE1D700F95003CB514 /* Main.storyboard */; }; 14 | 5DB103C21D700F95003CB514 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 5DB103C11D700F95003CB514 /* Assets.xcassets */; }; 15 | 5DB103C51D700F95003CB514 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 5DB103C31D700F95003CB514 /* LaunchScreen.storyboard */; }; 16 | 5DB103D01D700F95003CB514 /* MVPDemoTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 5DB103CF1D700F95003CB514 /* MVPDemoTests.m */; }; 17 | 5DB103DB1D700F96003CB514 /* MVPDemoUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = 5DB103DA1D700F96003CB514 /* MVPDemoUITests.m */; }; 18 | 5DB103EA1D701110003CB514 /* UserService.m in Sources */ = {isa = PBXBuildFile; fileRef = 5DB103E91D701110003CB514 /* UserService.m */; }; 19 | 5DB103ED1D7016DC003CB514 /* Presenter.m in Sources */ = {isa = PBXBuildFile; fileRef = 5DB103EC1D7016DC003CB514 /* Presenter.m */; }; 20 | /* End PBXBuildFile section */ 21 | 22 | /* Begin PBXContainerItemProxy section */ 23 | 5DB103CC1D700F95003CB514 /* PBXContainerItemProxy */ = { 24 | isa = PBXContainerItemProxy; 25 | containerPortal = 5DB103AA1D700F94003CB514 /* Project object */; 26 | proxyType = 1; 27 | remoteGlobalIDString = 5DB103B11D700F94003CB514; 28 | remoteInfo = MVPDemo; 29 | }; 30 | 5DB103D71D700F95003CB514 /* PBXContainerItemProxy */ = { 31 | isa = PBXContainerItemProxy; 32 | containerPortal = 5DB103AA1D700F94003CB514 /* Project object */; 33 | proxyType = 1; 34 | remoteGlobalIDString = 5DB103B11D700F94003CB514; 35 | remoteInfo = MVPDemo; 36 | }; 37 | /* End PBXContainerItemProxy section */ 38 | 39 | /* Begin PBXFileReference section */ 40 | 5DB103B21D700F95003CB514 /* MVPDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MVPDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 41 | 5DB103B61D700F95003CB514 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 42 | 5DB103B81D700F95003CB514 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 43 | 5DB103B91D700F95003CB514 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 44 | 5DB103BB1D700F95003CB514 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 45 | 5DB103BC1D700F95003CB514 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 46 | 5DB103BF1D700F95003CB514 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 47 | 5DB103C11D700F95003CB514 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 48 | 5DB103C41D700F95003CB514 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 49 | 5DB103C61D700F95003CB514 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 50 | 5DB103CB1D700F95003CB514 /* MVPDemoTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = MVPDemoTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 51 | 5DB103CF1D700F95003CB514 /* MVPDemoTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MVPDemoTests.m; sourceTree = ""; }; 52 | 5DB103D11D700F95003CB514 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 53 | 5DB103D61D700F95003CB514 /* MVPDemoUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = MVPDemoUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 54 | 5DB103DA1D700F96003CB514 /* MVPDemoUITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MVPDemoUITests.m; sourceTree = ""; }; 55 | 5DB103DC1D700F96003CB514 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 56 | 5DB103E81D701110003CB514 /* UserService.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UserService.h; sourceTree = ""; }; 57 | 5DB103E91D701110003CB514 /* UserService.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UserService.m; sourceTree = ""; }; 58 | 5DB103EB1D7016DC003CB514 /* Presenter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Presenter.h; sourceTree = ""; }; 59 | 5DB103EC1D7016DC003CB514 /* Presenter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Presenter.m; sourceTree = ""; }; 60 | 5DB103EE1D7018BE003CB514 /* UserViewProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UserViewProtocol.h; sourceTree = ""; }; 61 | /* End PBXFileReference section */ 62 | 63 | /* Begin PBXFrameworksBuildPhase section */ 64 | 5DB103AF1D700F94003CB514 /* Frameworks */ = { 65 | isa = PBXFrameworksBuildPhase; 66 | buildActionMask = 2147483647; 67 | files = ( 68 | ); 69 | runOnlyForDeploymentPostprocessing = 0; 70 | }; 71 | 5DB103C81D700F95003CB514 /* Frameworks */ = { 72 | isa = PBXFrameworksBuildPhase; 73 | buildActionMask = 2147483647; 74 | files = ( 75 | ); 76 | runOnlyForDeploymentPostprocessing = 0; 77 | }; 78 | 5DB103D31D700F95003CB514 /* Frameworks */ = { 79 | isa = PBXFrameworksBuildPhase; 80 | buildActionMask = 2147483647; 81 | files = ( 82 | ); 83 | runOnlyForDeploymentPostprocessing = 0; 84 | }; 85 | /* End PBXFrameworksBuildPhase section */ 86 | 87 | /* Begin PBXGroup section */ 88 | 5DB103A91D700F94003CB514 = { 89 | isa = PBXGroup; 90 | children = ( 91 | 5DB103B41D700F95003CB514 /* MVPDemo */, 92 | 5DB103CE1D700F95003CB514 /* MVPDemoTests */, 93 | 5DB103D91D700F95003CB514 /* MVPDemoUITests */, 94 | 5DB103B31D700F95003CB514 /* Products */, 95 | ); 96 | sourceTree = ""; 97 | }; 98 | 5DB103B31D700F95003CB514 /* Products */ = { 99 | isa = PBXGroup; 100 | children = ( 101 | 5DB103B21D700F95003CB514 /* MVPDemo.app */, 102 | 5DB103CB1D700F95003CB514 /* MVPDemoTests.xctest */, 103 | 5DB103D61D700F95003CB514 /* MVPDemoUITests.xctest */, 104 | ); 105 | name = Products; 106 | sourceTree = ""; 107 | }; 108 | 5DB103B41D700F95003CB514 /* MVPDemo */ = { 109 | isa = PBXGroup; 110 | children = ( 111 | 5DB103EE1D7018BE003CB514 /* UserViewProtocol.h */, 112 | 5DB103E81D701110003CB514 /* UserService.h */, 113 | 5DB103E91D701110003CB514 /* UserService.m */, 114 | 5DB103EB1D7016DC003CB514 /* Presenter.h */, 115 | 5DB103EC1D7016DC003CB514 /* Presenter.m */, 116 | 5DB103B81D700F95003CB514 /* AppDelegate.h */, 117 | 5DB103B91D700F95003CB514 /* AppDelegate.m */, 118 | 5DB103BB1D700F95003CB514 /* ViewController.h */, 119 | 5DB103BC1D700F95003CB514 /* ViewController.m */, 120 | 5DB103BE1D700F95003CB514 /* Main.storyboard */, 121 | 5DB103C11D700F95003CB514 /* Assets.xcassets */, 122 | 5DB103C31D700F95003CB514 /* LaunchScreen.storyboard */, 123 | 5DB103C61D700F95003CB514 /* Info.plist */, 124 | 5DB103B51D700F95003CB514 /* Supporting Files */, 125 | ); 126 | path = MVPDemo; 127 | sourceTree = ""; 128 | }; 129 | 5DB103B51D700F95003CB514 /* Supporting Files */ = { 130 | isa = PBXGroup; 131 | children = ( 132 | 5DB103B61D700F95003CB514 /* main.m */, 133 | ); 134 | name = "Supporting Files"; 135 | sourceTree = ""; 136 | }; 137 | 5DB103CE1D700F95003CB514 /* MVPDemoTests */ = { 138 | isa = PBXGroup; 139 | children = ( 140 | 5DB103CF1D700F95003CB514 /* MVPDemoTests.m */, 141 | 5DB103D11D700F95003CB514 /* Info.plist */, 142 | ); 143 | path = MVPDemoTests; 144 | sourceTree = ""; 145 | }; 146 | 5DB103D91D700F95003CB514 /* MVPDemoUITests */ = { 147 | isa = PBXGroup; 148 | children = ( 149 | 5DB103DA1D700F96003CB514 /* MVPDemoUITests.m */, 150 | 5DB103DC1D700F96003CB514 /* Info.plist */, 151 | ); 152 | path = MVPDemoUITests; 153 | sourceTree = ""; 154 | }; 155 | /* End PBXGroup section */ 156 | 157 | /* Begin PBXNativeTarget section */ 158 | 5DB103B11D700F94003CB514 /* MVPDemo */ = { 159 | isa = PBXNativeTarget; 160 | buildConfigurationList = 5DB103DF1D700F96003CB514 /* Build configuration list for PBXNativeTarget "MVPDemo" */; 161 | buildPhases = ( 162 | 5DB103AE1D700F94003CB514 /* Sources */, 163 | 5DB103AF1D700F94003CB514 /* Frameworks */, 164 | 5DB103B01D700F94003CB514 /* Resources */, 165 | ); 166 | buildRules = ( 167 | ); 168 | dependencies = ( 169 | ); 170 | name = MVPDemo; 171 | productName = MVPDemo; 172 | productReference = 5DB103B21D700F95003CB514 /* MVPDemo.app */; 173 | productType = "com.apple.product-type.application"; 174 | }; 175 | 5DB103CA1D700F95003CB514 /* MVPDemoTests */ = { 176 | isa = PBXNativeTarget; 177 | buildConfigurationList = 5DB103E21D700F96003CB514 /* Build configuration list for PBXNativeTarget "MVPDemoTests" */; 178 | buildPhases = ( 179 | 5DB103C71D700F95003CB514 /* Sources */, 180 | 5DB103C81D700F95003CB514 /* Frameworks */, 181 | 5DB103C91D700F95003CB514 /* Resources */, 182 | ); 183 | buildRules = ( 184 | ); 185 | dependencies = ( 186 | 5DB103CD1D700F95003CB514 /* PBXTargetDependency */, 187 | ); 188 | name = MVPDemoTests; 189 | productName = MVPDemoTests; 190 | productReference = 5DB103CB1D700F95003CB514 /* MVPDemoTests.xctest */; 191 | productType = "com.apple.product-type.bundle.unit-test"; 192 | }; 193 | 5DB103D51D700F95003CB514 /* MVPDemoUITests */ = { 194 | isa = PBXNativeTarget; 195 | buildConfigurationList = 5DB103E51D700F96003CB514 /* Build configuration list for PBXNativeTarget "MVPDemoUITests" */; 196 | buildPhases = ( 197 | 5DB103D21D700F95003CB514 /* Sources */, 198 | 5DB103D31D700F95003CB514 /* Frameworks */, 199 | 5DB103D41D700F95003CB514 /* Resources */, 200 | ); 201 | buildRules = ( 202 | ); 203 | dependencies = ( 204 | 5DB103D81D700F95003CB514 /* PBXTargetDependency */, 205 | ); 206 | name = MVPDemoUITests; 207 | productName = MVPDemoUITests; 208 | productReference = 5DB103D61D700F95003CB514 /* MVPDemoUITests.xctest */; 209 | productType = "com.apple.product-type.bundle.ui-testing"; 210 | }; 211 | /* End PBXNativeTarget section */ 212 | 213 | /* Begin PBXProject section */ 214 | 5DB103AA1D700F94003CB514 /* Project object */ = { 215 | isa = PBXProject; 216 | attributes = { 217 | LastUpgradeCheck = 0730; 218 | ORGANIZATIONNAME = Hecv; 219 | TargetAttributes = { 220 | 5DB103B11D700F94003CB514 = { 221 | CreatedOnToolsVersion = 7.3; 222 | }; 223 | 5DB103CA1D700F95003CB514 = { 224 | CreatedOnToolsVersion = 7.3; 225 | TestTargetID = 5DB103B11D700F94003CB514; 226 | }; 227 | 5DB103D51D700F95003CB514 = { 228 | CreatedOnToolsVersion = 7.3; 229 | TestTargetID = 5DB103B11D700F94003CB514; 230 | }; 231 | }; 232 | }; 233 | buildConfigurationList = 5DB103AD1D700F94003CB514 /* Build configuration list for PBXProject "MVPDemo" */; 234 | compatibilityVersion = "Xcode 3.2"; 235 | developmentRegion = English; 236 | hasScannedForEncodings = 0; 237 | knownRegions = ( 238 | en, 239 | Base, 240 | ); 241 | mainGroup = 5DB103A91D700F94003CB514; 242 | productRefGroup = 5DB103B31D700F95003CB514 /* Products */; 243 | projectDirPath = ""; 244 | projectRoot = ""; 245 | targets = ( 246 | 5DB103B11D700F94003CB514 /* MVPDemo */, 247 | 5DB103CA1D700F95003CB514 /* MVPDemoTests */, 248 | 5DB103D51D700F95003CB514 /* MVPDemoUITests */, 249 | ); 250 | }; 251 | /* End PBXProject section */ 252 | 253 | /* Begin PBXResourcesBuildPhase section */ 254 | 5DB103B01D700F94003CB514 /* Resources */ = { 255 | isa = PBXResourcesBuildPhase; 256 | buildActionMask = 2147483647; 257 | files = ( 258 | 5DB103C51D700F95003CB514 /* LaunchScreen.storyboard in Resources */, 259 | 5DB103C21D700F95003CB514 /* Assets.xcassets in Resources */, 260 | 5DB103C01D700F95003CB514 /* Main.storyboard in Resources */, 261 | ); 262 | runOnlyForDeploymentPostprocessing = 0; 263 | }; 264 | 5DB103C91D700F95003CB514 /* Resources */ = { 265 | isa = PBXResourcesBuildPhase; 266 | buildActionMask = 2147483647; 267 | files = ( 268 | ); 269 | runOnlyForDeploymentPostprocessing = 0; 270 | }; 271 | 5DB103D41D700F95003CB514 /* Resources */ = { 272 | isa = PBXResourcesBuildPhase; 273 | buildActionMask = 2147483647; 274 | files = ( 275 | ); 276 | runOnlyForDeploymentPostprocessing = 0; 277 | }; 278 | /* End PBXResourcesBuildPhase section */ 279 | 280 | /* Begin PBXSourcesBuildPhase section */ 281 | 5DB103AE1D700F94003CB514 /* Sources */ = { 282 | isa = PBXSourcesBuildPhase; 283 | buildActionMask = 2147483647; 284 | files = ( 285 | 5DB103ED1D7016DC003CB514 /* Presenter.m in Sources */, 286 | 5DB103BD1D700F95003CB514 /* ViewController.m in Sources */, 287 | 5DB103EA1D701110003CB514 /* UserService.m in Sources */, 288 | 5DB103BA1D700F95003CB514 /* AppDelegate.m in Sources */, 289 | 5DB103B71D700F95003CB514 /* main.m in Sources */, 290 | ); 291 | runOnlyForDeploymentPostprocessing = 0; 292 | }; 293 | 5DB103C71D700F95003CB514 /* Sources */ = { 294 | isa = PBXSourcesBuildPhase; 295 | buildActionMask = 2147483647; 296 | files = ( 297 | 5DB103D01D700F95003CB514 /* MVPDemoTests.m in Sources */, 298 | ); 299 | runOnlyForDeploymentPostprocessing = 0; 300 | }; 301 | 5DB103D21D700F95003CB514 /* Sources */ = { 302 | isa = PBXSourcesBuildPhase; 303 | buildActionMask = 2147483647; 304 | files = ( 305 | 5DB103DB1D700F96003CB514 /* MVPDemoUITests.m in Sources */, 306 | ); 307 | runOnlyForDeploymentPostprocessing = 0; 308 | }; 309 | /* End PBXSourcesBuildPhase section */ 310 | 311 | /* Begin PBXTargetDependency section */ 312 | 5DB103CD1D700F95003CB514 /* PBXTargetDependency */ = { 313 | isa = PBXTargetDependency; 314 | target = 5DB103B11D700F94003CB514 /* MVPDemo */; 315 | targetProxy = 5DB103CC1D700F95003CB514 /* PBXContainerItemProxy */; 316 | }; 317 | 5DB103D81D700F95003CB514 /* PBXTargetDependency */ = { 318 | isa = PBXTargetDependency; 319 | target = 5DB103B11D700F94003CB514 /* MVPDemo */; 320 | targetProxy = 5DB103D71D700F95003CB514 /* PBXContainerItemProxy */; 321 | }; 322 | /* End PBXTargetDependency section */ 323 | 324 | /* Begin PBXVariantGroup section */ 325 | 5DB103BE1D700F95003CB514 /* Main.storyboard */ = { 326 | isa = PBXVariantGroup; 327 | children = ( 328 | 5DB103BF1D700F95003CB514 /* Base */, 329 | ); 330 | name = Main.storyboard; 331 | sourceTree = ""; 332 | }; 333 | 5DB103C31D700F95003CB514 /* LaunchScreen.storyboard */ = { 334 | isa = PBXVariantGroup; 335 | children = ( 336 | 5DB103C41D700F95003CB514 /* Base */, 337 | ); 338 | name = LaunchScreen.storyboard; 339 | sourceTree = ""; 340 | }; 341 | /* End PBXVariantGroup section */ 342 | 343 | /* Begin XCBuildConfiguration section */ 344 | 5DB103DD1D700F96003CB514 /* Debug */ = { 345 | isa = XCBuildConfiguration; 346 | buildSettings = { 347 | ALWAYS_SEARCH_USER_PATHS = NO; 348 | CLANG_ANALYZER_NONNULL = YES; 349 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 350 | CLANG_CXX_LIBRARY = "libc++"; 351 | CLANG_ENABLE_MODULES = YES; 352 | CLANG_ENABLE_OBJC_ARC = YES; 353 | CLANG_WARN_BOOL_CONVERSION = YES; 354 | CLANG_WARN_CONSTANT_CONVERSION = YES; 355 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 356 | CLANG_WARN_EMPTY_BODY = YES; 357 | CLANG_WARN_ENUM_CONVERSION = YES; 358 | CLANG_WARN_INT_CONVERSION = YES; 359 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 360 | CLANG_WARN_UNREACHABLE_CODE = YES; 361 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 362 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 363 | COPY_PHASE_STRIP = NO; 364 | DEBUG_INFORMATION_FORMAT = dwarf; 365 | ENABLE_STRICT_OBJC_MSGSEND = YES; 366 | ENABLE_TESTABILITY = YES; 367 | GCC_C_LANGUAGE_STANDARD = gnu99; 368 | GCC_DYNAMIC_NO_PIC = NO; 369 | GCC_NO_COMMON_BLOCKS = YES; 370 | GCC_OPTIMIZATION_LEVEL = 0; 371 | GCC_PREPROCESSOR_DEFINITIONS = ( 372 | "DEBUG=1", 373 | "$(inherited)", 374 | ); 375 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 376 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 377 | GCC_WARN_UNDECLARED_SELECTOR = YES; 378 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 379 | GCC_WARN_UNUSED_FUNCTION = YES; 380 | GCC_WARN_UNUSED_VARIABLE = YES; 381 | IPHONEOS_DEPLOYMENT_TARGET = 9.3; 382 | MTL_ENABLE_DEBUG_INFO = YES; 383 | ONLY_ACTIVE_ARCH = YES; 384 | SDKROOT = iphoneos; 385 | TARGETED_DEVICE_FAMILY = "1,2"; 386 | }; 387 | name = Debug; 388 | }; 389 | 5DB103DE1D700F96003CB514 /* Release */ = { 390 | isa = XCBuildConfiguration; 391 | buildSettings = { 392 | ALWAYS_SEARCH_USER_PATHS = NO; 393 | CLANG_ANALYZER_NONNULL = YES; 394 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 395 | CLANG_CXX_LIBRARY = "libc++"; 396 | CLANG_ENABLE_MODULES = YES; 397 | CLANG_ENABLE_OBJC_ARC = YES; 398 | CLANG_WARN_BOOL_CONVERSION = YES; 399 | CLANG_WARN_CONSTANT_CONVERSION = YES; 400 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 401 | CLANG_WARN_EMPTY_BODY = YES; 402 | CLANG_WARN_ENUM_CONVERSION = YES; 403 | CLANG_WARN_INT_CONVERSION = YES; 404 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 405 | CLANG_WARN_UNREACHABLE_CODE = YES; 406 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 407 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 408 | COPY_PHASE_STRIP = NO; 409 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 410 | ENABLE_NS_ASSERTIONS = NO; 411 | ENABLE_STRICT_OBJC_MSGSEND = YES; 412 | GCC_C_LANGUAGE_STANDARD = gnu99; 413 | GCC_NO_COMMON_BLOCKS = YES; 414 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 415 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 416 | GCC_WARN_UNDECLARED_SELECTOR = YES; 417 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 418 | GCC_WARN_UNUSED_FUNCTION = YES; 419 | GCC_WARN_UNUSED_VARIABLE = YES; 420 | IPHONEOS_DEPLOYMENT_TARGET = 9.3; 421 | MTL_ENABLE_DEBUG_INFO = NO; 422 | SDKROOT = iphoneos; 423 | TARGETED_DEVICE_FAMILY = "1,2"; 424 | VALIDATE_PRODUCT = YES; 425 | }; 426 | name = Release; 427 | }; 428 | 5DB103E01D700F96003CB514 /* Debug */ = { 429 | isa = XCBuildConfiguration; 430 | buildSettings = { 431 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 432 | INFOPLIST_FILE = MVPDemo/Info.plist; 433 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 434 | PRODUCT_BUNDLE_IDENTIFIER = com.hecvstyle.MVPDemo; 435 | PRODUCT_NAME = "$(TARGET_NAME)"; 436 | }; 437 | name = Debug; 438 | }; 439 | 5DB103E11D700F96003CB514 /* Release */ = { 440 | isa = XCBuildConfiguration; 441 | buildSettings = { 442 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 443 | INFOPLIST_FILE = MVPDemo/Info.plist; 444 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 445 | PRODUCT_BUNDLE_IDENTIFIER = com.hecvstyle.MVPDemo; 446 | PRODUCT_NAME = "$(TARGET_NAME)"; 447 | }; 448 | name = Release; 449 | }; 450 | 5DB103E31D700F96003CB514 /* Debug */ = { 451 | isa = XCBuildConfiguration; 452 | buildSettings = { 453 | BUNDLE_LOADER = "$(TEST_HOST)"; 454 | INFOPLIST_FILE = MVPDemoTests/Info.plist; 455 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 456 | PRODUCT_BUNDLE_IDENTIFIER = com.hecvstyle.MVPDemoTests; 457 | PRODUCT_NAME = "$(TARGET_NAME)"; 458 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/MVPDemo.app/MVPDemo"; 459 | }; 460 | name = Debug; 461 | }; 462 | 5DB103E41D700F96003CB514 /* Release */ = { 463 | isa = XCBuildConfiguration; 464 | buildSettings = { 465 | BUNDLE_LOADER = "$(TEST_HOST)"; 466 | INFOPLIST_FILE = MVPDemoTests/Info.plist; 467 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 468 | PRODUCT_BUNDLE_IDENTIFIER = com.hecvstyle.MVPDemoTests; 469 | PRODUCT_NAME = "$(TARGET_NAME)"; 470 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/MVPDemo.app/MVPDemo"; 471 | }; 472 | name = Release; 473 | }; 474 | 5DB103E61D700F96003CB514 /* Debug */ = { 475 | isa = XCBuildConfiguration; 476 | buildSettings = { 477 | INFOPLIST_FILE = MVPDemoUITests/Info.plist; 478 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 479 | PRODUCT_BUNDLE_IDENTIFIER = com.hecvstyle.MVPDemoUITests; 480 | PRODUCT_NAME = "$(TARGET_NAME)"; 481 | TEST_TARGET_NAME = MVPDemo; 482 | }; 483 | name = Debug; 484 | }; 485 | 5DB103E71D700F96003CB514 /* Release */ = { 486 | isa = XCBuildConfiguration; 487 | buildSettings = { 488 | INFOPLIST_FILE = MVPDemoUITests/Info.plist; 489 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 490 | PRODUCT_BUNDLE_IDENTIFIER = com.hecvstyle.MVPDemoUITests; 491 | PRODUCT_NAME = "$(TARGET_NAME)"; 492 | TEST_TARGET_NAME = MVPDemo; 493 | }; 494 | name = Release; 495 | }; 496 | /* End XCBuildConfiguration section */ 497 | 498 | /* Begin XCConfigurationList section */ 499 | 5DB103AD1D700F94003CB514 /* Build configuration list for PBXProject "MVPDemo" */ = { 500 | isa = XCConfigurationList; 501 | buildConfigurations = ( 502 | 5DB103DD1D700F96003CB514 /* Debug */, 503 | 5DB103DE1D700F96003CB514 /* Release */, 504 | ); 505 | defaultConfigurationIsVisible = 0; 506 | defaultConfigurationName = Release; 507 | }; 508 | 5DB103DF1D700F96003CB514 /* Build configuration list for PBXNativeTarget "MVPDemo" */ = { 509 | isa = XCConfigurationList; 510 | buildConfigurations = ( 511 | 5DB103E01D700F96003CB514 /* Debug */, 512 | 5DB103E11D700F96003CB514 /* Release */, 513 | ); 514 | defaultConfigurationIsVisible = 0; 515 | }; 516 | 5DB103E21D700F96003CB514 /* Build configuration list for PBXNativeTarget "MVPDemoTests" */ = { 517 | isa = XCConfigurationList; 518 | buildConfigurations = ( 519 | 5DB103E31D700F96003CB514 /* Debug */, 520 | 5DB103E41D700F96003CB514 /* Release */, 521 | ); 522 | defaultConfigurationIsVisible = 0; 523 | }; 524 | 5DB103E51D700F96003CB514 /* Build configuration list for PBXNativeTarget "MVPDemoUITests" */ = { 525 | isa = XCConfigurationList; 526 | buildConfigurations = ( 527 | 5DB103E61D700F96003CB514 /* Debug */, 528 | 5DB103E71D700F96003CB514 /* Release */, 529 | ); 530 | defaultConfigurationIsVisible = 0; 531 | }; 532 | /* End XCConfigurationList section */ 533 | }; 534 | rootObject = 5DB103AA1D700F94003CB514 /* Project object */; 535 | } 536 | -------------------------------------------------------------------------------- /MVPDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /MVPDemo.xcodeproj/xcuserdata/hewei.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /MVPDemo.xcodeproj/xcuserdata/hewei.xcuserdatad/xcschemes/MVPDemo.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 43 | 49 | 50 | 51 | 52 | 53 | 59 | 60 | 61 | 62 | 63 | 64 | 74 | 76 | 82 | 83 | 84 | 85 | 86 | 87 | 93 | 95 | 101 | 102 | 103 | 104 | 106 | 107 | 110 | 111 | 112 | -------------------------------------------------------------------------------- /MVPDemo.xcodeproj/xcuserdata/hewei.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | MVPDemo.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 5DB103B11D700F94003CB514 16 | 17 | primary 18 | 19 | 20 | 5DB103CA1D700F95003CB514 21 | 22 | primary 23 | 24 | 25 | 5DB103D51D700F95003CB514 26 | 27 | primary 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /MVPDemo/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // MVPDemo 4 | // 5 | // Created by 何巍 on 16/8/26. 6 | // Copyright © 2016年 Hecv. 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 | -------------------------------------------------------------------------------- /MVPDemo/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // MVPDemo 4 | // 5 | // Created by 何巍 on 16/8/26. 6 | // Copyright © 2016年 Hecv. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 19 | // Override point for customization after application launch. 20 | return YES; 21 | } 22 | 23 | - (void)applicationWillResignActive:(UIApplication *)application { 24 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 25 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 26 | } 27 | 28 | - (void)applicationDidEnterBackground:(UIApplication *)application { 29 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 30 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 31 | } 32 | 33 | - (void)applicationWillEnterForeground:(UIApplication *)application { 34 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 35 | } 36 | 37 | - (void)applicationDidBecomeActive:(UIApplication *)application { 38 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 39 | } 40 | 41 | - (void)applicationWillTerminate:(UIApplication *)application { 42 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 43 | } 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /MVPDemo/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 | "idiom" : "ipad", 35 | "size" : "29x29", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "29x29", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "40x40", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "40x40", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "76x76", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "76x76", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } -------------------------------------------------------------------------------- /MVPDemo/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 | -------------------------------------------------------------------------------- /MVPDemo/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 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 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 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /MVPDemo/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 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /MVPDemo/Presenter.h: -------------------------------------------------------------------------------- 1 | // 2 | // Presenter.h 3 | // MVPDemo 4 | // 5 | // Created by 何巍 on 16/8/26. 6 | // Copyright © 2016年 Hecv. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "UserViewProtocol.h" 11 | 12 | @interface Presenter : NSObject 13 | 14 | 15 | /** 16 | * 将一个实现了 UserViewProtocol 协议的对象绑定到 presenter上来 17 | * 18 | * @param view 实现了UserViewProtocol的对象,一般来说,应该就是控制器,在MVP中,V 和 VC 共同组成UI 层。 19 | */ 20 | -(void)attachView:(id )view; 21 | 22 | -(void)fetchData; 23 | @end 24 | -------------------------------------------------------------------------------- /MVPDemo/Presenter.m: -------------------------------------------------------------------------------- 1 | // 2 | // Presenter.m 3 | // MVPDemo 4 | // 5 | // Created by 何巍 on 16/8/26. 6 | // Copyright © 2016年 Hecv. All rights reserved. 7 | // 8 | 9 | #import "Presenter.h" 10 | #import "UserService.h" 11 | 12 | @interface Presenter() 13 | 14 | @property (nonatomic,strong) UserService *userService; 15 | 16 | @property (nonatomic,weak) id attachView; 17 | 18 | @end 19 | @implementation Presenter 20 | 21 | 22 | -(void)attachView:(id )view{ 23 | self.attachView = view; 24 | self.userService = [UserService new]; 25 | } 26 | 27 | // 这个是对外的入口,通过这个入口,实现多个对内部的操作,外部只要调用这个接口就可以了 28 | -(void)fetchData{ 29 | [self getUserDatas]; 30 | } 31 | 32 | // 对内的业务逻辑方法, 33 | -(void)getUserDatas{ 34 | [self.attachView showIndicator]; 35 | [_userService getUserInfosSuccess:^(NSDictionary *dic) { 36 | [self.attachView hideIndicator]; 37 | NSArray *userArr =[dic valueForKey:@"data"]; 38 | 39 | if ([self processOriginDataToUIFriendlyData:userArr].count == 0) { 40 | [self.attachView showEmptyView]; 41 | } 42 | [self.attachView userViewDataSource:[self processOriginDataToUIFriendlyData:userArr]]; 43 | } andFail:^(NSDictionary *dic) { 44 | 45 | }]; 46 | } 47 | 48 | // 如果数据比较复杂,或者UI渲染的数据只是其中很少一部分,将原数据处理,输出成UI渲染的数据。(题外话:这里其实还可以使用协议,提供不同的数据格式输出。) 49 | -(NSArray *)processOriginDataToUIFriendlyData:(NSArray *) originData{ 50 | 51 | NSMutableArray *friendlyUIData = [NSMutableArray new]; 52 | for (NSDictionary *dic in originData) { 53 | if ([[dic valueForKey:@"gender"] isEqualToString:@"males"]) { 54 | [friendlyUIData addObject:dic]; 55 | } 56 | } 57 | return friendlyUIData; 58 | } 59 | 60 | 61 | @end 62 | -------------------------------------------------------------------------------- /MVPDemo/UserService.h: -------------------------------------------------------------------------------- 1 | // 2 | // Service.h 3 | // MVPDemo 4 | // 5 | // Created by 何巍 on 16/8/26. 6 | // Copyright © 2016年 Hecv. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | typedef void(^SuccessHandler)(NSDictionary *dic); 12 | typedef void(^FailHandler)(NSDictionary *dic); 13 | /** 14 | * Service 用来做数据获取工作等,发起网络请求,并且返回数据给Presenter,这个算是Model,但我准备用字典做业务交付 15 | */ 16 | @interface UserService : NSObject 17 | 18 | -(void)getUserInfosSuccess:(SuccessHandler )success andFail:(FailHandler) fail; 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /MVPDemo/UserService.m: -------------------------------------------------------------------------------- 1 | // 2 | // Service.m 3 | // MVPDemo 4 | // 5 | // Created by 何巍 on 16/8/26. 6 | // Copyright © 2016年 Hecv. All rights reserved. 7 | // 8 | 9 | #import "UserService.h" 10 | 11 | @implementation UserService 12 | 13 | 14 | -(void)getUserInfosSuccess:(SuccessHandler )success andFail:(FailHandler) fail{ 15 | NSArray *result =@[@{@"name":@"Tom", 16 | @"age":@25, 17 | @"addr":@"GuangZhou", 18 | @"gender":@"male", 19 | }, 20 | @{@"name":@"Jerry", 21 | @"age":@22, 22 | @"addr":@"Hangzhou", 23 | @"gender":@"male", 24 | }, 25 | @{@"name":@"Lucy", 26 | @"age":@25, 27 | @"addr":@"Didu", 28 | @"gender":@"female", 29 | }]; 30 | dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ 31 | success(@{@"data":result}); 32 | }); 33 | 34 | } 35 | @end 36 | -------------------------------------------------------------------------------- /MVPDemo/UserViewProtocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // UserViewProtocol.h 3 | // MVPDemo 4 | // 5 | // Created by 何巍 on 16/8/26. 6 | // Copyright © 2016年 Hecv. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @protocol UserViewProtocol 12 | 13 | -(void) userViewDataSource:(NSArray*)data; 14 | -(void) showIndicator; 15 | -(void) hideIndicator; 16 | -(void) showEmptyView; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /MVPDemo/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // MVPDemo 4 | // 5 | // Created by 何巍 on 16/8/26. 6 | // Copyright © 2016年 Hecv. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /MVPDemo/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // MVPDemo 4 | // 5 | // Created by 何巍 on 16/8/26. 6 | // Copyright © 2016年 Hecv. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "UserViewProtocol.h" 11 | #import "Presenter.h" 12 | 13 | @interface ViewController () 14 | @property (weak, nonatomic) IBOutlet UITableView *tableview; 15 | @property (nonatomic,strong) NSArray *friendlyUIData; 16 | @property (weak, nonatomic) IBOutlet UIActivityIndicatorView *indicator; 17 | 18 | @property (nonatomic,strong) Presenter *presenter; 19 | 20 | @end 21 | 22 | @implementation ViewController 23 | 24 | - (void)viewDidLoad { 25 | [super viewDidLoad]; 26 | // Do any additional setup after loading the view, typically from a nib. 27 | [self.tableview registerClass:[UITableViewCell class] forCellReuseIdentifier:NSStringFromClass([UITableViewCell class])]; 28 | 29 | self.presenter = [Presenter new]; 30 | [self.presenter attachView:self]; 31 | [self.presenter fetchData]; 32 | 33 | } 34 | 35 | - (void)didReceiveMemoryWarning { 36 | [super didReceiveMemoryWarning]; 37 | // Dispose of any resources that can be recreated. 38 | } 39 | 40 | #pragma mark - Table view data source 41 | 42 | 43 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 44 | return self.friendlyUIData.count; 45 | } 46 | 47 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 48 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([UITableViewCell class]) forIndexPath:indexPath]; 49 | cell.textLabel.text = [self.friendlyUIData[indexPath.row] valueForKey:@"name"]; 50 | 51 | return cell; 52 | } 53 | 54 | 55 | #pragma mark - Table view delegate 56 | 57 | // In a xib-based application, navigation from a table can be handled in -tableView:didSelectRowAtIndexPath: 58 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 59 | 60 | } 61 | 62 | 63 | #pragma UserViewProtocol 64 | 65 | -(void)userViewDataSource:(NSArray*)data{ 66 | 67 | self.friendlyUIData = data; 68 | [self.tableview reloadData]; 69 | 70 | } 71 | -(void) showIndicator{ 72 | self.indicator.hidden = NO; 73 | } 74 | -(void) hideIndicator{ 75 | self.indicator.hidden = YES; 76 | } 77 | -(void) showEmptyView{ 78 | UIAlertController *alertView = [UIAlertController alertControllerWithTitle:@"Alert" message:@"show empty view" preferredStyle:UIAlertControllerStyleAlert]; 79 | [alertView addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:nil]]; 80 | [self presentViewController:alertView animated:YES completion:^{ 81 | 82 | }]; 83 | } 84 | 85 | @end 86 | -------------------------------------------------------------------------------- /MVPDemo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // MVPDemo 4 | // 5 | // Created by 何巍 on 16/8/26. 6 | // Copyright © 2016年 Hecv. 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 | -------------------------------------------------------------------------------- /MVPDemoTests/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 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /MVPDemoTests/MVPDemoTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // MVPDemoTests.m 3 | // MVPDemoTests 4 | // 5 | // Created by 何巍 on 16/8/26. 6 | // Copyright © 2016年 Hecv. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface MVPDemoTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation MVPDemoTests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | // Put setup code here. This method is called before the invocation of each test method in the class. 20 | } 21 | 22 | - (void)tearDown { 23 | // Put teardown code here. This method is called after the invocation of each test method in the class. 24 | [super tearDown]; 25 | } 26 | 27 | - (void)testExample { 28 | // This is an example of a functional test case. 29 | // Use XCTAssert and related functions to verify your tests produce the correct results. 30 | } 31 | 32 | - (void)testPerformanceExample { 33 | // This is an example of a performance test case. 34 | [self measureBlock:^{ 35 | // Put the code you want to measure the time of here. 36 | }]; 37 | } 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /MVPDemoUITests/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 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /MVPDemoUITests/MVPDemoUITests.m: -------------------------------------------------------------------------------- 1 | // 2 | // MVPDemoUITests.m 3 | // MVPDemoUITests 4 | // 5 | // Created by 何巍 on 16/8/26. 6 | // Copyright © 2016年 Hecv. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface MVPDemoUITests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation MVPDemoUITests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | 22 | // In UI tests it is usually best to stop immediately when a failure occurs. 23 | self.continueAfterFailure = NO; 24 | // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method. 25 | [[[XCUIApplication alloc] init] launch]; 26 | 27 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. 28 | } 29 | 30 | - (void)tearDown { 31 | // Put teardown code here. This method is called after the invocation of each test method in the class. 32 | [super tearDown]; 33 | } 34 | 35 | - (void)testExample { 36 | // Use recording to get started writing UI tests. 37 | // Use XCTAssert and related functions to verify your tests produce the correct results. 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # iOS-mvp-sample 2 | MVP demo,使用OC 语言写的 3 | 4 | 5 | 6 | --------------------------------------------------------------------------------