diff --git a/.assets/demo.gif b/.assets/demo.gif new file mode 100644 index 0000000..fa4bb3b Binary files /dev/null and b/.assets/demo.gif differ diff --git a/.swift-version b/.swift-version new file mode 100644 index 0000000..5186d07 --- /dev/null +++ b/.swift-version @@ -0,0 +1 @@ +4.0 diff --git a/ActivityRings.podspec b/ActivityRings.podspec new file mode 100644 index 0000000..32a6841 --- /dev/null +++ b/ActivityRings.podspec @@ -0,0 +1,17 @@ +Pod::Spec.new do |spec| + spec.name = 'ActivityRings' + spec.version = '1.0.0' + spec.summary = 'An attempt to recreate the ring controls in Apple’s Activity app' + spec.description = <<-DESC + ActivityRings is an attempt to recreate the ring controls used in Apple’s iOS and watchOS Activity app + DESC + spec.homepage = 'https://github.com/HarshilShah/ActivityRings' + spec.license = { type: 'MIT', file: 'LICENSE.md' } + spec.author = { 'Harshil Shah' => 'harshilshah1910@me.com' } + spec.social_media_url = 'https://twitter.com/HarshilShah1910' + + spec.source = { git: 'https://github.com/HarshilShah/ActivityRings.git', tag: spec.version.to_s } + spec.ios.deployment_target = '8.0' + spec.ios.source_files = 'Sources/**/*.{h,swift}' + spec.ios.frameworks = 'SpriteKit' +end diff --git a/ActivityRings.xcodeproj/project.pbxproj b/ActivityRings.xcodeproj/project.pbxproj index d2d55e5..7ad2997 100644 --- a/ActivityRings.xcodeproj/project.pbxproj +++ b/ActivityRings.xcodeproj/project.pbxproj @@ -15,6 +15,13 @@ E839A1A11F926D8100534B37 /* Double+Animatable.swift in Sources */ = {isa = PBXBuildFile; fileRef = E839A1A01F926D8100534B37 /* Double+Animatable.swift */; }; E839A1A51F926DD400534B37 /* ActivityRingScene.swift in Sources */ = {isa = PBXBuildFile; fileRef = E839A1A41F926DD400534B37 /* ActivityRingScene.swift */; }; E839A1A71F926E1900534B37 /* ActivityRingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E839A1A61F926E1900534B37 /* ActivityRingView.swift */; }; + E88339271F967D150043C96C /* CHANGELOG.md in Resources */ = {isa = PBXBuildFile; fileRef = E88339261F967D150043C96C /* CHANGELOG.md */; }; + E8DAD1111F9689750013F0F2 /* demo.gif in Resources */ = {isa = PBXBuildFile; fileRef = E8DAD1101F9689740013F0F2 /* demo.gif */; }; + E8EC84C91F967B13002057A9 /* LICENSE.md in Resources */ = {isa = PBXBuildFile; fileRef = E8EC84C41F967B12002057A9 /* LICENSE.md */; }; + E8EC84CA1F967B13002057A9 /* ActivityRings.podspec in Resources */ = {isa = PBXBuildFile; fileRef = E8EC84C51F967B12002057A9 /* ActivityRings.podspec */; }; + E8EC84CB1F967B13002057A9 /* README.md in Resources */ = {isa = PBXBuildFile; fileRef = E8EC84C61F967B12002057A9 /* README.md */; }; + E8EC84CC1F967B13002057A9 /* .gitignore in Resources */ = {isa = PBXBuildFile; fileRef = E8EC84C71F967B12002057A9 /* .gitignore */; }; + E8EC84CD1F967B13002057A9 /* .swift-version in Resources */ = {isa = PBXBuildFile; fileRef = E8EC84C81F967B13002057A9 /* .swift-version */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -39,6 +46,13 @@ E839A1A01F926D8100534B37 /* Double+Animatable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Double+Animatable.swift"; sourceTree = ""; }; E839A1A41F926DD400534B37 /* ActivityRingScene.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActivityRingScene.swift; sourceTree = ""; }; E839A1A61F926E1900534B37 /* ActivityRingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActivityRingView.swift; sourceTree = ""; }; + E88339261F967D150043C96C /* CHANGELOG.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = CHANGELOG.md; sourceTree = ""; }; + E8DAD1101F9689740013F0F2 /* demo.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; name = demo.gif; path = .assets/demo.gif; sourceTree = ""; }; + E8EC84C41F967B12002057A9 /* LICENSE.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = LICENSE.md; sourceTree = SOURCE_ROOT; }; + E8EC84C51F967B12002057A9 /* ActivityRings.podspec */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ActivityRings.podspec; sourceTree = SOURCE_ROOT; }; + E8EC84C61F967B12002057A9 /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = SOURCE_ROOT; }; + E8EC84C71F967B12002057A9 /* .gitignore */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = .gitignore; sourceTree = SOURCE_ROOT; }; + E8EC84C81F967B13002057A9 /* .swift-version */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ".swift-version"; sourceTree = SOURCE_ROOT; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -63,6 +77,7 @@ 28F828731C494B2C00330CF4 = { isa = PBXGroup; children = ( + E8EC84CF1F967B24002057A9 /* Supporting Files */, 28F828971C494B4200330CF4 /* Sources */, 28F8288B1C494B2C00330CF4 /* Tests */, 28F8287E1C494B2C00330CF4 /* Products */, @@ -125,6 +140,28 @@ path = Animator; sourceTree = ""; }; + E8658ACF1F9747C60052FB63 /* Assets */ = { + isa = PBXGroup; + children = ( + E8DAD1101F9689740013F0F2 /* demo.gif */, + ); + name = Assets; + sourceTree = ""; + }; + E8EC84CF1F967B24002057A9 /* Supporting Files */ = { + isa = PBXGroup; + children = ( + E8658ACF1F9747C60052FB63 /* Assets */, + E8EC84C71F967B12002057A9 /* .gitignore */, + E8EC84C81F967B13002057A9 /* .swift-version */, + E8EC84C51F967B12002057A9 /* ActivityRings.podspec */, + E8EC84C41F967B12002057A9 /* LICENSE.md */, + E8EC84C61F967B12002057A9 /* README.md */, + E88339261F967D150043C96C /* CHANGELOG.md */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ @@ -218,6 +255,13 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + E8EC84CC1F967B13002057A9 /* .gitignore in Resources */, + E8DAD1111F9689750013F0F2 /* demo.gif in Resources */, + E88339271F967D150043C96C /* CHANGELOG.md in Resources */, + E8EC84CB1F967B13002057A9 /* README.md in Resources */, + E8EC84C91F967B13002057A9 /* LICENSE.md in Resources */, + E8EC84CA1F967B13002057A9 /* ActivityRings.podspec in Resources */, + E8EC84CD1F967B13002057A9 /* .swift-version in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..1dfbbcb --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,6 @@ +## Changelog + +## 1.0.0 Release notes (18/10/2017) +---- + +- Initial release diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..e8a2fd6 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2017 Harshil Shah + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..6b09970 --- /dev/null +++ b/README.md @@ -0,0 +1,75 @@ +# ActivityRings + +[![Version](https://img.shields.io/github/release/HarshilShah/ActivityRings.svg)](https://github.com/HarshilShah/ActivityRings/releases/latest) +![Package Managers](https://img.shields.io/badge/supports-CocoaPods%20%7C%20Carthage-green.svg) +[![License](https://img.shields.io/badge/license-MIT-yellow.svg)](https://github.com/HarshilShah/ActivityRings/blob/master/LICENSE) +[![Contact](https://img.shields.io/badge/contact-%40HarshilShah1910-3a8fc1.svg)](https://twitter.com/HarshilShah1910) + +ActivityRings is an attempt to recreate the ring controls in Apple’s Activity app. + +This project is a SpriteKit port of [Max Konovalov](https://github.com/maxkonovalov)’s pure UIKit implementation, [MKRingProgressView](https://github.com/maxkonovalov/MKRingProgressView). + +![Demo](https://raw.githubusercontent.com/HarshilShah/ActivityRings/master/.assets/demo.gif) + +## Requirements + +- Swift 4 +- iOS 8 + +## Installation + +ActivityRings is available via CocoaPods and Carthage. + +### CocoaPods + +To install ActivityRings using [CocoaPods](http://cocoapods.org), add the following line to your Podfile: +``` +pod 'ActivityRings' +``` +### Carthage + +To install ActivityRings using [Carthage](https://github.com/Carthage/Carthage), add the following line to your Cartfile: + +``` +github "HarshilShah/ActivityRings" +``` + +## Usage + +### Basics + +To get started, import `ActivityRings`, and use the `ActivityRingView` class within it to display the control. + +### Customisation + +The `ringWidth`, the `startColor`, the `endColor`, and the `backgroundRingColor` can all be customised. + +### Progress + +The progress of the ring can be set with or without animation. + +To set the progress without animation, simply update the value of the `progress` variable. + +To animate the progress, use the `animateProgress` method, which accepts two arguments: +- The desired final progress value +- The animation duration + +## Notes + +Some notes on performance: +- Since this control was written in SpriteKit, it relies heavily on the GPU, and so will not perform well or accurately in the simulator. +- The initial setup process is somewhat expensive, so animating the progress directly after presenting the view can cause some hiccups. This is being worked on, but in the meantime, delaying the animation by a second or so works around the issue. + +## Apps Using *ActivityRings* + +Feel free to submit a PR if you’re using this library in your apps. + +## Author + +Written by Harshil Shah. You can [find me on Twitter](https://twitter.com/HarshilShah1910). + +The original UIKit implementation was written by [Max Konovalov](https://github.com/maxkonovalov). + +## License + +ActivityRings is available under the MIT license. See the LICENSE.md file for more info.