├── .github └── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md ├── .gitignore ├── .swiftpm └── xcode │ └── package.xcworkspace │ └── contents.xcworkspacedata ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── Example ├── Podfile ├── Podfile.lock ├── PullToRefreshDemo.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ ├── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ │ └── xcuserdata │ │ │ └── mansi.vadodariya.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ └── xcuserdata │ │ └── mansi.vadodariya.xcuserdatad │ │ ├── xcdebugger │ │ └── Breakpoints_v2.xcbkptlist │ │ └── xcschemes │ │ └── xcschememanagement.plist ├── PullToRefreshDemo.xcworkspace │ ├── contents.xcworkspacedata │ ├── xcshareddata │ │ └── IDEWorkspaceChecks.plist │ └── xcuserdata │ │ └── mansi.vadodariya.xcuserdatad │ │ ├── UserInterfaceState.xcuserstate │ │ └── xcdebugger │ │ └── Breakpoints_v2.xcbkptlist └── PullToRefreshDemo │ ├── AppDelegate.swift │ ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard │ ├── Info.plist │ ├── Resource │ └── Assets.xcassets │ │ ├── AccentColor.colorset │ │ └── Contents.json │ │ ├── AppIcon.appiconset │ │ └── Contents.json │ │ ├── Contents.json │ │ ├── fullCircle.imageset │ │ ├── Contents.json │ │ └── fullCircle.png │ │ └── spinner.imageset │ │ ├── Contents.json │ │ └── spinnerTwo.png │ └── ViewController │ ├── PulseAnimationController.swift │ ├── SpinnerAnimationController.swift │ └── WaveAnimationController.swift ├── LICENSE ├── PULL_REQUEST_TEMPLATE.md ├── Package.swift ├── README.md ├── SSCustomPullToRefresh.podspec ├── Sources └── SSCustomPullToRefresh │ ├── Extension │ └── UIImage+Extension.swift │ └── Views │ ├── PulseAnimationView.swift │ ├── RefreshDelegate.swift │ ├── SineWaveAnimationView.swift │ ├── SpinnerAnimationView.swift │ └── WavesView.swift ├── Tests ├── LinuxMain.swift └── SSPullToRefreshTests │ ├── SSPullToRefreshTests.swift │ └── XCTestManifests.swift ├── pulseAnimation.gif ├── spinnerAnimation.gif ├── waveAnimation.gif └── waveSingleColor.gif /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Desktop (please complete the following information):** 27 | - OS: [e.g. iOS] 28 | - Browser [e.g. chrome, safari] 29 | - Version [e.g. 22] 30 | 31 | **Smartphone (please complete the following information):** 32 | - Device: [e.g. iPhone6] 33 | - OS: [e.g. iOS8.1] 34 | - Browser [e.g. stock browser, safari] 35 | - Version [e.g. 22] 36 | 37 | **Additional context** 38 | Add any other context about the problem here. 39 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | xcuserdata/ 6 | -------------------------------------------------------------------------------- /.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to making participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, body 8 | size, disability, ethnicity, sex characteristics, gender identity and expression, 9 | level of experience, education, socio-economic status, nationality, personal 10 | appearance, race, religion, or sexual identity and orientation. 11 | 12 | ## Our Standards 13 | 14 | Examples of behavior that contributes to creating a positive environment 15 | include: 16 | 17 | * Using welcoming and inclusive language 18 | * Being respectful of differing viewpoints and experiences 19 | * Gracefully accepting constructive criticism 20 | * Focusing on what is best for the community 21 | * Showing empathy towards other community members 22 | 23 | Examples of unacceptable behavior by participants include: 24 | 25 | * The use of sexualized language or imagery and unwelcome sexual attention or 26 | advances 27 | * Trolling, insulting/derogatory comments, and personal or political attacks 28 | * Public or private harassment 29 | * Publishing others' private information, such as a physical or electronic 30 | address, without explicit permission 31 | * Other conduct which could reasonably be considered inappropriate in a 32 | professional setting 33 | 34 | ## Our Responsibilities 35 | 36 | Project maintainers are responsible for clarifying the standards of acceptable 37 | behavior and are expected to take appropriate and fair corrective action in 38 | response to any instances of unacceptable behavior. 39 | 40 | Project maintainers have the right and responsibility to remove, edit, or 41 | reject comments, commits, code, wiki edits, issues, and other contributions 42 | that are not aligned to this Code of Conduct, or to ban temporarily or 43 | permanently any contributor for other behaviors that they deem inappropriate, 44 | threatening, offensive, or harmful. 45 | 46 | ## Scope 47 | 48 | This Code of Conduct applies both within project spaces and in public spaces 49 | when an individual is representing the project or its community. Examples of 50 | representing a project or community include using an official project e-mail 51 | address, posting via an official social media account, or acting as an appointed 52 | representative at an online or offline event. Representation of a project may be 53 | further defined and clarified by project maintainers. 54 | 55 | ## Enforcement 56 | 57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 58 | reported by contacting the project team at developer@simform.com. All 59 | complaints will be reviewed and investigated and will result in a response that 60 | is deemed necessary and appropriate to the circumstances. The project team is 61 | obligated to maintain confidentiality with regard to the reporter of an incident. 62 | Further details of specific enforcement policies may be posted separately. 63 | 64 | Project maintainers who do not follow or enforce the Code of Conduct in good 65 | faith may face temporary or permanent repercussions as determined by other 66 | members of the project's leadership. 67 | 68 | ## Attribution 69 | 70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, 71 | available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html 72 | 73 | [homepage]: https://www.contributor-covenant.org 74 | 75 | For answers to common questions about this code of conduct, see 76 | https://www.contributor-covenant.org/faq 77 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | We'd love for you to contribute to our source code and to make the project even better than it is today! 3 | Here are the guidelines we'd like you to follow: 4 | 5 | - [Code of Conduct](#coc) 6 | - [Git Commit Messages](#commit) 7 | - [Got a Question or Problem?](#question) 8 | - [Found an Issue?](#issue) 9 | 10 | ## Code of Conduct 11 | [Code of Conduct](https://github.com/mobile-simformsolutions/SSCustomPullToRefresh/blob/master/CODE_OF_CONDUCT.md) 12 | 13 | ## Git Commit Messages 14 | 15 | * Use the present tense ("Add feature" not "Added feature") 16 | * Use the imperative mood ("Move cursor to..." not "Moves cursor to...") 17 | * Limit the first line to 72 characters or less 18 | * Reference issues and pull requests liberally after the first line 19 | * When only changing documentation, include `[ci skip]` in the commit title 20 | * Consider starting the commit message with an applicable emoji: 21 | * :art: `:art:` when improving the format/structure of the code 22 | * :racehorse: `:racehorse:` when improving performance 23 | * :non-potable_water: `:non-potable_water:` when plugging memory leaks 24 | * :memo: `:memo:` when writing docs 25 | * :bug: `:bug:` when fixing a bug 26 | * :fire: `:fire:` when removing code or files 27 | * :green_heart: `:green_heart:` when fixing the CI build 28 | * :white_check_mark: `:white_check_mark:` when adding tests 29 | * :lock: `:lock:` when dealing with security 30 | * :arrow_up: `:arrow_up:` when upgrading dependencies 31 | * :arrow_down: `:arrow_down:` when downgrading dependencies 32 | * :shirt: `:shirt:` when removing lint/checkstyle warnings 33 | 34 | Find all the available emojis [here](https://gitmoji.carloscuesta.me/). 35 | 36 | ## Got a Question or Problem? 37 | 38 | If you feel that we're missing an important bit of documentation, feel free to 39 | file an issue so we can help. Here's an example to get you started: 40 | 41 | ``` 42 | What are you trying to do or find out more about? 43 | 44 | Where have you looked? 45 | 46 | Where did you expect to find this information? 47 | ``` 48 | 49 | ## Found an Issue? 50 | If you find a bug in the source code or a mistake in the documentation, you can help us by 51 | submitting an issue to our project. 52 | 53 | To submit an issue, please check the [Issue Template](https://github.com/mobile-simformsolutions/SSCustomPullToRefresh/blob/master/ISSUE_TEMPLATE.md). 54 | 55 | Even better you can submit a Pull Request with a fix. 56 | 57 | ### Pull Request 58 | To generate a pull request, please consider following [Pull Request Template](https://github.com/mobile-simformsolutions/SSCustomPullToRefresh/blob/master/PULL_REQUEST_TEMPLATE.md). 59 | 60 | * Search [GitHub](https://github.com/mobile-simformsolutions/SSCustomPullToRefresh/pulls) for an open or closed Pull Request 61 | that relates to your submission. You don't want to duplicate effort. 62 | * Please have a look at [License](https://github.com/mobile-simformsolutions/SSCustomPullToRefresh/blob/master/LICENSE) before sending pull 63 | requests. We cannot accept code without this. 64 | 65 | That's it! Thank you for your contribution! 66 | -------------------------------------------------------------------------------- /Example/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment the next line to define a global platform for your project 2 | # platform :ios, '9.0' 3 | 4 | target 'PullToRefreshDemo' do 5 | # Comment the next line if you don't want to use dynamic frameworks 6 | use_frameworks! 7 | pod 'SSCustomPullToRefresh', :path => '../' 8 | # Pods for PullToRefreshDemo 9 | 10 | end 11 | -------------------------------------------------------------------------------- /Example/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - SSCustomPullToRefresh (1.0.0) 3 | 4 | DEPENDENCIES: 5 | - SSCustomPullToRefresh (from `../`) 6 | 7 | EXTERNAL SOURCES: 8 | SSCustomPullToRefresh: 9 | :path: "../" 10 | 11 | SPEC CHECKSUMS: 12 | SSCustomPullToRefresh: 4b91bbca6e618ec669e468bf425ded6e8fffa759 13 | 14 | PODFILE CHECKSUM: f06a0916bc2e4abe788076b7801519729069b886 15 | 16 | COCOAPODS: 1.10.1 17 | -------------------------------------------------------------------------------- /Example/PullToRefreshDemo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 51; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 03297D06260B0A5600499B1A /* PulseAnimationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03297D05260B0A5600499B1A /* PulseAnimationController.swift */; }; 11 | 0356B1AC2609B64A00FD73C5 /* WaveAnimationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0356B1AB2609B64A00FD73C5 /* WaveAnimationController.swift */; }; 12 | 03F6D09C260885390064BC26 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03F6D09B260885390064BC26 /* AppDelegate.swift */; }; 13 | 03F6D0A0260885390064BC26 /* SpinnerAnimationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03F6D09F260885390064BC26 /* SpinnerAnimationController.swift */; }; 14 | 03F6D0A3260885390064BC26 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 03F6D0A1260885390064BC26 /* Main.storyboard */; }; 15 | 03F6D0A5260885390064BC26 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 03F6D0A4260885390064BC26 /* Assets.xcassets */; }; 16 | 03F6D0A8260885390064BC26 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 03F6D0A6260885390064BC26 /* LaunchScreen.storyboard */; }; 17 | 3C366D25F214FD4C215008CE /* Pods_PullToRefreshDemo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D007B3FE14506E2F4AD17069 /* Pods_PullToRefreshDemo.framework */; }; 18 | /* End PBXBuildFile section */ 19 | 20 | /* Begin PBXFileReference section */ 21 | 03297D05260B0A5600499B1A /* PulseAnimationController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PulseAnimationController.swift; sourceTree = ""; }; 22 | 0356B1AB2609B64A00FD73C5 /* WaveAnimationController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WaveAnimationController.swift; sourceTree = ""; }; 23 | 03F6D098260885390064BC26 /* PullToRefreshDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = PullToRefreshDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 24 | 03F6D09B260885390064BC26 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 25 | 03F6D09F260885390064BC26 /* SpinnerAnimationController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SpinnerAnimationController.swift; sourceTree = ""; }; 26 | 03F6D0A2260885390064BC26 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 27 | 03F6D0A4260885390064BC26 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 28 | 03F6D0A7260885390064BC26 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 29 | 03F6D0A9260885390064BC26 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 30 | 987571D85AB1F55AC2AE1E78 /* Pods-PullToRefreshDemo.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PullToRefreshDemo.release.xcconfig"; path = "Target Support Files/Pods-PullToRefreshDemo/Pods-PullToRefreshDemo.release.xcconfig"; sourceTree = ""; }; 31 | 9ADEA40808551A2C5ADA0EF5 /* Pods-PullToRefreshDemo.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PullToRefreshDemo.debug.xcconfig"; path = "Target Support Files/Pods-PullToRefreshDemo/Pods-PullToRefreshDemo.debug.xcconfig"; sourceTree = ""; }; 32 | D007B3FE14506E2F4AD17069 /* Pods_PullToRefreshDemo.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_PullToRefreshDemo.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 33 | /* End PBXFileReference section */ 34 | 35 | /* Begin PBXFrameworksBuildPhase section */ 36 | 03F6D095260885390064BC26 /* Frameworks */ = { 37 | isa = PBXFrameworksBuildPhase; 38 | buildActionMask = 2147483647; 39 | files = ( 40 | 3C366D25F214FD4C215008CE /* Pods_PullToRefreshDemo.framework in Frameworks */, 41 | ); 42 | runOnlyForDeploymentPostprocessing = 0; 43 | }; 44 | /* End PBXFrameworksBuildPhase section */ 45 | 46 | /* Begin PBXGroup section */ 47 | 03548AD9262565E400E8436D /* ViewController */ = { 48 | isa = PBXGroup; 49 | children = ( 50 | 03F6D09F260885390064BC26 /* SpinnerAnimationController.swift */, 51 | 0356B1AB2609B64A00FD73C5 /* WaveAnimationController.swift */, 52 | 03297D05260B0A5600499B1A /* PulseAnimationController.swift */, 53 | ); 54 | path = ViewController; 55 | sourceTree = ""; 56 | }; 57 | 03F6D08F260885390064BC26 = { 58 | isa = PBXGroup; 59 | children = ( 60 | 03F6D09A260885390064BC26 /* PullToRefreshDemo */, 61 | 03F6D099260885390064BC26 /* Products */, 62 | 3F7D90B51A4D8FA858AB554C /* Pods */, 63 | 2F06D03A8431DF27401357D3 /* Frameworks */, 64 | ); 65 | sourceTree = ""; 66 | }; 67 | 03F6D099260885390064BC26 /* Products */ = { 68 | isa = PBXGroup; 69 | children = ( 70 | 03F6D098260885390064BC26 /* PullToRefreshDemo.app */, 71 | ); 72 | name = Products; 73 | sourceTree = ""; 74 | }; 75 | 03F6D09A260885390064BC26 /* PullToRefreshDemo */ = { 76 | isa = PBXGroup; 77 | children = ( 78 | 03548AD9262565E400E8436D /* ViewController */, 79 | 03F6D0B0260885570064BC26 /* Resource */, 80 | 03F6D09B260885390064BC26 /* AppDelegate.swift */, 81 | 03F6D0A1260885390064BC26 /* Main.storyboard */, 82 | 03F6D0A6260885390064BC26 /* LaunchScreen.storyboard */, 83 | 03F6D0A9260885390064BC26 /* Info.plist */, 84 | ); 85 | path = PullToRefreshDemo; 86 | sourceTree = ""; 87 | }; 88 | 03F6D0B0260885570064BC26 /* Resource */ = { 89 | isa = PBXGroup; 90 | children = ( 91 | 03F6D0A4260885390064BC26 /* Assets.xcassets */, 92 | ); 93 | path = Resource; 94 | sourceTree = ""; 95 | }; 96 | 2F06D03A8431DF27401357D3 /* Frameworks */ = { 97 | isa = PBXGroup; 98 | children = ( 99 | D007B3FE14506E2F4AD17069 /* Pods_PullToRefreshDemo.framework */, 100 | ); 101 | name = Frameworks; 102 | sourceTree = ""; 103 | }; 104 | 3F7D90B51A4D8FA858AB554C /* Pods */ = { 105 | isa = PBXGroup; 106 | children = ( 107 | 9ADEA40808551A2C5ADA0EF5 /* Pods-PullToRefreshDemo.debug.xcconfig */, 108 | 987571D85AB1F55AC2AE1E78 /* Pods-PullToRefreshDemo.release.xcconfig */, 109 | ); 110 | path = Pods; 111 | sourceTree = ""; 112 | }; 113 | /* End PBXGroup section */ 114 | 115 | /* Begin PBXNativeTarget section */ 116 | 03F6D097260885390064BC26 /* PullToRefreshDemo */ = { 117 | isa = PBXNativeTarget; 118 | buildConfigurationList = 03F6D0AC260885390064BC26 /* Build configuration list for PBXNativeTarget "PullToRefreshDemo" */; 119 | buildPhases = ( 120 | 5DFA2E0A2E11A9B59179A893 /* [CP] Check Pods Manifest.lock */, 121 | 03F6D094260885390064BC26 /* Sources */, 122 | 03F6D095260885390064BC26 /* Frameworks */, 123 | 03F6D096260885390064BC26 /* Resources */, 124 | 9A406D84728FE486A11CE3C8 /* [CP] Embed Pods Frameworks */, 125 | ); 126 | buildRules = ( 127 | ); 128 | dependencies = ( 129 | ); 130 | name = PullToRefreshDemo; 131 | productName = PullToRefreshDemo; 132 | productReference = 03F6D098260885390064BC26 /* PullToRefreshDemo.app */; 133 | productType = "com.apple.product-type.application"; 134 | }; 135 | /* End PBXNativeTarget section */ 136 | 137 | /* Begin PBXProject section */ 138 | 03F6D090260885390064BC26 /* Project object */ = { 139 | isa = PBXProject; 140 | attributes = { 141 | LastSwiftUpdateCheck = 1230; 142 | LastUpgradeCheck = 1230; 143 | TargetAttributes = { 144 | 03F6D097260885390064BC26 = { 145 | CreatedOnToolsVersion = 12.3; 146 | }; 147 | }; 148 | }; 149 | buildConfigurationList = 03F6D093260885390064BC26 /* Build configuration list for PBXProject "PullToRefreshDemo" */; 150 | compatibilityVersion = "Xcode 9.3"; 151 | developmentRegion = en; 152 | hasScannedForEncodings = 0; 153 | knownRegions = ( 154 | en, 155 | Base, 156 | ); 157 | mainGroup = 03F6D08F260885390064BC26; 158 | productRefGroup = 03F6D099260885390064BC26 /* Products */; 159 | projectDirPath = ""; 160 | projectRoot = ""; 161 | targets = ( 162 | 03F6D097260885390064BC26 /* PullToRefreshDemo */, 163 | ); 164 | }; 165 | /* End PBXProject section */ 166 | 167 | /* Begin PBXResourcesBuildPhase section */ 168 | 03F6D096260885390064BC26 /* Resources */ = { 169 | isa = PBXResourcesBuildPhase; 170 | buildActionMask = 2147483647; 171 | files = ( 172 | 03F6D0A8260885390064BC26 /* LaunchScreen.storyboard in Resources */, 173 | 03F6D0A5260885390064BC26 /* Assets.xcassets in Resources */, 174 | 03F6D0A3260885390064BC26 /* Main.storyboard in Resources */, 175 | ); 176 | runOnlyForDeploymentPostprocessing = 0; 177 | }; 178 | /* End PBXResourcesBuildPhase section */ 179 | 180 | /* Begin PBXShellScriptBuildPhase section */ 181 | 5DFA2E0A2E11A9B59179A893 /* [CP] Check Pods Manifest.lock */ = { 182 | isa = PBXShellScriptBuildPhase; 183 | buildActionMask = 2147483647; 184 | files = ( 185 | ); 186 | inputFileListPaths = ( 187 | ); 188 | inputPaths = ( 189 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 190 | "${PODS_ROOT}/Manifest.lock", 191 | ); 192 | name = "[CP] Check Pods Manifest.lock"; 193 | outputFileListPaths = ( 194 | ); 195 | outputPaths = ( 196 | "$(DERIVED_FILE_DIR)/Pods-PullToRefreshDemo-checkManifestLockResult.txt", 197 | ); 198 | runOnlyForDeploymentPostprocessing = 0; 199 | shellPath = /bin/sh; 200 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 201 | showEnvVarsInLog = 0; 202 | }; 203 | 9A406D84728FE486A11CE3C8 /* [CP] Embed Pods Frameworks */ = { 204 | isa = PBXShellScriptBuildPhase; 205 | buildActionMask = 2147483647; 206 | files = ( 207 | ); 208 | inputFileListPaths = ( 209 | "${PODS_ROOT}/Target Support Files/Pods-PullToRefreshDemo/Pods-PullToRefreshDemo-frameworks-${CONFIGURATION}-input-files.xcfilelist", 210 | ); 211 | name = "[CP] Embed Pods Frameworks"; 212 | outputFileListPaths = ( 213 | "${PODS_ROOT}/Target Support Files/Pods-PullToRefreshDemo/Pods-PullToRefreshDemo-frameworks-${CONFIGURATION}-output-files.xcfilelist", 214 | ); 215 | runOnlyForDeploymentPostprocessing = 0; 216 | shellPath = /bin/sh; 217 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-PullToRefreshDemo/Pods-PullToRefreshDemo-frameworks.sh\"\n"; 218 | showEnvVarsInLog = 0; 219 | }; 220 | /* End PBXShellScriptBuildPhase section */ 221 | 222 | /* Begin PBXSourcesBuildPhase section */ 223 | 03F6D094260885390064BC26 /* Sources */ = { 224 | isa = PBXSourcesBuildPhase; 225 | buildActionMask = 2147483647; 226 | files = ( 227 | 0356B1AC2609B64A00FD73C5 /* WaveAnimationController.swift in Sources */, 228 | 03F6D0A0260885390064BC26 /* SpinnerAnimationController.swift in Sources */, 229 | 03297D06260B0A5600499B1A /* PulseAnimationController.swift in Sources */, 230 | 03F6D09C260885390064BC26 /* AppDelegate.swift in Sources */, 231 | ); 232 | runOnlyForDeploymentPostprocessing = 0; 233 | }; 234 | /* End PBXSourcesBuildPhase section */ 235 | 236 | /* Begin PBXVariantGroup section */ 237 | 03F6D0A1260885390064BC26 /* Main.storyboard */ = { 238 | isa = PBXVariantGroup; 239 | children = ( 240 | 03F6D0A2260885390064BC26 /* Base */, 241 | ); 242 | name = Main.storyboard; 243 | sourceTree = ""; 244 | }; 245 | 03F6D0A6260885390064BC26 /* LaunchScreen.storyboard */ = { 246 | isa = PBXVariantGroup; 247 | children = ( 248 | 03F6D0A7260885390064BC26 /* Base */, 249 | ); 250 | name = LaunchScreen.storyboard; 251 | sourceTree = ""; 252 | }; 253 | /* End PBXVariantGroup section */ 254 | 255 | /* Begin XCBuildConfiguration section */ 256 | 03F6D0AA260885390064BC26 /* Debug */ = { 257 | isa = XCBuildConfiguration; 258 | buildSettings = { 259 | ALWAYS_SEARCH_USER_PATHS = NO; 260 | CLANG_ANALYZER_NONNULL = YES; 261 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 262 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 263 | CLANG_CXX_LIBRARY = "libc++"; 264 | CLANG_ENABLE_MODULES = YES; 265 | CLANG_ENABLE_OBJC_ARC = YES; 266 | CLANG_ENABLE_OBJC_WEAK = YES; 267 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 268 | CLANG_WARN_BOOL_CONVERSION = YES; 269 | CLANG_WARN_COMMA = YES; 270 | CLANG_WARN_CONSTANT_CONVERSION = YES; 271 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 272 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 273 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 274 | CLANG_WARN_EMPTY_BODY = YES; 275 | CLANG_WARN_ENUM_CONVERSION = YES; 276 | CLANG_WARN_INFINITE_RECURSION = YES; 277 | CLANG_WARN_INT_CONVERSION = YES; 278 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 279 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 280 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 281 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 282 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 283 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 284 | CLANG_WARN_STRICT_PROTOTYPES = YES; 285 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 286 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 287 | CLANG_WARN_UNREACHABLE_CODE = YES; 288 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 289 | COPY_PHASE_STRIP = NO; 290 | DEBUG_INFORMATION_FORMAT = dwarf; 291 | ENABLE_STRICT_OBJC_MSGSEND = YES; 292 | ENABLE_TESTABILITY = YES; 293 | GCC_C_LANGUAGE_STANDARD = gnu11; 294 | GCC_DYNAMIC_NO_PIC = NO; 295 | GCC_NO_COMMON_BLOCKS = YES; 296 | GCC_OPTIMIZATION_LEVEL = 0; 297 | GCC_PREPROCESSOR_DEFINITIONS = ( 298 | "DEBUG=1", 299 | "$(inherited)", 300 | ); 301 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 302 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 303 | GCC_WARN_UNDECLARED_SELECTOR = YES; 304 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 305 | GCC_WARN_UNUSED_FUNCTION = YES; 306 | GCC_WARN_UNUSED_VARIABLE = YES; 307 | IPHONEOS_DEPLOYMENT_TARGET = 10.0; 308 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 309 | MTL_FAST_MATH = YES; 310 | ONLY_ACTIVE_ARCH = YES; 311 | SDKROOT = iphoneos; 312 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 313 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 314 | }; 315 | name = Debug; 316 | }; 317 | 03F6D0AB260885390064BC26 /* Release */ = { 318 | isa = XCBuildConfiguration; 319 | buildSettings = { 320 | ALWAYS_SEARCH_USER_PATHS = NO; 321 | CLANG_ANALYZER_NONNULL = YES; 322 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 323 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 324 | CLANG_CXX_LIBRARY = "libc++"; 325 | CLANG_ENABLE_MODULES = YES; 326 | CLANG_ENABLE_OBJC_ARC = YES; 327 | CLANG_ENABLE_OBJC_WEAK = YES; 328 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 329 | CLANG_WARN_BOOL_CONVERSION = YES; 330 | CLANG_WARN_COMMA = YES; 331 | CLANG_WARN_CONSTANT_CONVERSION = YES; 332 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 333 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 334 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 335 | CLANG_WARN_EMPTY_BODY = YES; 336 | CLANG_WARN_ENUM_CONVERSION = YES; 337 | CLANG_WARN_INFINITE_RECURSION = YES; 338 | CLANG_WARN_INT_CONVERSION = YES; 339 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 340 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 341 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 342 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 343 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 344 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 345 | CLANG_WARN_STRICT_PROTOTYPES = YES; 346 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 347 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 348 | CLANG_WARN_UNREACHABLE_CODE = YES; 349 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 350 | COPY_PHASE_STRIP = NO; 351 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 352 | ENABLE_NS_ASSERTIONS = NO; 353 | ENABLE_STRICT_OBJC_MSGSEND = YES; 354 | GCC_C_LANGUAGE_STANDARD = gnu11; 355 | GCC_NO_COMMON_BLOCKS = YES; 356 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 357 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 358 | GCC_WARN_UNDECLARED_SELECTOR = YES; 359 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 360 | GCC_WARN_UNUSED_FUNCTION = YES; 361 | GCC_WARN_UNUSED_VARIABLE = YES; 362 | IPHONEOS_DEPLOYMENT_TARGET = 10.0; 363 | MTL_ENABLE_DEBUG_INFO = NO; 364 | MTL_FAST_MATH = YES; 365 | SDKROOT = iphoneos; 366 | SWIFT_COMPILATION_MODE = wholemodule; 367 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 368 | VALIDATE_PRODUCT = YES; 369 | }; 370 | name = Release; 371 | }; 372 | 03F6D0AD260885390064BC26 /* Debug */ = { 373 | isa = XCBuildConfiguration; 374 | baseConfigurationReference = 9ADEA40808551A2C5ADA0EF5 /* Pods-PullToRefreshDemo.debug.xcconfig */; 375 | buildSettings = { 376 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 377 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; 378 | CODE_SIGN_STYLE = Automatic; 379 | DEVELOPMENT_TEAM = K7XJG666ZW; 380 | INFOPLIST_FILE = PullToRefreshDemo/Info.plist; 381 | IPHONEOS_DEPLOYMENT_TARGET = 10.0; 382 | LD_RUNPATH_SEARCH_PATHS = ( 383 | "$(inherited)", 384 | "@executable_path/Frameworks", 385 | ); 386 | PRODUCT_BUNDLE_IDENTIFIER = com.simform.PullToRefreshDemo; 387 | PRODUCT_NAME = "$(TARGET_NAME)"; 388 | SWIFT_VERSION = 5.0; 389 | TARGETED_DEVICE_FAMILY = "1,2"; 390 | }; 391 | name = Debug; 392 | }; 393 | 03F6D0AE260885390064BC26 /* Release */ = { 394 | isa = XCBuildConfiguration; 395 | baseConfigurationReference = 987571D85AB1F55AC2AE1E78 /* Pods-PullToRefreshDemo.release.xcconfig */; 396 | buildSettings = { 397 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 398 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; 399 | CODE_SIGN_STYLE = Automatic; 400 | DEVELOPMENT_TEAM = K7XJG666ZW; 401 | INFOPLIST_FILE = PullToRefreshDemo/Info.plist; 402 | IPHONEOS_DEPLOYMENT_TARGET = 10.0; 403 | LD_RUNPATH_SEARCH_PATHS = ( 404 | "$(inherited)", 405 | "@executable_path/Frameworks", 406 | ); 407 | PRODUCT_BUNDLE_IDENTIFIER = com.simform.PullToRefreshDemo; 408 | PRODUCT_NAME = "$(TARGET_NAME)"; 409 | SWIFT_VERSION = 5.0; 410 | TARGETED_DEVICE_FAMILY = "1,2"; 411 | }; 412 | name = Release; 413 | }; 414 | /* End XCBuildConfiguration section */ 415 | 416 | /* Begin XCConfigurationList section */ 417 | 03F6D093260885390064BC26 /* Build configuration list for PBXProject "PullToRefreshDemo" */ = { 418 | isa = XCConfigurationList; 419 | buildConfigurations = ( 420 | 03F6D0AA260885390064BC26 /* Debug */, 421 | 03F6D0AB260885390064BC26 /* Release */, 422 | ); 423 | defaultConfigurationIsVisible = 0; 424 | defaultConfigurationName = Release; 425 | }; 426 | 03F6D0AC260885390064BC26 /* Build configuration list for PBXNativeTarget "PullToRefreshDemo" */ = { 427 | isa = XCConfigurationList; 428 | buildConfigurations = ( 429 | 03F6D0AD260885390064BC26 /* Debug */, 430 | 03F6D0AE260885390064BC26 /* Release */, 431 | ); 432 | defaultConfigurationIsVisible = 0; 433 | defaultConfigurationName = Release; 434 | }; 435 | /* End XCConfigurationList section */ 436 | }; 437 | rootObject = 03F6D090260885390064BC26 /* Project object */; 438 | } 439 | -------------------------------------------------------------------------------- /Example/PullToRefreshDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Example/PullToRefreshDemo.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Example/PullToRefreshDemo.xcodeproj/project.xcworkspace/xcuserdata/mansi.vadodariya.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimformSolutionsPvtLtd/SSCustomPullToRefresh/eb4d9b2160d05bfcb6c3be66b0aecc37b3b8a9d9/Example/PullToRefreshDemo.xcodeproj/project.xcworkspace/xcuserdata/mansi.vadodariya.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /Example/PullToRefreshDemo.xcodeproj/xcuserdata/mansi.vadodariya.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 9 | 21 | 22 | 23 | 25 | 37 | 38 | 39 | 41 | 53 | 54 | 55 | 57 | 69 | 70 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /Example/PullToRefreshDemo.xcodeproj/xcuserdata/mansi.vadodariya.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | PullToRefreshDemo.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 2 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Example/PullToRefreshDemo.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Example/PullToRefreshDemo.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Example/PullToRefreshDemo.xcworkspace/xcuserdata/mansi.vadodariya.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimformSolutionsPvtLtd/SSCustomPullToRefresh/eb4d9b2160d05bfcb6c3be66b0aecc37b3b8a9d9/Example/PullToRefreshDemo.xcworkspace/xcuserdata/mansi.vadodariya.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /Example/PullToRefreshDemo.xcworkspace/xcuserdata/mansi.vadodariya.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | -------------------------------------------------------------------------------- /Example/PullToRefreshDemo/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // PullToRefreshDemo 4 | // 5 | // Created by Mansi Vadodariya on 22/03/21. 6 | // 7 | 8 | import UIKit 9 | 10 | @UIApplicationMain 11 | class AppDelegate: UIResponder, UIApplicationDelegate { 12 | 13 | var window: UIWindow? 14 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 15 | // Override point for customization after application launch. 16 | return true 17 | } 18 | 19 | func applicationWillResignActive(_ application: UIApplication) { 20 | // 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. 21 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 22 | } 23 | 24 | func applicationDidEnterBackground(_ application: UIApplication) { 25 | // 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. 26 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 27 | } 28 | 29 | func applicationWillEnterForeground(_ application: UIApplication) { 30 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 31 | } 32 | 33 | func applicationDidBecomeActive(_ application: UIApplication) { 34 | // 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. 35 | } 36 | 37 | func applicationWillTerminate(_ application: UIApplication) { 38 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 39 | } 40 | 41 | 42 | } 43 | 44 | -------------------------------------------------------------------------------- /Example/PullToRefreshDemo/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 | -------------------------------------------------------------------------------- /Example/PullToRefreshDemo/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 | 42 | 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 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | -------------------------------------------------------------------------------- /Example/PullToRefreshDemo/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UIApplicationSupportsIndirectInputEvents 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 | -------------------------------------------------------------------------------- /Example/PullToRefreshDemo/Resource/Assets.xcassets/AccentColor.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "colors" : [ 3 | { 4 | "idiom" : "universal" 5 | } 6 | ], 7 | "info" : { 8 | "author" : "xcode", 9 | "version" : 1 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Example/PullToRefreshDemo/Resource/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "scale" : "2x", 6 | "size" : "20x20" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "scale" : "3x", 11 | "size" : "20x20" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "scale" : "2x", 16 | "size" : "29x29" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "scale" : "3x", 21 | "size" : "29x29" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "scale" : "2x", 26 | "size" : "40x40" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "scale" : "3x", 31 | "size" : "40x40" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "scale" : "2x", 36 | "size" : "60x60" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "scale" : "3x", 41 | "size" : "60x60" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "scale" : "1x", 46 | "size" : "20x20" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "scale" : "2x", 51 | "size" : "20x20" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "scale" : "1x", 56 | "size" : "29x29" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "scale" : "2x", 61 | "size" : "29x29" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "scale" : "1x", 66 | "size" : "40x40" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "scale" : "2x", 71 | "size" : "40x40" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "scale" : "1x", 76 | "size" : "76x76" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "scale" : "2x", 81 | "size" : "76x76" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "scale" : "2x", 86 | "size" : "83.5x83.5" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "scale" : "1x", 91 | "size" : "1024x1024" 92 | } 93 | ], 94 | "info" : { 95 | "author" : "xcode", 96 | "version" : 1 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /Example/PullToRefreshDemo/Resource/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /Example/PullToRefreshDemo/Resource/Assets.xcassets/fullCircle.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "filename" : "fullCircle.png", 5 | "idiom" : "universal" 6 | } 7 | ], 8 | "info" : { 9 | "author" : "xcode", 10 | "version" : 1 11 | }, 12 | "properties" : { 13 | "preserves-vector-representation" : true 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Example/PullToRefreshDemo/Resource/Assets.xcassets/fullCircle.imageset/fullCircle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimformSolutionsPvtLtd/SSCustomPullToRefresh/eb4d9b2160d05bfcb6c3be66b0aecc37b3b8a9d9/Example/PullToRefreshDemo/Resource/Assets.xcassets/fullCircle.imageset/fullCircle.png -------------------------------------------------------------------------------- /Example/PullToRefreshDemo/Resource/Assets.xcassets/spinner.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "filename" : "spinnerTwo.png", 5 | "idiom" : "universal" 6 | } 7 | ], 8 | "info" : { 9 | "author" : "xcode", 10 | "version" : 1 11 | }, 12 | "properties" : { 13 | "preserves-vector-representation" : true 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Example/PullToRefreshDemo/Resource/Assets.xcassets/spinner.imageset/spinnerTwo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimformSolutionsPvtLtd/SSCustomPullToRefresh/eb4d9b2160d05bfcb6c3be66b0aecc37b3b8a9d9/Example/PullToRefreshDemo/Resource/Assets.xcassets/spinner.imageset/spinnerTwo.png -------------------------------------------------------------------------------- /Example/PullToRefreshDemo/ViewController/PulseAnimationController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // PulseAnimationController.swift 3 | // PullToRefreshDemo 4 | // 5 | // Created by Mansi Vadodariya on 24/03/21. 6 | // 7 | 8 | import UIKit 9 | import SSCustomPullToRefresh 10 | 11 | class PulseAnimationController: UIViewController { 12 | 13 | // MARK: - Variables 14 | var pulseAnnimation: PulseAnimationView! 15 | 16 | // MARK: - Outlets 17 | @IBOutlet weak var tblViewAnimation: UITableView! 18 | 19 | // MARK: - UIViewController 20 | override func viewDidLoad() { 21 | super.viewDidLoad() 22 | setUpPulseAnimation() 23 | } 24 | 25 | // MARK: - SetUpRefreshControl 26 | func setUpPulseAnimation() { 27 | pulseAnnimation = PulseAnimationView(circleColor: .purple, pulseColor: .purple, pulseViewBackgroundColor: .brown) 28 | pulseAnnimation.delegate = self 29 | pulseAnnimation.parentView = self.tblViewAnimation 30 | pulseAnnimation.setupRefreshControl() 31 | } 32 | 33 | } 34 | 35 | // MARK: - UITableViewDataSource 36 | extension PulseAnimationController: UITableViewDataSource { 37 | 38 | func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 39 | return 20 40 | } 41 | 42 | func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { 43 | let CellIdentifier = "Cell"; 44 | var cell = tableView.dequeueReusableCell(withIdentifier: CellIdentifier) 45 | if (cell == nil) { 46 | cell = UITableViewCell(style: UITableViewCell.CellStyle.default, reuseIdentifier: CellIdentifier) 47 | } 48 | // Configure the cell... 49 | cell?.textLabel?.text = "Row \(indexPath.row + 1)" 50 | return cell! 51 | } 52 | 53 | } 54 | 55 | // MARK: - AnimationDelegate 56 | extension PulseAnimationController: RefreshDelegate { 57 | 58 | func startRefresh() { 59 | print("start refreshing") 60 | DispatchQueue.main.asyncAfter(deadline: .now() + 3.0) { 61 | self.pulseAnnimation.endRefreshing() 62 | } 63 | } 64 | 65 | func endRefresh() { 66 | print("End Refreshing") 67 | } 68 | 69 | } 70 | -------------------------------------------------------------------------------- /Example/PullToRefreshDemo/ViewController/SpinnerAnimationController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SpinnerAnimationController.swift 3 | // PullToRefreshDemo 4 | // 5 | // Created by Mansi Vadodariya on 22/03/21. 6 | // 7 | 8 | import UIKit 9 | import SSCustomPullToRefresh 10 | 11 | class SpinnerAnimationController: UIViewController { 12 | 13 | // MARK: - Variables 14 | var spinnerAnnimation: SpinnerAnimationView! 15 | 16 | // MARK: - Outlets 17 | @IBOutlet weak var tableViewRefersh: UITableView! 18 | 19 | // MARK: - UIViewController 20 | override func viewDidLoad() { 21 | super.viewDidLoad() 22 | setUpSpinnerAnimation() 23 | } 24 | 25 | // MARK: - SetUpRefreshControl 26 | func setUpSpinnerAnimation() { 27 | spinnerAnnimation = SpinnerAnimationView(image: UIImage(named: "spinner") ?? UIImage(), backgroundColor: .purple) 28 | spinnerAnnimation.delegate = self 29 | spinnerAnnimation.parentView = self.tableViewRefersh 30 | spinnerAnnimation.setupRefreshControl() 31 | } 32 | 33 | // MARK: - Action 34 | @IBAction func onClickWaveAnimation(_ sender: Any) { 35 | guard let waveAnimationController = self.storyboard?.instantiateViewController(withIdentifier: "WaveAnimationController") as? WaveAnimationController else { 36 | return 37 | } 38 | self.navigationController?.pushViewController(waveAnimationController, animated: true) 39 | } 40 | 41 | } 42 | 43 | // MARK: - UITableViewDataSource 44 | extension SpinnerAnimationController: UITableViewDataSource { 45 | 46 | func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 47 | return 20 48 | } 49 | 50 | func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { 51 | let CellIdentifier = "Cell"; 52 | var cell = tableView.dequeueReusableCell(withIdentifier: CellIdentifier) 53 | if (cell == nil) { 54 | cell = UITableViewCell(style: UITableViewCell.CellStyle.default, reuseIdentifier: CellIdentifier) 55 | } 56 | // Configure the cell... 57 | cell?.textLabel?.text = "Row \(indexPath.row + 1)" 58 | return cell! 59 | } 60 | 61 | } 62 | 63 | // MARK: - AnimationDelegate 64 | extension SpinnerAnimationController: RefreshDelegate { 65 | 66 | func startRefresh() { 67 | // API Call 68 | print("start refreshing") 69 | DispatchQueue.main.asyncAfter(deadline: .now() + 3.0) { 70 | self.spinnerAnnimation.endRefreshing() 71 | } 72 | } 73 | 74 | func endRefresh() { 75 | print("End Refreshing") 76 | } 77 | 78 | } 79 | -------------------------------------------------------------------------------- /Example/PullToRefreshDemo/ViewController/WaveAnimationController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // WaveAnimationController.swift 3 | // PullToRefreshDemo 4 | // 5 | // Created by Mansi Vadodariya on 23/03/21. 6 | // 7 | 8 | import UIKit 9 | import SSCustomPullToRefresh 10 | 11 | class WaveAnimationController: UIViewController { 12 | 13 | // MARK: - Variables 14 | var sineAnnimation: SineWaveAnimationView! 15 | 16 | // MARK: - Outlets 17 | @IBOutlet weak var tblWaveAnimation: UITableView! 18 | 19 | // MARK: - UIViewController 20 | override func viewDidLoad() { 21 | super.viewDidLoad() 22 | setUpSineAnimation() 23 | } 24 | 25 | // MARK: - SetUpRefreshControl 26 | func setUpSineAnimation() { 27 | sineAnnimation = SineWaveAnimationView(color: .purple) 28 | sineAnnimation.delegate = self 29 | sineAnnimation.parentView = self.tblWaveAnimation 30 | sineAnnimation.setupRefreshControl() 31 | } 32 | 33 | // MARK: - Action 34 | @IBAction func onClickTextAnimation(_ sender: Any) { 35 | guard let pulseAnimationController = self.storyboard?.instantiateViewController(withIdentifier: "PulseAnimationController") as? PulseAnimationController else { 36 | return 37 | } 38 | self.navigationController?.pushViewController(pulseAnimationController, animated: true) 39 | } 40 | 41 | } 42 | 43 | // MARK: - UITableViewDataSource 44 | extension WaveAnimationController: UITableViewDataSource { 45 | 46 | func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 47 | return 20 48 | } 49 | 50 | func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { 51 | let CellIdentifier = "Cell"; 52 | var cell = tableView.dequeueReusableCell(withIdentifier: CellIdentifier) 53 | if (cell == nil) { 54 | cell = UITableViewCell(style: UITableViewCell.CellStyle.default, reuseIdentifier: CellIdentifier) 55 | } 56 | // Configure the cell... 57 | cell?.textLabel?.text = "Row \(indexPath.row + 1)" 58 | return cell! 59 | } 60 | 61 | } 62 | 63 | // MARK: - AnimationDelegate 64 | extension WaveAnimationController: RefreshDelegate { 65 | 66 | func startRefresh() { 67 | // API Call 68 | print("start refreshing") 69 | DispatchQueue.main.asyncAfter(deadline: .now() + 3.0) { 70 | self.sineAnnimation.endRefreshing() 71 | } 72 | } 73 | 74 | func endRefresh() { 75 | print("End Refreshing") 76 | } 77 | 78 | } 79 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Simform Solutions 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ### Requirements 2 | 3 | * Filling out the template is required. Any pull request that does not include enough information to be reviewed in a timely manner may be closed at the maintainers' discretion. 4 | * All new code requires tests to ensure against regressions 5 | 6 | ### Description of the Change 7 | 8 | 13 | 14 | ### Alternate Designs 15 | 16 | 17 | 18 | ### Why Should This Be In Core? 19 | 20 | 21 | 22 | ### Benefits 23 | 24 | 25 | 26 | ### Possible Drawbacks 27 | 28 | 29 | 30 | ### Verification Process 31 | 32 | 43 | 44 | ### Applicable Issues 45 | 46 | 47 | -------------------------------------------------------------------------------- /Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:5.3 2 | // The swift-tools-version declares the minimum version of Swift required to build this package. 3 | 4 | import PackageDescription 5 | 6 | let package = Package( 7 | name: "SSCustomPullToRefresh", 8 | platforms: [ 9 | .iOS(.v10) 10 | ], 11 | products: [ 12 | // Products define the executables and libraries a package produces, and make them visible to other packages. 13 | .library( 14 | name: "SSCustomPullToRefresh", 15 | targets: ["SSCustomPullToRefresh"]), 16 | ], 17 | dependencies: [ 18 | // Dependencies declare other packages that this package depends on. 19 | // .package(url: /* package url */, from: "1.0.0"), 20 | ], 21 | targets: [ 22 | // Targets are the basic building blocks of a package. A target can define a module or a test suite. 23 | // Targets can depend on other targets in this package, and on products in packages this package depends on. 24 | .target( 25 | name: "SSCustomPullToRefresh", 26 | dependencies: []), 27 | .testTarget( 28 | name: "SSCustomPullToRefreshTests", 29 | dependencies: ["SSCustomPullToRefresh"]), 30 | ] 31 | ) 32 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | # SSCustomPullToRefresh 3 | 4 | 5 | SSCustomPullToRefresh is an open-source library that uses UIKit to add an animation to the pull to refresh view in a UITableView and UICollectionView. 6 | 7 | [![Swift Version][swift-image]][swift-url] 8 | [![License][license-image]][license-url] 9 | [![Carthage Compatible][carthage-image]][carthage-url] 10 | [![SwiftPM Compatible][spm-image]][spm-url] 11 | [![Platform][platform-image]][platform-url] 12 | [![PRs Welcome][PR-image]][PR-url] 13 | 14 | #### Animation Type 15 | | Spinner Animation | Pulse Animation | Wave Animation | Wave Animation | 16 | | :--: | :-----: | :--: | :--: | 17 | | ![Alt text](https://github.com/SimformSolutionsPvtLtd/SSCustomPullToRefresh/blob/master/spinnerAnimation.gif?raw=true) | ![Alt text](https://github.com/SimformSolutionsPvtLtd/SSCustomPullToRefresh/blob/master/pulseAnimation.gif?raw=true) | ![Alt text](https://github.com/SimformSolutionsPvtLtd/SSCustomPullToRefresh/blob/master/waveAnimation.gif?raw=true) | ![Alt text](https://github.com/SimformSolutionsPvtLtd/SSCustomPullToRefresh/blob/master/waveSingleColor.gif?raw=true) 18 | 19 | # Requirements 20 | - iOS 10.0+ 21 | - Xcode 11+ 22 | 23 | # Installation 24 | #### CocoaPods 25 | 26 | - You can use CocoaPods to install SSCustomPullToRefresh by adding it to your Podfile: 27 | 28 | use_frameworks! 29 | pod 'SSCustomPullToRefresh' 30 | 31 | - import SSCustomPullToRefresh 32 | 33 | #### Manually 34 | - Download and drop **SSCustomPullToRefresh** folder in your project. 35 | - Congratulations! 36 | 37 | #### Swift Package Manager 38 | - When using Xcode 11 or later, you can install `SSCustomPullToRefresh` by going to your Project settings > `Swift Packages` and add the repository by providing the GitHub URL. Alternatively, you can go to `File` > `Swift Packages` > `Add Package Dependencies...` 39 | ```swift 40 | dependencies: [ 41 | .package(url: "https://github.com/mobile-simformsolutions/SSCustomPullToRefresh.git", from: "1.0.1") 42 | ] 43 | ``` 44 | 45 | #### Carthage 46 | - [Carthage](https://github.com/Carthage/Carthage) is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks. You can install Carthage with [Homebrew](http://brew.sh/) using the following command: 47 | ```bash 48 | $ brew update 49 | $ brew install carthage 50 | ``` 51 | To integrate `SSCustomPullToRefresh` into your Xcode project using Carthage, add the following line to your `Cartfile`: 52 | 53 | ```ogdl 54 | github "mobile-simformsolutions/SSCustomPullToRefresh" 55 | ``` 56 | Run `carthage` to build and drag the `SSCustomPullToRefresh`(Sources/SSCustomPullToRefresh) into your Xcode project. 57 | 58 | # How It Works 59 | - You can use it for any component having a base class as ScrollView like TableView or CollectionView. 60 | 61 | #### 1. Spinner Animation 62 | - SpinnerAnimationView takes image and backgroundColor as an input parameter. You can provide it as per your choice. 63 | 64 | spinnerAnnimation = SpinnerAnimationView(image: UIImage(named: "spinner"), backgroundColor: .purple) 65 | spinnerAnnimation.delegate = self 66 | spinnerAnnimation.parentView = self.tableView 67 | spinnerAnnimation.setupRefreshControl() 68 | 69 | #### 2. Wave Animation 70 | - SineWaveAnimationView takes Color as an input parameter. 71 | 72 | sineAnnimation = SineWaveAnimationView(color: .purple) 73 | sineAnnimation.delegate = self 74 | sineAnnimation.parentView = self.tableView 75 | sineAnnimation.setupRefreshControl() 76 | 77 | - Along with this, you can also provide two different colors and a waveHeight value. You can give a waveHeight value between 5.0 to 50.0. 78 | 79 | sineAnnimation = SineWaveAnimationView(frontColor: .orange, backColor: .purple, waveHeight: 10.0) 80 | 81 | #### 3. Pulse Animation 82 | - PulseAnimationView takes Color as an input parameter. You can provide center circle color, pulse color and background color of your refresh view. 83 | 84 | pulseAnnimation = PulseAnimationView(circleColor: .purple, pulseColor: .purple, 85 | pulseViewBackgroundColor: .brown) 86 | pulseAnnimation.delegate = self 87 | pulseAnnimation.parentView = self.tableView 88 | pulseAnnimation.setupRefreshControl() 89 | 90 | #### Delegate 91 | - The `RefreshDelegate` methods can be used to notify start and end refresh. 92 | 93 | extension ViewController: RefreshDelegate { 94 | func startRefresh() { } 95 | func endRefresh() { } 96 | } 97 | 98 | # Android Library: 99 | * Check our android Library also - [SSPullToRefresh][SSPullToRefresh] 100 | 101 | # License 102 | - SSCustomPullToRefresh is available under the MIT license. See the LICENSE file for more info. 103 | 104 | # Inspired 105 | - SSCustomPullToRefresh(SineWaveAnimationView) inspired from [WaveAnimationView](https://github.com/noa4021J/WaveAnimationView) 106 | 107 | 108 | 109 | [swift-image]:https://img.shields.io/badge/swift-5.0-orange.svg 110 | [swift-url]: https://swift.org/ 111 | [carthage-image]:https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat 112 | [carthage-url]: https://github.com/Carthage/Carthage 113 | [spm-image]:https://img.shields.io/badge/SwiftPM-compatible-brightgreen.svg 114 | [spm-url]: https://swift.org/package-manager 115 | [license-image]: https://img.shields.io/badge/License-MIT-blue.svg 116 | [license-url]: LICENSE 117 | [travis-image]: https://img.shields.io/travis/dbader/node-datadog-metrics/master.svg?style=flat-square 118 | [travis-url]: https://travis-ci.org/dbader/node-datadog-metrics 119 | [codebeat-image]: https://codebeat.co/assets/svg/badges/C-ffb83f-7198e9a1b7ad7f73977b0c9a5c7c3fffbfa25f262510e5681fd8f5a3188216b0.svg 120 | [codebeat-url]: https://codebeat.co/projects/github-com-vsouza-awesomeios-com 121 | [platform-image]:https://img.shields.io/cocoapods/p/LFAlertController.svg?style=flat 122 | [platform-url]:http://cocoapods.org/pods/LFAlertController 123 | [cocoa-image]:https://img.shields.io/cocoapods/v/EZSwiftExtensions.svg 124 | [cocoa-url]:https://img.shields.io/cocoapods/v/LFAlertController.svg 125 | [PR-image]:https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square 126 | [PR-url]:http://makeapullrequest.com 127 | [SSPullToRefresh]: 128 | -------------------------------------------------------------------------------- /SSCustomPullToRefresh.podspec: -------------------------------------------------------------------------------- 1 | # 2 | # Be sure to run `pod spec lint SSCustomPullToRefresh.podspec' to ensure this is a 3 | # valid spec and to remove all comments including this before submitting the spec. 4 | # 5 | # To learn more about Podspec attributes see https://guides.cocoapods.org/syntax/podspec.html 6 | # To see working Podspecs in the CocoaPods repo see https://github.com/CocoaPods/Specs/ 7 | # 8 | 9 | Pod::Spec.new do |s| 10 | s.name = "SSCustomPullToRefresh" 11 | s.version = "1.0.1" 12 | s.summary = "SSCustomPullToRefresh is an open-source library that uses UIKit to add an animation to the pull to refresh view in a UITableView and UICollectionView." 13 | 14 | 15 | s.homepage = 'https://github.com/mobile-simformsolutions/SSCustomPullToRefresh.git' 16 | 17 | #s.license = "MIT" 18 | s.license = { :type => 'MIT', :file => 'LICENSE' } 19 | 20 | s.author = { "Simform Solutions" => "developer@simform.com" } 21 | s.platform = :ios 22 | 23 | s.ios.deployment_target = "10.0" 24 | s.swift_version = '5.0' 25 | 26 | s.source = { :git => "https://github.com/mobile-simformsolutions/SSCustomPullToRefresh.git", :tag => "#{s.version}" } 27 | #s.source = { :path => ".", :tag => "#{s.version}" } 28 | 29 | s.source_files = 'Sources/SSCustomPullToRefresh/**/*.swift' 30 | #s.pod_target_xcconfig = { 'SWIFT_VERSION' => '5.0' } 31 | s.documentation_url = 'docs/index.html' 32 | 33 | end 34 | -------------------------------------------------------------------------------- /Sources/SSCustomPullToRefresh/Extension/UIImage+Extension.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIImage+Extension.swift 3 | // PullToRefreshDemo 4 | // 5 | // Created by Mansi Vadodariya on 09/04/21. 6 | // 7 | 8 | import Foundation 9 | import UIKit 10 | 11 | extension UIImage { 12 | 13 | func resizeImage(targetSize: CGSize) -> UIImage { 14 | let size = self.size 15 | 16 | let widthRatio = targetSize.width / size.width 17 | let heightRatio = targetSize.height / size.height 18 | 19 | // Figure out what our orientation is, and use that to form the rectangle 20 | var newSize: CGSize 21 | if(widthRatio > heightRatio) { 22 | newSize = CGSize(width: size.width * heightRatio, height: size.height * heightRatio) 23 | } else { 24 | newSize = CGSize(width: size.width * widthRatio, height: size.height * widthRatio) 25 | } 26 | 27 | // This is the rect that we've calculated out and this is what is actually used below 28 | let rect = CGRect(x: 0, y: 0, width: newSize.width, height: newSize.height) 29 | 30 | // Actually do the resizing to the rect using the ImageContext stuff 31 | UIGraphicsBeginImageContextWithOptions(newSize, false, 1.0) 32 | self.draw(in: rect) 33 | let newImage = UIGraphicsGetImageFromCurrentImageContext() 34 | UIGraphicsEndImageContext() 35 | return newImage! 36 | } 37 | 38 | } 39 | 40 | extension UIImageView { 41 | 42 | func setImageColor(color: UIColor) { 43 | let templateImage = self.image?.withRenderingMode(.alwaysTemplate) 44 | self.image = templateImage 45 | self.tintColor = color 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /Sources/SSCustomPullToRefresh/Views/PulseAnimationView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // PulseAnimationView.swift 3 | // PullToRefreshDemo 4 | // 5 | // Created by Mansi Vadodariya on 08/04/21. 6 | // 7 | 8 | import UIKit 9 | 10 | public class PulseAnimationView: UIView, UIScrollViewDelegate { 11 | 12 | // MARK: - Variables 13 | var refreshControl: UIRefreshControl! 14 | private var refreshBaseView : UIView! 15 | private var pulseLoadingView : UIView! 16 | private var imgBg : UIImageView! 17 | private var isRefreshAnimating = false 18 | public var parentView: UIScrollView! 19 | var pulseLayers = [CAShapeLayer]() 20 | public var pulseViewBackgroundColor: UIColor = .clear 21 | public var circleColor: UIColor = .clear 22 | public var pulseColor: UIColor = .clear 23 | private var pullDistance: CGFloat = 0.0 24 | 25 | weak public var delegate: RefreshDelegate? 26 | 27 | public var isRefreshing: Bool { 28 | return self.refreshControl.isRefreshing 29 | } 30 | 31 | // MARK: - Init 32 | public convenience init(circleColor: UIColor, pulseColor: UIColor, pulseViewBackgroundColor: UIColor) { 33 | self.init() 34 | self.circleColor = circleColor 35 | self.pulseColor = pulseColor 36 | self.pulseViewBackgroundColor = pulseViewBackgroundColor 37 | } 38 | 39 | // MARK: - SetUp 40 | public func setupRefreshControl() { 41 | 42 | // UIRefreshControl 43 | self.refreshControl = UIRefreshControl(frame: CGRect(x: 0, y: 0, width: parentView.frame.size.width, height: 60)) 44 | 45 | // Setup the base view, which will hold the moving graphics 46 | self.refreshBaseView = UIView(frame: self.refreshControl.bounds) 47 | self.refreshBaseView.backgroundColor = .clear 48 | 49 | // Setup the color view, which will display the background color 50 | self.pulseLoadingView = UIView(frame: self.refreshControl.bounds) 51 | self.pulseLoadingView.backgroundColor = pulseViewBackgroundColor 52 | self.pulseLoadingView.alpha = 0.30 53 | 54 | // Create the graphic image views 55 | imgBg = UIImageView(image: UIImage(named: "fullCircle")) 56 | imgBg.setImageColor(color: circleColor) 57 | imgBg.layer.cornerRadius = imgBg.frame.size.width / 2.0 58 | createPulse() 59 | 60 | // Add the graphics to the loading view 61 | self.refreshBaseView.addSubview(self.imgBg) 62 | 63 | // Clip so the graphics don't stick out 64 | self.refreshBaseView.clipsToBounds = true 65 | 66 | // Hide the original spinner icon 67 | self.refreshControl.tintColor = UIColor.clear 68 | 69 | // Add the base and colors views to our refresh control 70 | self.refreshControl.addSubview(self.refreshBaseView) 71 | self.refreshControl.addSubview(self.pulseLoadingView) 72 | 73 | // Initalize flags 74 | self.isRefreshAnimating = false; 75 | 76 | // When activated, invoke our refresh function 77 | self.refreshControl.addTarget(self, action: #selector(refresh), for: UIControl.Event.valueChanged) 78 | 79 | self.parentView.delegate = self 80 | 81 | self.parentView.refreshControl = refreshControl 82 | 83 | } 84 | 85 | @objc private func refresh() { 86 | // This is where you'll make requests to an API, reload data, or process information 87 | self.delegate?.startRefresh() 88 | } 89 | 90 | // MARK: - Animation 91 | func createPulse() { 92 | for _ in 0...2 { 93 | let circularPath = UIBezierPath(arcCenter: .zero, radius: self.pulseLoadingView.frame.width / 2.0 , startAngle: 0, endAngle: 2 * .pi, clockwise: true) 94 | let pulseLayer = CAShapeLayer() 95 | pulseLayer.path = circularPath.cgPath 96 | pulseLayer.lineWidth = 2.0 97 | pulseLayer.fillColor = UIColor.clear.cgColor 98 | pulseLayer.strokeColor = pulseColor.cgColor 99 | pulseLayer.lineCap = CAShapeLayerLineCap.round 100 | pulseLayer.position = CGPoint(x: imgBg.frame.size.width / 2, y: imgBg.frame.size.width / 2) 101 | imgBg.layer.addSublayer(pulseLayer) 102 | pulseLayers.append(pulseLayer) 103 | } 104 | 105 | DispatchQueue.main.asyncAfter(deadline: .now() + 0.2) { 106 | self.animatePulse(index: 0) 107 | DispatchQueue.main.asyncAfter(deadline: .now() + 0.4) { 108 | self.animatePulse(index: 1) 109 | DispatchQueue.main.asyncAfter(deadline: .now() + 0.6) { 110 | self.animatePulse(index: 2) 111 | } 112 | } 113 | } 114 | } 115 | 116 | func animatePulse(index: Int) { 117 | let scaleAniomation = CABasicAnimation(keyPath: "transform.scale") 118 | scaleAniomation.duration = 2.0 119 | scaleAniomation.fromValue = 0.0 120 | scaleAniomation.toValue = 0.9 121 | scaleAniomation.timingFunction = CAMediaTimingFunction(name: CAMediaTimingFunctionName.easeOut) 122 | scaleAniomation.repeatCount = .greatestFiniteMagnitude 123 | pulseLayers[index].add(scaleAniomation, forKey: "scale") 124 | 125 | let opacityAnimation = CABasicAnimation(keyPath: #keyPath(CALayer.opacity)) 126 | opacityAnimation.duration = 2.0 127 | opacityAnimation.fromValue = 0.9 128 | opacityAnimation.toValue = 0.0 129 | opacityAnimation.timingFunction = CAMediaTimingFunction(name: CAMediaTimingFunctionName.easeOut) 130 | opacityAnimation.repeatCount = .greatestFiniteMagnitude 131 | pulseLayers[index].add(opacityAnimation, forKey: "opacity") 132 | } 133 | 134 | // MARK: - UIScrollViewDelegate 135 | public func scrollDidAnimation() { 136 | // Get the current size of the refresh controller 137 | var refreshBounds = self.refreshControl.bounds 138 | // Half the width of the table 139 | let midX = parentView.frame.size.width / 2.0 140 | 141 | // Calculate the width and height of our graphics 142 | let imageHeight = self.imgBg.bounds.size.height 143 | let imageHeightHalf = imageHeight / 2.0 144 | let imageWidth = self.imgBg.bounds.size.width 145 | let imageWidthHalf = imageWidth / 2.0 146 | 147 | // Set the Y coord of the graphics, based on pull distance 148 | let imageY = pullDistance / 2.0 - imageHeightHalf 149 | 150 | // Set the graphic's frames 151 | var imageFrame = self.imgBg.frame 152 | imageFrame.origin.x = midX - imageWidthHalf 153 | imageFrame.origin.y = imageY 154 | 155 | self.imgBg.frame = imageFrame 156 | 157 | // Set the refreshBounds view's frames 158 | refreshBounds.size.height = pullDistance 159 | 160 | self.pulseLoadingView.frame = refreshBounds 161 | self.refreshBaseView.frame = refreshBounds 162 | 163 | } 164 | 165 | public func scrollViewDidScroll(_ scrollView: UIScrollView) { 166 | // Distance the table has been pulled >= 0 167 | pullDistance = max(0.0, -self.refreshControl.frame.origin.y) 168 | if pullDistance == 0.0 { 169 | return 170 | } 171 | scrollDidAnimation() 172 | } 173 | 174 | public func endRefreshing() { 175 | self.refreshControl.endRefreshing() 176 | self.delegate?.endRefresh() 177 | } 178 | 179 | } 180 | -------------------------------------------------------------------------------- /Sources/SSCustomPullToRefresh/Views/RefreshDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // refreshDelegate.swift 3 | // PullToRefreshDemo 4 | // 5 | // Created by Mansi Vadodariya on 13/04/21. 6 | // 7 | 8 | import Foundation 9 | 10 | public protocol RefreshDelegate: NSObject { 11 | func startRefresh() 12 | func endRefresh() 13 | } 14 | -------------------------------------------------------------------------------- /Sources/SSCustomPullToRefresh/Views/SineWaveAnimationView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SineWaveAnimationView.swift 3 | // PullToRefreshDemo 4 | // 5 | // Created by Mansi Vadodariya on 07/04/21. 6 | // 7 | 8 | import UIKit 9 | 10 | public class SineWaveAnimationView: UIView { 11 | 12 | // MARK: - Variables 13 | public var refreshControl: UIRefreshControl! 14 | private var refreshBaseView : UIView! 15 | private var backgroundColorView : WavesView! 16 | private var isRefreshAnimating = false 17 | public var parentView: UIScrollView! 18 | public var waveColor: UIColor = .clear 19 | public var frontColor: UIColor = .clear 20 | public var backColor: UIColor = .clear 21 | public var waveHeight: CGFloat = 10.0 22 | 23 | weak public var delegate: RefreshDelegate? 24 | 25 | public var isRefreshing: Bool { 26 | return self.refreshControl.isRefreshing 27 | } 28 | 29 | // MARK: - Init 30 | public convenience init(color: UIColor) { 31 | self.init() 32 | frontColor = color 33 | backColor = color 34 | waveHeight = 10.0 35 | } 36 | 37 | public convenience init(frontColor: UIColor, backColor: UIColor, waveHeight: CGFloat) { 38 | self.init() 39 | self.frontColor = frontColor 40 | self.backColor = backColor 41 | if waveHeight < 5.0 { 42 | self.waveHeight = 5.0 43 | } 44 | self.waveHeight = waveHeight 45 | } 46 | 47 | // MARK: - SetUp 48 | public func setupRefreshControl() { 49 | // UIRefreshControl 50 | self.refreshControl = UIRefreshControl(frame: CGRect(x: 0, y: 0, width: parentView.frame.size.width, height: 60)) 51 | 52 | // Setup the base view, which will hold the moving graphics 53 | self.refreshBaseView = UIView(frame: self.refreshControl.bounds) 54 | self.refreshBaseView.backgroundColor = .clear 55 | 56 | // Setup the wave view 57 | let frame = CGRect(x: 0, y: 0, width: UIScreen.main.bounds.size.width, height: self.refreshControl.bounds.size.height) 58 | self.backgroundColorView = WavesView(frame: frame, frontColor: frontColor.withAlphaComponent(0.5), backColor: backColor.withAlphaComponent(0.5), waveHeight: waveHeight) 59 | self.backgroundColorView.startAnimation() 60 | 61 | // Clip so the graphics don't stick out 62 | self.refreshBaseView.clipsToBounds = true 63 | 64 | // Hide the original spinner icon 65 | self.refreshControl.tintColor = UIColor.clear 66 | 67 | // Add the base and colors views to our refresh control 68 | self.refreshControl.addSubview(self.refreshBaseView) 69 | self.refreshControl.addSubview(self.backgroundColorView) 70 | 71 | // Initalize flags 72 | self.isRefreshAnimating = false; 73 | 74 | // When activated, invoke our refresh function 75 | self.refreshControl.addTarget(self, action: #selector(refresh), for: UIControl.Event.valueChanged) 76 | 77 | self.parentView.refreshControl = refreshControl 78 | } 79 | 80 | @objc private func refresh() { 81 | // This is where you'll make requests to an API, reload data, or process information 82 | self.delegate?.startRefresh() 83 | let delayInSeconds = 3.0; 84 | DispatchQueue.main.asyncAfter(deadline: .now() + delayInSeconds) { 85 | self.refreshControl.endRefreshing() 86 | self.delegate?.endRefresh() 87 | } 88 | } 89 | 90 | public func endRefreshing() { 91 | self.refreshControl.endRefreshing() 92 | self.delegate?.endRefresh() 93 | } 94 | 95 | } 96 | -------------------------------------------------------------------------------- /Sources/SSCustomPullToRefresh/Views/SpinnerAnimationView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SpinnerAnimationView.swift 3 | // PullToRefreshDemo 4 | // 5 | // Created by Mansi Vadodariya on 06/04/21. 6 | // 7 | 8 | import UIKit 9 | 10 | public class SpinnerAnimationView: UIView , UIScrollViewDelegate { 11 | 12 | // MARK: - Variables 13 | var refreshControl: UIRefreshControl! 14 | private var refreshBaseView : UIView! 15 | private var backgroundColorView : UIView! 16 | private var imgSpinnerView : UIImageView! 17 | private var isRefreshAnimating = false 18 | public var parentView: UIScrollView! 19 | public var spinnerBackgroundColor: UIColor = .clear 20 | public var spinnerImage: UIImage = UIImage() 21 | private var spinnerImageResize: UIImage = UIImage() 22 | private var pullDistance: CGFloat = 0.0 23 | 24 | weak public var delegate: RefreshDelegate? 25 | 26 | public var isRefreshing: Bool { 27 | return self.refreshControl.isRefreshing 28 | } 29 | 30 | // MARK: - Init 31 | public convenience init(image: UIImage, backgroundColor: UIColor) { 32 | self.init() 33 | spinnerImage = image 34 | spinnerBackgroundColor = backgroundColor 35 | } 36 | 37 | // MARK: - SetUp 38 | public func setupRefreshControl() { 39 | 40 | // UIRefreshControl 41 | self.refreshControl = UIRefreshControl(frame: CGRect(x: 0, y: 0, width: parentView.frame.size.width, height: 60)) 42 | 43 | // Setup the base view, which will hold the moving graphics 44 | self.refreshBaseView = UIView(frame: self.refreshControl.bounds) 45 | self.refreshBaseView.backgroundColor = spinnerBackgroundColor 46 | 47 | // Setup the color view, which will display the background color 48 | self.backgroundColorView = UIView(frame: self.refreshControl.bounds) 49 | self.backgroundColorView.backgroundColor = spinnerBackgroundColor 50 | self.backgroundColorView.alpha = 0.70 51 | 52 | // Create the graphic image views 53 | spinnerImageResize = spinnerImage.resizeImage(targetSize: CGSize(width: 60.0, height: 60.0)) 54 | imgSpinnerView = UIImageView(image: spinnerImageResize) 55 | 56 | // Add the graphics to the base view 57 | self.refreshBaseView.addSubview(self.imgSpinnerView) 58 | 59 | // Clip so the graphics don't stick out 60 | self.refreshBaseView.clipsToBounds = true; 61 | 62 | // Hide the original spinner icon 63 | self.refreshControl.tintColor = UIColor.clear 64 | 65 | // Add the base and colors views to our refresh control 66 | self.refreshControl.addSubview(self.backgroundColorView) 67 | self.refreshControl.addSubview(self.refreshBaseView) 68 | 69 | // Initalize flags 70 | self.isRefreshAnimating = false; 71 | 72 | // When activated, invoke our refresh function 73 | self.refreshControl.addTarget(self, action: #selector(refresh), for: UIControl.Event.valueChanged) 74 | 75 | self.parentView.delegate = self 76 | 77 | self.parentView.refreshControl = refreshControl 78 | 79 | } 80 | 81 | @objc private func refresh(){ 82 | // This is where you'll make requests to an API, reload data, or process information 83 | self.delegate?.startRefresh() 84 | } 85 | 86 | // MARK: - Animation 87 | private func animateRefreshView() { 88 | // Flag that we are animating 89 | self.isRefreshAnimating = true; 90 | 91 | UIView.animate( 92 | withDuration: Double(0.3), 93 | delay: Double(0.0), 94 | options: UIView.AnimationOptions.curveEaseInOut, 95 | animations: { 96 | // Rotate the spinner image by M_PI_2 = PI/2 = 90 degrees 97 | self.imgSpinnerView.transform = self.imgSpinnerView.transform.rotated(by: .pi/2) 98 | self.backgroundColorView.backgroundColor = self.spinnerBackgroundColor 99 | }, 100 | completion: { finished in 101 | // If still refreshing, keep spinning, else reset 102 | if (self.refreshControl.isRefreshing) { 103 | self.animateRefreshView() 104 | }else { 105 | self.resetAnimation() 106 | } 107 | } 108 | ) 109 | } 110 | 111 | private func resetAnimation() { 112 | // Reset our flags and }background color 113 | self.isRefreshAnimating = false; 114 | self.backgroundColorView.backgroundColor = UIColor.clear 115 | } 116 | 117 | // MARK: - UIScrollViewDelegate 118 | public func scrollDidImageAnimation() { 119 | // Get the current size of the refresh controller 120 | var refreshBounds = self.refreshControl.bounds 121 | 122 | // Half the width of the table 123 | let midX = parentView.frame.size.width / 2.0 124 | 125 | let spinnerHeight = self.imgSpinnerView.bounds.size.height 126 | let spinnerHeightHalf = spinnerHeight / 2.0 127 | 128 | let spinnerWidth = self.imgSpinnerView.bounds.size.width 129 | let spinnerWidthHalf = spinnerWidth / 2.0 130 | 131 | // Set the Y coord of the graphics, based on pull distance 132 | let spinnerY = pullDistance / 2.0 - spinnerHeightHalf 133 | 134 | var spinnerFrame = self.imgSpinnerView.frame 135 | spinnerFrame.origin.x = midX - spinnerWidthHalf 136 | spinnerFrame.origin.y = spinnerY 137 | 138 | self.imgSpinnerView.frame = spinnerFrame 139 | 140 | // Set the refreshBounds view's frames 141 | refreshBounds.size.height = pullDistance 142 | 143 | self.backgroundColorView.frame = refreshBounds 144 | self.refreshBaseView.frame = refreshBounds 145 | 146 | // If we're refreshing and the animation is not playing, then play the animation 147 | if (self.refreshControl.isRefreshing && !self.isRefreshAnimating) { 148 | self.animateRefreshView() 149 | } 150 | 151 | } 152 | 153 | public func scrollViewDidScroll(_ scrollView: UIScrollView) { 154 | // Distance the table has been pulled >= 0 155 | pullDistance = max(0.0, -self.refreshControl.frame.origin.y) 156 | if pullDistance == 0.0 { 157 | return 158 | } 159 | scrollDidImageAnimation() 160 | } 161 | 162 | public func endRefreshing() { 163 | self.refreshControl.endRefreshing() 164 | self.delegate?.endRefresh() 165 | } 166 | 167 | } 168 | 169 | -------------------------------------------------------------------------------- /Sources/SSCustomPullToRefresh/Views/WavesView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // WavesView.swift 3 | // PullToRefreshDemo 4 | // 5 | // Created by Mansi Vadodariya on 23/03/21. 6 | // 7 | 8 | import UIKit 9 | 10 | class WavesView: UIView { 11 | 12 | private let frontWaveLine: UIBezierPath = UIBezierPath() 13 | private let backWaveLine: UIBezierPath = UIBezierPath() 14 | 15 | private let frontWaveLayer: CAShapeLayer = CAShapeLayer() 16 | private let backWaveSubLayer: CAShapeLayer = CAShapeLayer() 17 | 18 | private var timer = Timer() 19 | 20 | private var drawSeconds: CGFloat = 0.0 21 | private var drawElapsedTime: CGFloat = 0.0 22 | 23 | private var width: CGFloat 24 | private var height: CGFloat 25 | private var xAxis: CGFloat 26 | private var yAxis: CGFloat 27 | 28 | open var waveHeight: CGFloat = 10.0 //3.0 .. about 50.0 are standard. 29 | open var waveDelay: CGFloat = 300.0 //0.0 .. about 500.0 are standard. 30 | 31 | open var frontColor: UIColor! 32 | open var backColor: UIColor! 33 | 34 | private override init(frame: CGRect) { 35 | self.width = frame.width 36 | self.height = frame.height 37 | self.xAxis = floor(height/2) 38 | self.yAxis = 0.0 39 | super.init(frame: frame) 40 | } 41 | 42 | public convenience init(frame: CGRect, color: UIColor) { 43 | self.init(frame: frame) 44 | self.frontColor = color 45 | self.backColor = color 46 | } 47 | 48 | //Possible to set fillColors separately. 49 | public convenience init(frame: CGRect, frontColor: UIColor, backColor: UIColor, waveHeight: CGFloat) { 50 | self.init(frame: frame) 51 | self.frontColor = frontColor 52 | self.backColor = backColor 53 | self.waveHeight = waveHeight 54 | } 55 | 56 | required init?(coder aDecoder: NSCoder) { 57 | fatalError("init(coder:) has not been implemented") 58 | } 59 | 60 | public override func draw(_ rect: CGRect) { 61 | wave(layer: backWaveSubLayer, path: backWaveLine, color: backColor, delay: waveDelay) 62 | wave(layer: frontWaveLayer, path: frontWaveLine, color: frontColor, delay: 0) 63 | } 64 | 65 | //Start wave Animation 66 | open func startAnimation() { 67 | timer = Timer.scheduledTimer(timeInterval: 0.035, target: self, selector: #selector(waveAnimation), userInfo: nil, repeats: true) 68 | } 69 | 70 | //MARK: Please be sure to call this method at ViewDidDisAppear or deinit in ViewController. 71 | //If it isn't called, Memory Leaks occurs by Timer 72 | open func stopAnimation() { 73 | timer.invalidate() 74 | } 75 | 76 | @objc private func waveAnimation() { 77 | self.setNeedsDisplay() 78 | } 79 | 80 | @objc private func wave(layer: CAShapeLayer, path: UIBezierPath, color: UIColor, delay:CGFloat) { 81 | path.removeAllPoints() 82 | drawWave(layer: layer, path: path, color: color, delay: delay) 83 | drawSeconds += 0.009 84 | drawElapsedTime = drawSeconds*CGFloat(Double.pi) 85 | if drawElapsedTime >= CGFloat(Double.pi) { 86 | drawSeconds = 0.0 87 | drawElapsedTime = 0.0 88 | } 89 | } 90 | 91 | private func drawWave(layer: CAShapeLayer,path: UIBezierPath,color: UIColor,delay:CGFloat) { 92 | drawSin(path: path,time: drawElapsedTime/0.5, delay: delay) 93 | path.addLine(to: CGPoint(x: width+10, y: height)) 94 | path.addLine(to: CGPoint(x: 0, y: height)) 95 | path.close() 96 | 97 | layer.fillColor = color.cgColor 98 | layer.path = path.cgPath 99 | self.layer.insertSublayer(layer, at: 0) 100 | } 101 | 102 | private func drawSin(path: UIBezierPath, time: CGFloat, delay: CGFloat) { 103 | 104 | let unit:CGFloat = 100.0 105 | let zoom:CGFloat = 1.0 106 | var x = time 107 | var y = sin(x)/zoom 108 | let start = CGPoint(x: yAxis, y: unit*y+xAxis) 109 | path.move(to: start) 110 | 111 | var i = yAxis 112 | while i <= width+10 { 113 | x = time+(-yAxis+i)/unit/zoom 114 | y = sin(x - delay)/self.waveHeight 115 | path.addLine(to: CGPoint(x: i, y: unit*y+xAxis)) 116 | 117 | i += 10 118 | } 119 | 120 | } 121 | 122 | } 123 | -------------------------------------------------------------------------------- /Tests/LinuxMain.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | 3 | import SSPullToRefreshTests 4 | 5 | var tests = [XCTestCaseEntry]() 6 | tests += SSPullToRefreshTests.allTests() 7 | XCTMain(tests) 8 | -------------------------------------------------------------------------------- /Tests/SSPullToRefreshTests/SSPullToRefreshTests.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | @testable import SSPullToRefresh 3 | 4 | final class SSPullToRefreshTests: XCTestCase { 5 | func testExample() { 6 | // This is an example of a functional test case. 7 | // Use XCTAssert and related functions to verify your tests produce the correct 8 | // results. 9 | XCTAssertEqual(SSPullToRefresh().text, "Hello, World!") 10 | } 11 | 12 | static var allTests = [ 13 | ("testExample", testExample), 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /Tests/SSPullToRefreshTests/XCTestManifests.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | 3 | #if !canImport(ObjectiveC) 4 | public func allTests() -> [XCTestCaseEntry] { 5 | return [ 6 | testCase(SSPullToRefreshTests.allTests), 7 | ] 8 | } 9 | #endif 10 | -------------------------------------------------------------------------------- /pulseAnimation.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimformSolutionsPvtLtd/SSCustomPullToRefresh/eb4d9b2160d05bfcb6c3be66b0aecc37b3b8a9d9/pulseAnimation.gif -------------------------------------------------------------------------------- /spinnerAnimation.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimformSolutionsPvtLtd/SSCustomPullToRefresh/eb4d9b2160d05bfcb6c3be66b0aecc37b3b8a9d9/spinnerAnimation.gif -------------------------------------------------------------------------------- /waveAnimation.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimformSolutionsPvtLtd/SSCustomPullToRefresh/eb4d9b2160d05bfcb6c3be66b0aecc37b3b8a9d9/waveAnimation.gif -------------------------------------------------------------------------------- /waveSingleColor.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimformSolutionsPvtLtd/SSCustomPullToRefresh/eb4d9b2160d05bfcb6c3be66b0aecc37b3b8a9d9/waveSingleColor.gif --------------------------------------------------------------------------------