├── PullToRefresh.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ └── contents.xcworkspacedata └── xcuserdata │ └── miladshokrkhah.xcuserdatad │ └── xcschemes │ ├── PullToRefresh.xcscheme │ └── xcschememanagement.plist ├── PullToRefresh ├── AppDelegate.h ├── AppDelegate.m ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── Info.plist ├── PullToRefresh.xcdatamodeld │ ├── .xccurrentversion │ └── PullToRefresh.xcdatamodel │ │ └── contents ├── Refresh.h ├── Refresh.m ├── TableViewController.h ├── TableViewController.m └── main.m ├── PullToRefreshTests ├── Info.plist └── PullToRefreshTests.m └── PullToRefreshUITests ├── Info.plist └── PullToRefreshUITests.m /PullToRefresh.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 097491611CA690A40072D6B8 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 097491601CA690A40072D6B8 /* main.m */; }; 11 | 097491641CA690A40072D6B8 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 097491631CA690A40072D6B8 /* AppDelegate.m */; }; 12 | 0974916A1CA690A40072D6B8 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 097491681CA690A40072D6B8 /* Main.storyboard */; }; 13 | 0974916D1CA690A40072D6B8 /* PullToRefresh.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = 0974916B1CA690A40072D6B8 /* PullToRefresh.xcdatamodeld */; }; 14 | 0974916F1CA690A50072D6B8 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 0974916E1CA690A50072D6B8 /* Assets.xcassets */; }; 15 | 097491721CA690A50072D6B8 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 097491701CA690A50072D6B8 /* LaunchScreen.storyboard */; }; 16 | 0974917D1CA690A50072D6B8 /* PullToRefreshTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 0974917C1CA690A50072D6B8 /* PullToRefreshTests.m */; }; 17 | 097491881CA690A50072D6B8 /* PullToRefreshUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = 097491871CA690A50072D6B8 /* PullToRefreshUITests.m */; }; 18 | 097491971CA691DC0072D6B8 /* TableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 097491961CA691DC0072D6B8 /* TableViewController.m */; }; 19 | 0974919A1CA692460072D6B8 /* Refresh.m in Sources */ = {isa = PBXBuildFile; fileRef = 097491991CA692460072D6B8 /* Refresh.m */; }; 20 | /* End PBXBuildFile section */ 21 | 22 | /* Begin PBXContainerItemProxy section */ 23 | 097491791CA690A50072D6B8 /* PBXContainerItemProxy */ = { 24 | isa = PBXContainerItemProxy; 25 | containerPortal = 097491541CA690A40072D6B8 /* Project object */; 26 | proxyType = 1; 27 | remoteGlobalIDString = 0974915B1CA690A40072D6B8; 28 | remoteInfo = PullToRefresh; 29 | }; 30 | 097491841CA690A50072D6B8 /* PBXContainerItemProxy */ = { 31 | isa = PBXContainerItemProxy; 32 | containerPortal = 097491541CA690A40072D6B8 /* Project object */; 33 | proxyType = 1; 34 | remoteGlobalIDString = 0974915B1CA690A40072D6B8; 35 | remoteInfo = PullToRefresh; 36 | }; 37 | /* End PBXContainerItemProxy section */ 38 | 39 | /* Begin PBXFileReference section */ 40 | 0974915C1CA690A40072D6B8 /* PullToRefresh.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = PullToRefresh.app; sourceTree = BUILT_PRODUCTS_DIR; }; 41 | 097491601CA690A40072D6B8 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 42 | 097491621CA690A40072D6B8 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 43 | 097491631CA690A40072D6B8 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 44 | 097491691CA690A40072D6B8 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 45 | 0974916C1CA690A40072D6B8 /* PullToRefresh.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = PullToRefresh.xcdatamodel; sourceTree = ""; }; 46 | 0974916E1CA690A50072D6B8 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 47 | 097491711CA690A50072D6B8 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 48 | 097491731CA690A50072D6B8 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 49 | 097491781CA690A50072D6B8 /* PullToRefreshTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = PullToRefreshTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 50 | 0974917C1CA690A50072D6B8 /* PullToRefreshTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PullToRefreshTests.m; sourceTree = ""; }; 51 | 0974917E1CA690A50072D6B8 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 52 | 097491831CA690A50072D6B8 /* PullToRefreshUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = PullToRefreshUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 53 | 097491871CA690A50072D6B8 /* PullToRefreshUITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PullToRefreshUITests.m; sourceTree = ""; }; 54 | 097491891CA690A50072D6B8 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 55 | 097491951CA691DC0072D6B8 /* TableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TableViewController.h; sourceTree = ""; }; 56 | 097491961CA691DC0072D6B8 /* TableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TableViewController.m; sourceTree = ""; }; 57 | 097491981CA692460072D6B8 /* Refresh.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Refresh.h; sourceTree = ""; }; 58 | 097491991CA692460072D6B8 /* Refresh.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Refresh.m; sourceTree = ""; }; 59 | /* End PBXFileReference section */ 60 | 61 | /* Begin PBXFrameworksBuildPhase section */ 62 | 097491591CA690A40072D6B8 /* Frameworks */ = { 63 | isa = PBXFrameworksBuildPhase; 64 | buildActionMask = 2147483647; 65 | files = ( 66 | ); 67 | runOnlyForDeploymentPostprocessing = 0; 68 | }; 69 | 097491751CA690A50072D6B8 /* Frameworks */ = { 70 | isa = PBXFrameworksBuildPhase; 71 | buildActionMask = 2147483647; 72 | files = ( 73 | ); 74 | runOnlyForDeploymentPostprocessing = 0; 75 | }; 76 | 097491801CA690A50072D6B8 /* Frameworks */ = { 77 | isa = PBXFrameworksBuildPhase; 78 | buildActionMask = 2147483647; 79 | files = ( 80 | ); 81 | runOnlyForDeploymentPostprocessing = 0; 82 | }; 83 | /* End PBXFrameworksBuildPhase section */ 84 | 85 | /* Begin PBXGroup section */ 86 | 097491531CA690A40072D6B8 = { 87 | isa = PBXGroup; 88 | children = ( 89 | 0974915E1CA690A40072D6B8 /* PullToRefresh */, 90 | 0974917B1CA690A50072D6B8 /* PullToRefreshTests */, 91 | 097491861CA690A50072D6B8 /* PullToRefreshUITests */, 92 | 0974915D1CA690A40072D6B8 /* Products */, 93 | ); 94 | sourceTree = ""; 95 | }; 96 | 0974915D1CA690A40072D6B8 /* Products */ = { 97 | isa = PBXGroup; 98 | children = ( 99 | 0974915C1CA690A40072D6B8 /* PullToRefresh.app */, 100 | 097491781CA690A50072D6B8 /* PullToRefreshTests.xctest */, 101 | 097491831CA690A50072D6B8 /* PullToRefreshUITests.xctest */, 102 | ); 103 | name = Products; 104 | sourceTree = ""; 105 | }; 106 | 0974915E1CA690A40072D6B8 /* PullToRefresh */ = { 107 | isa = PBXGroup; 108 | children = ( 109 | 097491621CA690A40072D6B8 /* AppDelegate.h */, 110 | 097491631CA690A40072D6B8 /* AppDelegate.m */, 111 | 097491681CA690A40072D6B8 /* Main.storyboard */, 112 | 097491951CA691DC0072D6B8 /* TableViewController.h */, 113 | 097491961CA691DC0072D6B8 /* TableViewController.m */, 114 | 097491981CA692460072D6B8 /* Refresh.h */, 115 | 097491991CA692460072D6B8 /* Refresh.m */, 116 | 0974916E1CA690A50072D6B8 /* Assets.xcassets */, 117 | 097491701CA690A50072D6B8 /* LaunchScreen.storyboard */, 118 | 097491731CA690A50072D6B8 /* Info.plist */, 119 | 0974916B1CA690A40072D6B8 /* PullToRefresh.xcdatamodeld */, 120 | 0974915F1CA690A40072D6B8 /* Supporting Files */, 121 | ); 122 | path = PullToRefresh; 123 | sourceTree = ""; 124 | }; 125 | 0974915F1CA690A40072D6B8 /* Supporting Files */ = { 126 | isa = PBXGroup; 127 | children = ( 128 | 097491601CA690A40072D6B8 /* main.m */, 129 | ); 130 | name = "Supporting Files"; 131 | sourceTree = ""; 132 | }; 133 | 0974917B1CA690A50072D6B8 /* PullToRefreshTests */ = { 134 | isa = PBXGroup; 135 | children = ( 136 | 0974917C1CA690A50072D6B8 /* PullToRefreshTests.m */, 137 | 0974917E1CA690A50072D6B8 /* Info.plist */, 138 | ); 139 | path = PullToRefreshTests; 140 | sourceTree = ""; 141 | }; 142 | 097491861CA690A50072D6B8 /* PullToRefreshUITests */ = { 143 | isa = PBXGroup; 144 | children = ( 145 | 097491871CA690A50072D6B8 /* PullToRefreshUITests.m */, 146 | 097491891CA690A50072D6B8 /* Info.plist */, 147 | ); 148 | path = PullToRefreshUITests; 149 | sourceTree = ""; 150 | }; 151 | /* End PBXGroup section */ 152 | 153 | /* Begin PBXNativeTarget section */ 154 | 0974915B1CA690A40072D6B8 /* PullToRefresh */ = { 155 | isa = PBXNativeTarget; 156 | buildConfigurationList = 0974918C1CA690A50072D6B8 /* Build configuration list for PBXNativeTarget "PullToRefresh" */; 157 | buildPhases = ( 158 | 097491581CA690A40072D6B8 /* Sources */, 159 | 097491591CA690A40072D6B8 /* Frameworks */, 160 | 0974915A1CA690A40072D6B8 /* Resources */, 161 | ); 162 | buildRules = ( 163 | ); 164 | dependencies = ( 165 | ); 166 | name = PullToRefresh; 167 | productName = PullToRefresh; 168 | productReference = 0974915C1CA690A40072D6B8 /* PullToRefresh.app */; 169 | productType = "com.apple.product-type.application"; 170 | }; 171 | 097491771CA690A50072D6B8 /* PullToRefreshTests */ = { 172 | isa = PBXNativeTarget; 173 | buildConfigurationList = 0974918F1CA690A50072D6B8 /* Build configuration list for PBXNativeTarget "PullToRefreshTests" */; 174 | buildPhases = ( 175 | 097491741CA690A50072D6B8 /* Sources */, 176 | 097491751CA690A50072D6B8 /* Frameworks */, 177 | 097491761CA690A50072D6B8 /* Resources */, 178 | ); 179 | buildRules = ( 180 | ); 181 | dependencies = ( 182 | 0974917A1CA690A50072D6B8 /* PBXTargetDependency */, 183 | ); 184 | name = PullToRefreshTests; 185 | productName = PullToRefreshTests; 186 | productReference = 097491781CA690A50072D6B8 /* PullToRefreshTests.xctest */; 187 | productType = "com.apple.product-type.bundle.unit-test"; 188 | }; 189 | 097491821CA690A50072D6B8 /* PullToRefreshUITests */ = { 190 | isa = PBXNativeTarget; 191 | buildConfigurationList = 097491921CA690A50072D6B8 /* Build configuration list for PBXNativeTarget "PullToRefreshUITests" */; 192 | buildPhases = ( 193 | 0974917F1CA690A50072D6B8 /* Sources */, 194 | 097491801CA690A50072D6B8 /* Frameworks */, 195 | 097491811CA690A50072D6B8 /* Resources */, 196 | ); 197 | buildRules = ( 198 | ); 199 | dependencies = ( 200 | 097491851CA690A50072D6B8 /* PBXTargetDependency */, 201 | ); 202 | name = PullToRefreshUITests; 203 | productName = PullToRefreshUITests; 204 | productReference = 097491831CA690A50072D6B8 /* PullToRefreshUITests.xctest */; 205 | productType = "com.apple.product-type.bundle.ui-testing"; 206 | }; 207 | /* End PBXNativeTarget section */ 208 | 209 | /* Begin PBXProject section */ 210 | 097491541CA690A40072D6B8 /* Project object */ = { 211 | isa = PBXProject; 212 | attributes = { 213 | LastUpgradeCheck = 0730; 214 | ORGANIZATIONNAME = com.mrapplication; 215 | TargetAttributes = { 216 | 0974915B1CA690A40072D6B8 = { 217 | CreatedOnToolsVersion = 7.3; 218 | }; 219 | 097491771CA690A50072D6B8 = { 220 | CreatedOnToolsVersion = 7.3; 221 | TestTargetID = 0974915B1CA690A40072D6B8; 222 | }; 223 | 097491821CA690A50072D6B8 = { 224 | CreatedOnToolsVersion = 7.3; 225 | TestTargetID = 0974915B1CA690A40072D6B8; 226 | }; 227 | }; 228 | }; 229 | buildConfigurationList = 097491571CA690A40072D6B8 /* Build configuration list for PBXProject "PullToRefresh" */; 230 | compatibilityVersion = "Xcode 3.2"; 231 | developmentRegion = English; 232 | hasScannedForEncodings = 0; 233 | knownRegions = ( 234 | en, 235 | Base, 236 | ); 237 | mainGroup = 097491531CA690A40072D6B8; 238 | productRefGroup = 0974915D1CA690A40072D6B8 /* Products */; 239 | projectDirPath = ""; 240 | projectRoot = ""; 241 | targets = ( 242 | 0974915B1CA690A40072D6B8 /* PullToRefresh */, 243 | 097491771CA690A50072D6B8 /* PullToRefreshTests */, 244 | 097491821CA690A50072D6B8 /* PullToRefreshUITests */, 245 | ); 246 | }; 247 | /* End PBXProject section */ 248 | 249 | /* Begin PBXResourcesBuildPhase section */ 250 | 0974915A1CA690A40072D6B8 /* Resources */ = { 251 | isa = PBXResourcesBuildPhase; 252 | buildActionMask = 2147483647; 253 | files = ( 254 | 097491721CA690A50072D6B8 /* LaunchScreen.storyboard in Resources */, 255 | 0974916F1CA690A50072D6B8 /* Assets.xcassets in Resources */, 256 | 0974916A1CA690A40072D6B8 /* Main.storyboard in Resources */, 257 | ); 258 | runOnlyForDeploymentPostprocessing = 0; 259 | }; 260 | 097491761CA690A50072D6B8 /* Resources */ = { 261 | isa = PBXResourcesBuildPhase; 262 | buildActionMask = 2147483647; 263 | files = ( 264 | ); 265 | runOnlyForDeploymentPostprocessing = 0; 266 | }; 267 | 097491811CA690A50072D6B8 /* Resources */ = { 268 | isa = PBXResourcesBuildPhase; 269 | buildActionMask = 2147483647; 270 | files = ( 271 | ); 272 | runOnlyForDeploymentPostprocessing = 0; 273 | }; 274 | /* End PBXResourcesBuildPhase section */ 275 | 276 | /* Begin PBXSourcesBuildPhase section */ 277 | 097491581CA690A40072D6B8 /* Sources */ = { 278 | isa = PBXSourcesBuildPhase; 279 | buildActionMask = 2147483647; 280 | files = ( 281 | 0974916D1CA690A40072D6B8 /* PullToRefresh.xcdatamodeld in Sources */, 282 | 097491641CA690A40072D6B8 /* AppDelegate.m in Sources */, 283 | 0974919A1CA692460072D6B8 /* Refresh.m in Sources */, 284 | 097491611CA690A40072D6B8 /* main.m in Sources */, 285 | 097491971CA691DC0072D6B8 /* TableViewController.m in Sources */, 286 | ); 287 | runOnlyForDeploymentPostprocessing = 0; 288 | }; 289 | 097491741CA690A50072D6B8 /* Sources */ = { 290 | isa = PBXSourcesBuildPhase; 291 | buildActionMask = 2147483647; 292 | files = ( 293 | 0974917D1CA690A50072D6B8 /* PullToRefreshTests.m in Sources */, 294 | ); 295 | runOnlyForDeploymentPostprocessing = 0; 296 | }; 297 | 0974917F1CA690A50072D6B8 /* Sources */ = { 298 | isa = PBXSourcesBuildPhase; 299 | buildActionMask = 2147483647; 300 | files = ( 301 | 097491881CA690A50072D6B8 /* PullToRefreshUITests.m in Sources */, 302 | ); 303 | runOnlyForDeploymentPostprocessing = 0; 304 | }; 305 | /* End PBXSourcesBuildPhase section */ 306 | 307 | /* Begin PBXTargetDependency section */ 308 | 0974917A1CA690A50072D6B8 /* PBXTargetDependency */ = { 309 | isa = PBXTargetDependency; 310 | target = 0974915B1CA690A40072D6B8 /* PullToRefresh */; 311 | targetProxy = 097491791CA690A50072D6B8 /* PBXContainerItemProxy */; 312 | }; 313 | 097491851CA690A50072D6B8 /* PBXTargetDependency */ = { 314 | isa = PBXTargetDependency; 315 | target = 0974915B1CA690A40072D6B8 /* PullToRefresh */; 316 | targetProxy = 097491841CA690A50072D6B8 /* PBXContainerItemProxy */; 317 | }; 318 | /* End PBXTargetDependency section */ 319 | 320 | /* Begin PBXVariantGroup section */ 321 | 097491681CA690A40072D6B8 /* Main.storyboard */ = { 322 | isa = PBXVariantGroup; 323 | children = ( 324 | 097491691CA690A40072D6B8 /* Base */, 325 | ); 326 | name = Main.storyboard; 327 | sourceTree = ""; 328 | }; 329 | 097491701CA690A50072D6B8 /* LaunchScreen.storyboard */ = { 330 | isa = PBXVariantGroup; 331 | children = ( 332 | 097491711CA690A50072D6B8 /* Base */, 333 | ); 334 | name = LaunchScreen.storyboard; 335 | sourceTree = ""; 336 | }; 337 | /* End PBXVariantGroup section */ 338 | 339 | /* Begin XCBuildConfiguration section */ 340 | 0974918A1CA690A50072D6B8 /* Debug */ = { 341 | isa = XCBuildConfiguration; 342 | buildSettings = { 343 | ALWAYS_SEARCH_USER_PATHS = NO; 344 | CLANG_ANALYZER_NONNULL = YES; 345 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 346 | CLANG_CXX_LIBRARY = "libc++"; 347 | CLANG_ENABLE_MODULES = YES; 348 | CLANG_ENABLE_OBJC_ARC = YES; 349 | CLANG_WARN_BOOL_CONVERSION = YES; 350 | CLANG_WARN_CONSTANT_CONVERSION = YES; 351 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 352 | CLANG_WARN_EMPTY_BODY = YES; 353 | CLANG_WARN_ENUM_CONVERSION = YES; 354 | CLANG_WARN_INT_CONVERSION = YES; 355 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 356 | CLANG_WARN_UNREACHABLE_CODE = YES; 357 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 358 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 359 | COPY_PHASE_STRIP = NO; 360 | DEBUG_INFORMATION_FORMAT = dwarf; 361 | ENABLE_STRICT_OBJC_MSGSEND = YES; 362 | ENABLE_TESTABILITY = YES; 363 | GCC_C_LANGUAGE_STANDARD = gnu99; 364 | GCC_DYNAMIC_NO_PIC = NO; 365 | GCC_NO_COMMON_BLOCKS = YES; 366 | GCC_OPTIMIZATION_LEVEL = 0; 367 | GCC_PREPROCESSOR_DEFINITIONS = ( 368 | "DEBUG=1", 369 | "$(inherited)", 370 | ); 371 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 372 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 373 | GCC_WARN_UNDECLARED_SELECTOR = YES; 374 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 375 | GCC_WARN_UNUSED_FUNCTION = YES; 376 | GCC_WARN_UNUSED_VARIABLE = YES; 377 | IPHONEOS_DEPLOYMENT_TARGET = 9.3; 378 | MTL_ENABLE_DEBUG_INFO = YES; 379 | ONLY_ACTIVE_ARCH = YES; 380 | SDKROOT = iphoneos; 381 | }; 382 | name = Debug; 383 | }; 384 | 0974918B1CA690A50072D6B8 /* Release */ = { 385 | isa = XCBuildConfiguration; 386 | buildSettings = { 387 | ALWAYS_SEARCH_USER_PATHS = NO; 388 | CLANG_ANALYZER_NONNULL = YES; 389 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 390 | CLANG_CXX_LIBRARY = "libc++"; 391 | CLANG_ENABLE_MODULES = YES; 392 | CLANG_ENABLE_OBJC_ARC = YES; 393 | CLANG_WARN_BOOL_CONVERSION = YES; 394 | CLANG_WARN_CONSTANT_CONVERSION = YES; 395 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 396 | CLANG_WARN_EMPTY_BODY = YES; 397 | CLANG_WARN_ENUM_CONVERSION = YES; 398 | CLANG_WARN_INT_CONVERSION = YES; 399 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 400 | CLANG_WARN_UNREACHABLE_CODE = YES; 401 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 402 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 403 | COPY_PHASE_STRIP = NO; 404 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 405 | ENABLE_NS_ASSERTIONS = NO; 406 | ENABLE_STRICT_OBJC_MSGSEND = YES; 407 | GCC_C_LANGUAGE_STANDARD = gnu99; 408 | GCC_NO_COMMON_BLOCKS = YES; 409 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 410 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 411 | GCC_WARN_UNDECLARED_SELECTOR = YES; 412 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 413 | GCC_WARN_UNUSED_FUNCTION = YES; 414 | GCC_WARN_UNUSED_VARIABLE = YES; 415 | IPHONEOS_DEPLOYMENT_TARGET = 9.3; 416 | MTL_ENABLE_DEBUG_INFO = NO; 417 | SDKROOT = iphoneos; 418 | VALIDATE_PRODUCT = YES; 419 | }; 420 | name = Release; 421 | }; 422 | 0974918D1CA690A50072D6B8 /* Debug */ = { 423 | isa = XCBuildConfiguration; 424 | buildSettings = { 425 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 426 | INFOPLIST_FILE = PullToRefresh/Info.plist; 427 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 428 | PRODUCT_BUNDLE_IDENTIFIER = com.mrapplication.PullToRefresh; 429 | PRODUCT_NAME = "$(TARGET_NAME)"; 430 | }; 431 | name = Debug; 432 | }; 433 | 0974918E1CA690A50072D6B8 /* Release */ = { 434 | isa = XCBuildConfiguration; 435 | buildSettings = { 436 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 437 | INFOPLIST_FILE = PullToRefresh/Info.plist; 438 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 439 | PRODUCT_BUNDLE_IDENTIFIER = com.mrapplication.PullToRefresh; 440 | PRODUCT_NAME = "$(TARGET_NAME)"; 441 | }; 442 | name = Release; 443 | }; 444 | 097491901CA690A50072D6B8 /* Debug */ = { 445 | isa = XCBuildConfiguration; 446 | buildSettings = { 447 | BUNDLE_LOADER = "$(TEST_HOST)"; 448 | INFOPLIST_FILE = PullToRefreshTests/Info.plist; 449 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 450 | PRODUCT_BUNDLE_IDENTIFIER = com.mrapplication.PullToRefreshTests; 451 | PRODUCT_NAME = "$(TARGET_NAME)"; 452 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/PullToRefresh.app/PullToRefresh"; 453 | }; 454 | name = Debug; 455 | }; 456 | 097491911CA690A50072D6B8 /* Release */ = { 457 | isa = XCBuildConfiguration; 458 | buildSettings = { 459 | BUNDLE_LOADER = "$(TEST_HOST)"; 460 | INFOPLIST_FILE = PullToRefreshTests/Info.plist; 461 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 462 | PRODUCT_BUNDLE_IDENTIFIER = com.mrapplication.PullToRefreshTests; 463 | PRODUCT_NAME = "$(TARGET_NAME)"; 464 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/PullToRefresh.app/PullToRefresh"; 465 | }; 466 | name = Release; 467 | }; 468 | 097491931CA690A50072D6B8 /* Debug */ = { 469 | isa = XCBuildConfiguration; 470 | buildSettings = { 471 | INFOPLIST_FILE = PullToRefreshUITests/Info.plist; 472 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 473 | PRODUCT_BUNDLE_IDENTIFIER = com.mrapplication.PullToRefreshUITests; 474 | PRODUCT_NAME = "$(TARGET_NAME)"; 475 | TEST_TARGET_NAME = PullToRefresh; 476 | }; 477 | name = Debug; 478 | }; 479 | 097491941CA690A50072D6B8 /* Release */ = { 480 | isa = XCBuildConfiguration; 481 | buildSettings = { 482 | INFOPLIST_FILE = PullToRefreshUITests/Info.plist; 483 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 484 | PRODUCT_BUNDLE_IDENTIFIER = com.mrapplication.PullToRefreshUITests; 485 | PRODUCT_NAME = "$(TARGET_NAME)"; 486 | TEST_TARGET_NAME = PullToRefresh; 487 | }; 488 | name = Release; 489 | }; 490 | /* End XCBuildConfiguration section */ 491 | 492 | /* Begin XCConfigurationList section */ 493 | 097491571CA690A40072D6B8 /* Build configuration list for PBXProject "PullToRefresh" */ = { 494 | isa = XCConfigurationList; 495 | buildConfigurations = ( 496 | 0974918A1CA690A50072D6B8 /* Debug */, 497 | 0974918B1CA690A50072D6B8 /* Release */, 498 | ); 499 | defaultConfigurationIsVisible = 0; 500 | defaultConfigurationName = Release; 501 | }; 502 | 0974918C1CA690A50072D6B8 /* Build configuration list for PBXNativeTarget "PullToRefresh" */ = { 503 | isa = XCConfigurationList; 504 | buildConfigurations = ( 505 | 0974918D1CA690A50072D6B8 /* Debug */, 506 | 0974918E1CA690A50072D6B8 /* Release */, 507 | ); 508 | defaultConfigurationIsVisible = 0; 509 | }; 510 | 0974918F1CA690A50072D6B8 /* Build configuration list for PBXNativeTarget "PullToRefreshTests" */ = { 511 | isa = XCConfigurationList; 512 | buildConfigurations = ( 513 | 097491901CA690A50072D6B8 /* Debug */, 514 | 097491911CA690A50072D6B8 /* Release */, 515 | ); 516 | defaultConfigurationIsVisible = 0; 517 | }; 518 | 097491921CA690A50072D6B8 /* Build configuration list for PBXNativeTarget "PullToRefreshUITests" */ = { 519 | isa = XCConfigurationList; 520 | buildConfigurations = ( 521 | 097491931CA690A50072D6B8 /* Debug */, 522 | 097491941CA690A50072D6B8 /* Release */, 523 | ); 524 | defaultConfigurationIsVisible = 0; 525 | }; 526 | /* End XCConfigurationList section */ 527 | 528 | /* Begin XCVersionGroup section */ 529 | 0974916B1CA690A40072D6B8 /* PullToRefresh.xcdatamodeld */ = { 530 | isa = XCVersionGroup; 531 | children = ( 532 | 0974916C1CA690A40072D6B8 /* PullToRefresh.xcdatamodel */, 533 | ); 534 | currentVersion = 0974916C1CA690A40072D6B8 /* PullToRefresh.xcdatamodel */; 535 | path = PullToRefresh.xcdatamodeld; 536 | sourceTree = ""; 537 | versionGroupType = wrapper.xcdatamodel; 538 | }; 539 | /* End XCVersionGroup section */ 540 | }; 541 | rootObject = 097491541CA690A40072D6B8 /* Project object */; 542 | } 543 | -------------------------------------------------------------------------------- /PullToRefresh.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /PullToRefresh.xcodeproj/xcuserdata/miladshokrkhah.xcuserdatad/xcschemes/PullToRefresh.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 | -------------------------------------------------------------------------------- /PullToRefresh.xcodeproj/xcuserdata/miladshokrkhah.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | PullToRefresh.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 0974915B1CA690A40072D6B8 16 | 17 | primary 18 | 19 | 20 | 097491771CA690A50072D6B8 21 | 22 | primary 23 | 24 | 25 | 097491821CA690A50072D6B8 26 | 27 | primary 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /PullToRefresh/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // PullToRefresh 4 | // 5 | // Created by Milad Shokrkhah on 3/26/16. 6 | // Copyright © 2016 com.mrapplication. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface AppDelegate : UIResponder 13 | 14 | @property (strong, nonatomic) UIWindow *window; 15 | 16 | @property (readonly, strong, nonatomic) NSManagedObjectContext *managedObjectContext; 17 | @property (readonly, strong, nonatomic) NSManagedObjectModel *managedObjectModel; 18 | @property (readonly, strong, nonatomic) NSPersistentStoreCoordinator *persistentStoreCoordinator; 19 | 20 | - (void)saveContext; 21 | - (NSURL *)applicationDocumentsDirectory; 22 | 23 | 24 | @end 25 | 26 | -------------------------------------------------------------------------------- /PullToRefresh/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // PullToRefresh 4 | // 5 | // Created by Milad Shokrkhah on 3/26/16. 6 | // Copyright © 2016 com.mrapplication. 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 | // Saves changes in the application's managed object context before the application terminates. 44 | [self saveContext]; 45 | } 46 | 47 | #pragma mark - Core Data stack 48 | 49 | @synthesize managedObjectContext = _managedObjectContext; 50 | @synthesize managedObjectModel = _managedObjectModel; 51 | @synthesize persistentStoreCoordinator = _persistentStoreCoordinator; 52 | 53 | - (NSURL *)applicationDocumentsDirectory { 54 | // The directory the application uses to store the Core Data store file. This code uses a directory named "com.mrapplication.PullToRefresh" in the application's documents directory. 55 | return [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject]; 56 | } 57 | 58 | - (NSManagedObjectModel *)managedObjectModel { 59 | // The managed object model for the application. It is a fatal error for the application not to be able to find and load its model. 60 | if (_managedObjectModel != nil) { 61 | return _managedObjectModel; 62 | } 63 | NSURL *modelURL = [[NSBundle mainBundle] URLForResource:@"PullToRefresh" withExtension:@"momd"]; 64 | _managedObjectModel = [[NSManagedObjectModel alloc] initWithContentsOfURL:modelURL]; 65 | return _managedObjectModel; 66 | } 67 | 68 | - (NSPersistentStoreCoordinator *)persistentStoreCoordinator { 69 | // The persistent store coordinator for the application. This implementation creates and returns a coordinator, having added the store for the application to it. 70 | if (_persistentStoreCoordinator != nil) { 71 | return _persistentStoreCoordinator; 72 | } 73 | 74 | // Create the coordinator and store 75 | 76 | _persistentStoreCoordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:[self managedObjectModel]]; 77 | NSURL *storeURL = [[self applicationDocumentsDirectory] URLByAppendingPathComponent:@"PullToRefresh.sqlite"]; 78 | NSError *error = nil; 79 | NSString *failureReason = @"There was an error creating or loading the application's saved data."; 80 | if (![_persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeURL options:nil error:&error]) { 81 | // Report any error we got. 82 | NSMutableDictionary *dict = [NSMutableDictionary dictionary]; 83 | dict[NSLocalizedDescriptionKey] = @"Failed to initialize the application's saved data"; 84 | dict[NSLocalizedFailureReasonErrorKey] = failureReason; 85 | dict[NSUnderlyingErrorKey] = error; 86 | error = [NSError errorWithDomain:@"YOUR_ERROR_DOMAIN" code:9999 userInfo:dict]; 87 | // Replace this with code to handle the error appropriately. 88 | // abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. 89 | NSLog(@"Unresolved error %@, %@", error, [error userInfo]); 90 | abort(); 91 | } 92 | 93 | return _persistentStoreCoordinator; 94 | } 95 | 96 | 97 | - (NSManagedObjectContext *)managedObjectContext { 98 | // Returns the managed object context for the application (which is already bound to the persistent store coordinator for the application.) 99 | if (_managedObjectContext != nil) { 100 | return _managedObjectContext; 101 | } 102 | 103 | NSPersistentStoreCoordinator *coordinator = [self persistentStoreCoordinator]; 104 | if (!coordinator) { 105 | return nil; 106 | } 107 | _managedObjectContext = [[NSManagedObjectContext alloc] initWithConcurrencyType:NSMainQueueConcurrencyType]; 108 | [_managedObjectContext setPersistentStoreCoordinator:coordinator]; 109 | return _managedObjectContext; 110 | } 111 | 112 | #pragma mark - Core Data Saving support 113 | 114 | - (void)saveContext { 115 | NSManagedObjectContext *managedObjectContext = self.managedObjectContext; 116 | if (managedObjectContext != nil) { 117 | NSError *error = nil; 118 | if ([managedObjectContext hasChanges] && ![managedObjectContext save:&error]) { 119 | // Replace this implementation with code to handle the error appropriately. 120 | // abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. 121 | NSLog(@"Unresolved error %@, %@", error, [error userInfo]); 122 | abort(); 123 | } 124 | } 125 | } 126 | 127 | @end 128 | -------------------------------------------------------------------------------- /PullToRefresh/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /PullToRefresh/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 | -------------------------------------------------------------------------------- /PullToRefresh/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 | -------------------------------------------------------------------------------- /PullToRefresh/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 | 40 | 41 | -------------------------------------------------------------------------------- /PullToRefresh/PullToRefresh.xcdatamodeld/.xccurrentversion: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | _XCCurrentVersionName 6 | PullToRefresh.xcdatamodel 7 | 8 | 9 | -------------------------------------------------------------------------------- /PullToRefresh/PullToRefresh.xcdatamodeld/PullToRefresh.xcdatamodel/contents: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /PullToRefresh/Refresh.h: -------------------------------------------------------------------------------- 1 | // 2 | // Refresh.h 3 | // PullToRefresh 4 | // 5 | // Created by Milad Shokrkhah on 3/26/16. 6 | // Copyright © 2016 com.mrapplication. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface Refresh : UIView 12 | 13 | @property (nonatomic, strong) CAShapeLayer *animationLayerStrokePath; 14 | @property (nonatomic, strong) CAShapeLayer *animationLayerCirclePath; 15 | 16 | @property (nonatomic, strong) UIBezierPath *strokePath; 17 | @property (nonatomic, strong) UIBezierPath *circlePath; 18 | 19 | - (void)drawRefreshShapes; 20 | - (void)animateRefreshShapes; 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /PullToRefresh/Refresh.m: -------------------------------------------------------------------------------- 1 | // 2 | // Refresh.m 3 | // PullToRefresh 4 | // 5 | // Created by Milad Shokrkhah on 3/26/16. 6 | // Copyright © 2016 com.mrapplication. All rights reserved. 7 | // 8 | 9 | #import "Refresh.h" 10 | 11 | @implementation Refresh 12 | 13 | - (void)drawRefreshShapes { 14 | 15 | // Calculate middle screen and position 16 | CGFloat middlePostitonX = [[UIScreen mainScreen] bounds].size.width / 2.0; 17 | CGPoint position = CGPointMake(middlePostitonX, 30); 18 | 19 | // BezierPath path (Stroke) 20 | self.strokePath = UIBezierPath.bezierPath; 21 | [self.strokePath moveToPoint:CGPointMake(84, 54)]; 22 | [self.strokePath addCurveToPoint: CGPointMake(70, 40) controlPoint1: CGPointMake(84, 46.27) controlPoint2: CGPointMake(77.73, 40)]; 23 | [self.strokePath addCurveToPoint: CGPointMake(56, 54) controlPoint1: CGPointMake(62.27, 40) controlPoint2: CGPointMake(56, 46.27)]; 24 | [self.strokePath addCurveToPoint: CGPointMake(70, 68) controlPoint1: CGPointMake(56, 61.73) controlPoint2: CGPointMake(62.27, 68)]; 25 | [self.strokePath addCurveToPoint: CGPointMake(84, 54) controlPoint1: CGPointMake(77.73, 68) controlPoint2: CGPointMake(84, 61.73)]; 26 | [self.strokePath closePath]; 27 | [self.strokePath stroke]; 28 | 29 | // AnimaionLayer for stroke path 30 | self.animationLayerStrokePath = [CAShapeLayer new]; 31 | self.animationLayerStrokePath.path = self.strokePath.CGPath; 32 | self.animationLayerStrokePath.fillColor = nil; 33 | self.animationLayerStrokePath.strokeColor = [UIColor lightGrayColor].CGColor; 34 | self.animationLayerStrokePath.lineWidth = 2.0; 35 | self.animationLayerStrokePath.strokeEnd = 0; 36 | self.animationLayerStrokePath.masksToBounds = YES; 37 | self.animationLayerStrokePath.anchorPoint = CGPointMake(0.5, 0.5); 38 | self.animationLayerStrokePath.position = position; 39 | self.animationLayerStrokePath.bounds = CGPathGetPathBoundingBox(CGPathCreateCopyByStrokingPath(self.animationLayerStrokePath.path, nil, 4, kCGLineCapRound, kCGLineJoinMiter, 4)); 40 | 41 | // BezierPath path (Circle) 42 | CGRect circleFrame = CGRectMake(0, 0, 24, 24); 43 | self.circlePath = [UIBezierPath bezierPathWithOvalInRect:circleFrame]; 44 | 45 | // AnimaionLayer for circle path 46 | self.animationLayerCirclePath = [CAShapeLayer new]; 47 | self.animationLayerCirclePath.path = self.circlePath.CGPath; 48 | self.animationLayerCirclePath.fillColor = [UIColor colorWithRed:240/255.0f green:240/255.0f blue:240/255.0f alpha:1.0].CGColor; 49 | self.animationLayerCirclePath.masksToBounds = YES; 50 | self.animationLayerCirclePath.position = position; 51 | self.animationLayerCirclePath.bounds = CGPathGetPathBoundingBox(CGPathCreateCopyByStrokingPath(self.animationLayerCirclePath.path, nil, 4, kCGLineCapRound, kCGLineJoinMiter, 4)); 52 | } 53 | 54 | - (void)animateRefreshShapes { 55 | 56 | // Animation 57 | CABasicAnimation *stroke = [CABasicAnimation animationWithKeyPath:@"strokeEnd"]; 58 | stroke.fromValue = [NSNumber numberWithInt:0]; 59 | stroke.toValue = [NSNumber numberWithInt:1.0]; 60 | stroke.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; 61 | stroke.duration = 1.5; 62 | [self.animationLayerStrokePath addAnimation:stroke forKey:@"strokeEnd"]; 63 | 64 | CAKeyframeAnimation *colorsAnimation = [CAKeyframeAnimation animationWithKeyPath:@"strokeColor"]; 65 | colorsAnimation.values = [NSArray arrayWithObjects: 66 | (id)[UIColor whiteColor].CGColor, 67 | (id)[UIColor lightGrayColor].CGColor, 68 | (id)[UIColor whiteColor].CGColor, 69 | (id)[UIColor colorWithRed:41/255.0f green:85/255.0f blue:115/255.0f alpha:1.0].CGColor, nil]; 70 | colorsAnimation.keyTimes = [NSArray arrayWithObjects: 71 | [NSNumber numberWithFloat:0.25], 72 | [NSNumber numberWithFloat:0.5], 73 | [NSNumber numberWithFloat:0.75], 74 | [NSNumber numberWithFloat:1.0], nil]; 75 | colorsAnimation.calculationMode = kCAAnimationPaced; 76 | colorsAnimation.removedOnCompletion = NO; 77 | colorsAnimation.fillMode = kCAFillModeForwards; 78 | colorsAnimation.duration = 1.5f; 79 | [self.animationLayerStrokePath addAnimation:colorsAnimation forKey:@"strokeColor"]; 80 | } 81 | 82 | @end 83 | -------------------------------------------------------------------------------- /PullToRefresh/TableViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // TableViewController.h 3 | // PullToRefresh 4 | // 5 | // Created by Milad Shokrkhah on 3/26/16. 6 | // Copyright © 2016 com.mrapplication. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "Refresh.h" 11 | 12 | @interface TableViewController : UITableViewController 13 | 14 | @property (nonatomic, strong) UIView *refreshLoadingView; 15 | @property (nonatomic, strong) UIView *refreshColorView; 16 | @property (assign) BOOL isRefreshAnimating; 17 | 18 | @property (nonatomic, strong) Refresh *myRefresh; 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /PullToRefresh/TableViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // TableViewController.m 3 | // PullToRefresh 4 | // 5 | // Created by Milad Shokrkhah on 3/26/16. 6 | // Copyright © 2016 com.mrapplication. All rights reserved. 7 | // 8 | 9 | #import "TableViewController.h" 10 | 11 | @interface TableViewController () 12 | 13 | @end 14 | 15 | @implementation TableViewController 16 | 17 | @synthesize myRefresh; 18 | 19 | - (void)viewDidLoad { 20 | 21 | [super viewDidLoad]; 22 | 23 | [self setupRefreshControl]; 24 | } 25 | 26 | #pragma mark - Refresh 27 | - (void)setupRefreshControl { 28 | 29 | // Programmatically inserting a UIRefreshControl & Get Rect 30 | self.refreshControl = [[UIRefreshControl alloc] init]; 31 | self.refreshControl.tintColor = [UIColor clearColor]; 32 | CGRect refreshBounds = self.refreshControl.bounds; 33 | 34 | // Setup the loading view, which will hold the moving graphics 35 | self.refreshLoadingView = [[UIView alloc] initWithFrame:refreshBounds]; 36 | self.refreshLoadingView.backgroundColor = [UIColor clearColor]; 37 | self.refreshLoadingView.clipsToBounds = YES; 38 | 39 | // Setup the color view, which will display the rainbowed background 40 | self.refreshColorView = [[UIView alloc] initWithFrame:refreshBounds]; 41 | self.refreshColorView.backgroundColor = [UIColor lightGrayColor]; 42 | self.refreshColorView.alpha = 0.30; 43 | 44 | // Add the loading and colors views to our refresh control 45 | [self.refreshControl addSubview:self.refreshColorView]; 46 | [self.refreshControl addSubview:self.refreshLoadingView]; 47 | 48 | // Initalize flags 49 | self.isRefreshAnimating = NO; 50 | 51 | // When activated, invoke our refresh function 52 | [self.refreshControl addTarget:self action:@selector(refresh:) forControlEvents:UIControlEventValueChanged]; 53 | 54 | // Refresh shapes setup & call draw refresh element 55 | myRefresh = [[Refresh alloc] init]; 56 | [myRefresh drawRefreshShapes]; 57 | 58 | // Add it two element of animationsLayers into refreshLoadingView layer 59 | [self.refreshLoadingView.layer addSublayer:myRefresh.animationLayerCirclePath]; 60 | [self.refreshLoadingView.layer addSublayer:myRefresh.animationLayerStrokePath]; 61 | } 62 | 63 | - (void)animateRefreshView { 64 | 65 | // Animate Refresh shapes 66 | [myRefresh animateRefreshShapes]; 67 | 68 | // Flag that we are animating 69 | self.isRefreshAnimating = YES; 70 | 71 | // Background color to loop through for our color view 72 | NSArray *colorArray = @[ 73 | [UIColor lightGrayColor], 74 | [UIColor greenColor], 75 | [UIColor darkGrayColor], 76 | [UIColor lightGrayColor], 77 | [UIColor orangeColor], 78 | [UIColor blueColor], 79 | [UIColor lightGrayColor], 80 | [UIColor redColor]]; 81 | 82 | static int colorIndex = 0; 83 | 84 | [UIView animateWithDuration:1.5 85 | delay:0 86 | options:UIViewAnimationOptionCurveLinear 87 | animations:^{ 88 | 89 | // Change the background color 90 | self.refreshColorView.backgroundColor = [colorArray objectAtIndex:colorIndex]; 91 | colorIndex = (colorIndex + 1) % colorArray.count; 92 | } 93 | completion:^(BOOL finished) { 94 | 95 | if (self.refreshControl.isRefreshing) 96 | { 97 | [self animateRefreshView]; 98 | } 99 | else 100 | { 101 | self.isRefreshAnimating = NO; 102 | } 103 | }]; 104 | } 105 | 106 | - (void)scrollViewDidScroll:(UIScrollView *)scrollView { 107 | 108 | // Get the current size of the refresh controller 109 | CGRect refreshBounds = self.refreshControl.bounds; 110 | 111 | // Distance the table has been pulled >= 0 112 | CGFloat pullDistance = MAX(0.0, -self.refreshControl.frame.origin.y); 113 | 114 | // Set the encompassing view's frames 115 | refreshBounds.size.height = pullDistance; 116 | 117 | self.refreshColorView.frame = refreshBounds; 118 | self.refreshLoadingView.frame = refreshBounds; 119 | 120 | // If we're refreshing and the animation is not playing 121 | if (self.refreshControl.isRefreshing && !self.isRefreshAnimating) 122 | { 123 | [self animateRefreshView]; 124 | } 125 | } 126 | 127 | - (void)refresh:(id)sender { 128 | 129 | double delayInSeconds = 10.0; 130 | dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC)); 131 | 132 | dispatch_after(popTime, dispatch_get_main_queue(), ^(void){ 133 | NSLog(@"Done refresh"); 134 | [self.refreshControl endRefreshing]; 135 | }); 136 | } 137 | 138 | #pragma mark - Table view data source 139 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { 140 | return 1; 141 | } 142 | 143 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 144 | return 20; 145 | } 146 | 147 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 148 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell" forIndexPath:indexPath]; 149 | 150 | cell.textLabel.text = @"refresh"; 151 | 152 | return cell; 153 | } 154 | 155 | @end 156 | -------------------------------------------------------------------------------- /PullToRefresh/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // PullToRefresh 4 | // 5 | // Created by Milad Shokrkhah on 3/26/16. 6 | // Copyright © 2016 com.mrapplication. 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 | -------------------------------------------------------------------------------- /PullToRefreshTests/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 | -------------------------------------------------------------------------------- /PullToRefreshTests/PullToRefreshTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // PullToRefreshTests.m 3 | // PullToRefreshTests 4 | // 5 | // Created by Milad Shokrkhah on 3/26/16. 6 | // Copyright © 2016 com.mrapplication. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface PullToRefreshTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation PullToRefreshTests 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 | -------------------------------------------------------------------------------- /PullToRefreshUITests/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 | -------------------------------------------------------------------------------- /PullToRefreshUITests/PullToRefreshUITests.m: -------------------------------------------------------------------------------- 1 | // 2 | // PullToRefreshUITests.m 3 | // PullToRefreshUITests 4 | // 5 | // Created by Milad Shokrkhah on 3/26/16. 6 | // Copyright © 2016 com.mrapplication. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface PullToRefreshUITests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation PullToRefreshUITests 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 | --------------------------------------------------------------------------------