Compare commits
14 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 478fb36608 | |||
| 29823393ee | |||
| a7aa0c068e | |||
| 238de3030f | |||
| bd17fd8a40 | |||
| ef2d8ad615 | |||
| dc6e27ce25 | |||
| 6e36a72551 | |||
| 1ade7ac71b | |||
| 78eae810db | |||
| 14207d46aa | |||
| 407130c59c | |||
| b24ad5e8f7 | |||
| da84c1c6d4 |
+2
-1
@@ -62,4 +62,5 @@ Carthage/Build
|
||||
fastlane/report.xml
|
||||
fastlane/Preview.html
|
||||
fastlane/screenshots
|
||||
fastlane/test_output
|
||||
fastlane/test_output
|
||||
.DS_Store
|
||||
|
||||
@@ -1,6 +1,22 @@
|
||||
# Change Log
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
## [1.1.0](https://github.com/HamzaGhazouani/HGCircularSlider/releases/tag/1.1.0)
|
||||
|
||||
* Fix Swift 3.1 warnings
|
||||
|
||||
## [1.0.3](https://github.com/HamzaGhazouani/HGCircularSlider/releases/tag/1.0.3)
|
||||
|
||||
* Change midPointValue from private to open
|
||||
* Imporve the documentation
|
||||
|
||||
## [1.0.2](https://github.com/HamzaGhazouani/HGCircularSlider/releases/tag/1.0.2)
|
||||
|
||||
* Update the documentation
|
||||
|
||||
## [1.0.1](https://github.com/HamzaGhazouani/HGCircularSlider/releases/tag/1.0.1)
|
||||
|
||||
* remove warnings
|
||||
|
||||
## [1.0.0](https://github.com/HamzaGhazouani/HGCircularSlider/releases/tag/1.0.0)
|
||||
|
||||
|
||||
@@ -222,7 +222,7 @@
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastSwiftUpdateCheck = 0720;
|
||||
LastUpgradeCheck = 0800;
|
||||
LastUpgradeCheck = 0830;
|
||||
ORGANIZATIONNAME = CocoaPods;
|
||||
TargetAttributes = {
|
||||
607FACCF1AFB9204008FA782 = {
|
||||
@@ -511,6 +511,7 @@
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 04EAC630898381E6412A72E4 /* Pods-HGCircularSlider_Example.debug.xcconfig */;
|
||||
buildSettings = {
|
||||
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
INFOPLIST_FILE = HGCircularSlider/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
@@ -525,6 +526,7 @@
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 9BA305BCC009CE17283FE799 /* Pods-HGCircularSlider_Example.release.xcconfig */;
|
||||
buildSettings = {
|
||||
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
INFOPLIST_FILE = HGCircularSlider/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0800"
|
||||
LastUpgradeVersion = "0830"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
|
||||
@@ -253,7 +253,7 @@
|
||||
<!--Example-->
|
||||
<scene sceneID="stQ-nu-pyE">
|
||||
<objects>
|
||||
<viewController id="Npo-RV-git" sceneMemberID="viewController">
|
||||
<viewController id="Npo-RV-git" customClass="OtherExampleViewController" customModule="HGCircularSlider_Example" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<layoutGuides>
|
||||
<viewControllerLayoutGuide type="top" id="kg8-3T-le0"/>
|
||||
<viewControllerLayoutGuide type="bottom" id="I5G-Jl-WfO"/>
|
||||
@@ -332,6 +332,9 @@
|
||||
</view>
|
||||
<extendedEdge key="edgesForExtendedLayout" top="YES"/>
|
||||
<tabBarItem key="tabBarItem" title="Example" image="second" id="etG-Rt-332"/>
|
||||
<connections>
|
||||
<outlet property="circularSlider" destination="P7G-Iv-4Jm" id="tNc-8z-Gh2"/>
|
||||
</connections>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="11N-ZE-qqz" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import HGCircularSlider
|
||||
|
||||
extension CALayer {
|
||||
|
||||
@@ -21,10 +22,15 @@ extension CALayer {
|
||||
|
||||
class OtherExampleViewController: UIViewController {
|
||||
|
||||
@IBOutlet weak var circularSlider: MidPointCircularSlider!
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
// Do any additional setup after loading the view.
|
||||
circularSlider.minimumValue = 0.0
|
||||
circularSlider.maximumValue = 10.0
|
||||
circularSlider.distance = 1.0
|
||||
circularSlider.midPointValue = 5.0
|
||||
}
|
||||
|
||||
override func didReceiveMemoryWarning() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
PODS:
|
||||
- HGCircularSlider (1.0.1)
|
||||
- HGCircularSlider (1.0.2)
|
||||
|
||||
DEPENDENCIES:
|
||||
- HGCircularSlider (from `../`)
|
||||
@@ -9,7 +9,7 @@ EXTERNAL SOURCES:
|
||||
:path: ../
|
||||
|
||||
SPEC CHECKSUMS:
|
||||
HGCircularSlider: 3fb33a1bacdb459eb490f26a4739ca0057df48c4
|
||||
HGCircularSlider: e7ded3c342cf180d2b751a444aeb603c61b1f3fd
|
||||
|
||||
PODFILE CHECKSUM: 7cb4c64ce59896052589f93ba9b0ea50a207f738
|
||||
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "HGCircularSlider",
|
||||
"version": "1.0.1",
|
||||
"version": "1.0.2",
|
||||
"summary": "Multiple Circular Sliders used to select a value from a continuous range of values.",
|
||||
"description": "Circular Sliders used to select a value from a continuous range of values.\n\nCircularSlider: simple circular slider\nRangeCircularSlider: slider with two points to select a range of values from a continuous range of values\nMidPointCircularSlider: slider with fixed range to select a range of values from a continuois range of values",
|
||||
"homepage": "https://github.com/HamzaGhazouani/HGCircularSlider",
|
||||
@@ -13,7 +13,7 @@
|
||||
},
|
||||
"source": {
|
||||
"git": "https://github.com/HamzaGhazouani/HGCircularSlider.git",
|
||||
"tag": "1.0.1"
|
||||
"tag": "1.0.2"
|
||||
},
|
||||
"social_media_url": "https://twitter.com/GhazouaniHamza",
|
||||
"platforms": {
|
||||
|
||||
Generated
+2
-2
@@ -1,5 +1,5 @@
|
||||
PODS:
|
||||
- HGCircularSlider (1.0.1)
|
||||
- HGCircularSlider (1.0.2)
|
||||
|
||||
DEPENDENCIES:
|
||||
- HGCircularSlider (from `../`)
|
||||
@@ -9,7 +9,7 @@ EXTERNAL SOURCES:
|
||||
:path: ../
|
||||
|
||||
SPEC CHECKSUMS:
|
||||
HGCircularSlider: 3fb33a1bacdb459eb490f26a4739ca0057df48c4
|
||||
HGCircularSlider: e7ded3c342cf180d2b751a444aeb603c61b1f3fd
|
||||
|
||||
PODFILE CHECKSUM: 7cb4c64ce59896052589f93ba9b0ea50a207f738
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0.1</string>
|
||||
<string>1.0.2</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
Pod::Spec.new do |s|
|
||||
s.name = 'HGCircularSlider'
|
||||
s.version = '1.0.1'
|
||||
s.version = '1.1.0'
|
||||
s.summary = 'Multiple Circular Sliders used to select a value from a continuous range of values.'
|
||||
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import UIKit
|
||||
/**
|
||||
* A visual control used to select a single value from a continuous range of values.
|
||||
* Can also be used like a circular progress view
|
||||
* CircularSlider use the target-action mechanism to report changes made during the course of editing:
|
||||
* CircularSlider uses the target-action mechanism to report changes made during the course of editing:
|
||||
* ValueChanged, EditingDidBegin and EditingDidEnd
|
||||
*/
|
||||
@IBDesignable
|
||||
@@ -20,28 +20,28 @@ open class CircularSlider: UIControl {
|
||||
// MARK: Changing the Slider’s Appearance
|
||||
|
||||
/**
|
||||
* The color shown for the portion of the disk of slider that is filled. (between start and end values)
|
||||
* The color shown for the selected portion of the slider disk. (between start and end values)
|
||||
* The default value is a transparent color.
|
||||
*/
|
||||
@IBInspectable
|
||||
open var diskFillColor: UIColor = UIColor.clear
|
||||
|
||||
/**
|
||||
* The color shown for the portion of the disk of slider that is unfilled. (outside start and end values)
|
||||
* The color shown for the unselected portion of the slider disk. (outside start and end values)
|
||||
* The default value of this property is the black color with alpha = 0.3.
|
||||
*/
|
||||
@IBInspectable
|
||||
open var diskColor: UIColor = UIColor.gray
|
||||
|
||||
/**
|
||||
* The color shown for the portion of the slider that is filled. (between start and end values)
|
||||
* The color shown for the selected track portion. (between start and end values)
|
||||
* The default value of this property is the tint color.
|
||||
*/
|
||||
@IBInspectable
|
||||
open var trackFillColor: UIColor = UIColor.clear
|
||||
|
||||
/**
|
||||
* The color shown for the portion of the slider that is unfilled. (outside start and end values)
|
||||
* The color shown for the unselected track portion. (outside start and end values)
|
||||
* The default value of this property is the white color.
|
||||
*/
|
||||
@IBInspectable
|
||||
@@ -64,7 +64,7 @@ open class CircularSlider: UIControl {
|
||||
open var thumbLineWidth: CGFloat = 4.0
|
||||
|
||||
/**
|
||||
* The radius of thumb
|
||||
* The radius of the thumb
|
||||
*
|
||||
* The default value of this property is 13.0.
|
||||
*/
|
||||
@@ -72,7 +72,7 @@ open class CircularSlider: UIControl {
|
||||
open var thumbRadius: CGFloat = 13.0
|
||||
|
||||
/**
|
||||
* The color used to tint thumb
|
||||
* The color used to tint the thumb
|
||||
* Ignored if the endThumbImage != nil
|
||||
*
|
||||
* The default value of this property is the groupTableViewBackgroundColor.
|
||||
@@ -81,8 +81,8 @@ open class CircularSlider: UIControl {
|
||||
open var endThumbTintColor: UIColor = UIColor.groupTableViewBackground
|
||||
|
||||
/**
|
||||
* The stroke highlighted color of end thumb
|
||||
* The default value of this property is blue color
|
||||
* The stroke highlighted color of the end thumb
|
||||
* The default value of this property is blue
|
||||
*/
|
||||
@IBInspectable
|
||||
open var endThumbStrokeHighlightedColor: UIColor = UIColor.blue
|
||||
@@ -91,14 +91,14 @@ open class CircularSlider: UIControl {
|
||||
* The color used to tint the stroke of the end thumb
|
||||
* Ignored if the endThumbImage != nil
|
||||
*
|
||||
* The default value of this property is the red color.
|
||||
* The default value of this property is red.
|
||||
*/
|
||||
@IBInspectable
|
||||
open var endThumbStrokeColor: UIColor = UIColor.red
|
||||
|
||||
/**
|
||||
* The image of the end thumb
|
||||
* Clears any custom color you may have provided for end thumb.
|
||||
* Clears any custom color you may have provided for the end thumb.
|
||||
*
|
||||
* The default value of this property is nil
|
||||
*/
|
||||
@@ -139,8 +139,8 @@ open class CircularSlider: UIControl {
|
||||
/**
|
||||
* The value of the endThumb (changed when the user change the position of the end thumb)
|
||||
*
|
||||
* If you try to set a value that is above the maximum value, the maximum value is set instead.
|
||||
* If you try to set a value that is below the minimum value, the minimum value is set instead.
|
||||
* If you try to set a value that is above the maximum value, the property automatically resets to the maximum value.
|
||||
* And if you try to set a value that is below the minimum value, the property automatically resets to the minimum value.
|
||||
*
|
||||
* The default value of this property is 0.5
|
||||
*/
|
||||
|
||||
@@ -97,8 +97,8 @@ extension CGRect {
|
||||
class CircularSliderHelper {
|
||||
|
||||
@nonobjc static let circleMinValue: CGFloat = 0
|
||||
@nonobjc static let circleMaxValue: CGFloat = CGFloat(2 * M_PI)
|
||||
@nonobjc static let circleInitialAngle: CGFloat = -CGFloat(M_PI_2)
|
||||
@nonobjc static let circleMaxValue: CGFloat = CGFloat(2 * Double.pi)
|
||||
@nonobjc static let circleInitialAngle: CGFloat = -CGFloat(Double.pi / 2)
|
||||
|
||||
/**
|
||||
Convert angle from radians to degrees
|
||||
@@ -108,7 +108,7 @@ class CircularSliderHelper {
|
||||
- returns: degree value
|
||||
*/
|
||||
internal static func degrees(fromRadians value: CGFloat) -> CGFloat {
|
||||
return value * 180.0 / CGFloat(M_PI)
|
||||
return value * 180.0 / CGFloat(Double.pi)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -133,7 +133,7 @@ class CircularSliderHelper {
|
||||
let angle = atan2(uv.determinant, uv.dotProduct)
|
||||
|
||||
// change the angle interval
|
||||
let newAngle = (angle < 0) ? -angle : Float(2 * M_PI) - angle
|
||||
let newAngle = (angle < 0) ? -angle : Float(2 * Double.pi) - angle
|
||||
|
||||
return CGFloat(newAngle)
|
||||
}
|
||||
|
||||
@@ -58,12 +58,14 @@ open class MidPointCircularSlider: RangeCircularSlider {
|
||||
*/
|
||||
override open var distance: CGFloat {
|
||||
didSet {
|
||||
assert(distance >= 0, "The CustomCircularSlider works only with fixed distance between start and end points, so distance property should be > 0")
|
||||
assert(distance >= 0, "The MidPointCircularSlider works only with fixed distance between start and end points, so distance property should be > 0")
|
||||
}
|
||||
}
|
||||
|
||||
/// The value of the mid point (between the start and end points)
|
||||
fileprivate var midPointValue: CGFloat {
|
||||
/**
|
||||
* The value of the mid point (between the start and end points)
|
||||
*/
|
||||
open var midPointValue: CGFloat {
|
||||
get {
|
||||
return (endPointValue + startPointValue) / 2
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ open class RangeCircularSlider: CircularSlider {
|
||||
* The minimum value of the receiver.
|
||||
*
|
||||
* If you change the value of this property, and the start value of the receiver is below the new minimum, the start value is adjusted to match the new minimum value automatically.
|
||||
* The end value is also adjusted to match (startPointValue + distance) automatically (see startPointValue)
|
||||
* The end value is also adjusted to match (startPointValue + distance) automatically if the distance is different to -1 (SeeAlso: startPointValue, distance)
|
||||
* The default value of this property is 0.0.
|
||||
*/
|
||||
override open var minimumValue: CGFloat {
|
||||
@@ -79,7 +79,7 @@ open class RangeCircularSlider: CircularSlider {
|
||||
* The maximum value of the receiver.
|
||||
*
|
||||
* If you change the value of this property, and the end value of the receiver is above the new maximum, the end value is adjusted to match the new maximum value automatically.
|
||||
* The start value is also adjusted to match (endPointValue - distance) automatically (see endPointValue)
|
||||
* The start value is also adjusted to match (endPointValue - distance) automatically if the distance is different to -1 (see endPointValue, distance)
|
||||
* The default value of this property is 1.0.
|
||||
*/
|
||||
@IBInspectable
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# HGCircularSlider
|
||||
|
||||
[](https://twitter.com/GhazouaniHamza)
|
||||
[](https://travis-ci.org/Hamza Ghazouani/HGCircularSlider)
|
||||
[](https://travis-ci.org/HamzaGhazouani/HGCircularSlider)
|
||||
[](http://cocoapods.org/pods/HGCircularSlider)
|
||||
[](http://cocoapods.org/pods/HGCircularSlider)
|
||||
[]()
|
||||
@@ -29,8 +29,8 @@ it, simply add the following line to your Podfile:
|
||||
|
||||
``` ruby
|
||||
|
||||
# Swift 3.0 - Xcode 8
|
||||
pod 'HGCircularSlider', '~> 1.0.0'
|
||||
# Swift 3.1 - Xcode 8.3
|
||||
pod 'HGCircularSlider', '~> 1.1.0'
|
||||
|
||||
# Swift 2.2 - Xcode 7.3.1 (Checkout Swift2_Xcode7.3 branche)
|
||||
pod 'HGCircularSlider', '~> 0.1.2'
|
||||
@@ -42,14 +42,30 @@ pod 'HGCircularSlider', '~> 0.1.2'
|
||||
|
||||
```
|
||||
let circularSlider = CircularSlider(frame: myFrame)
|
||||
```
|
||||
OR
|
||||
circularSlider.minimumValue = 0.0
|
||||
circularSlider.maximumValue = 1.0
|
||||
circularSlider.endPointValue = 0.2
|
||||
|
||||
```
|
||||
OR
|
||||
```
|
||||
let circularSlider = RangeCircularSlider(frame: myFrame)
|
||||
```
|
||||
OR
|
||||
circularSlider.startThumbImage = UIImage(named: "Bedtime")
|
||||
circularSlider.endThumbImage = UIImage(named: "Wake")
|
||||
|
||||
let dayInSeconds = 24 * 60 * 60
|
||||
circularSlider.maximumValue = CGFloat(dayInSeconds)
|
||||
|
||||
circularSlider.startPointValue = 1 * 60 * 60
|
||||
circularSlider.endPointValue = 8 * 60 * 60
|
||||
```
|
||||
OR
|
||||
```
|
||||
let circularSlider = MidPointCircularSlider(frame: myFrame)
|
||||
let circularSlider = MidPointCircularSlider(frame: myFrame)
|
||||
circularSlider.minimumValue = 0.0
|
||||
circularSlider.maximumValue = 10.0
|
||||
circularSlider.distance = 1.0
|
||||
circularSlider.midPointValue = 5.0
|
||||
```
|
||||
## Documentation
|
||||
Full documentation is available on [CocoaDocs](http://cocoadocs.org/docsets/HGCircularSlider/).<br/>
|
||||
@@ -58,11 +74,11 @@ You can also install documentation locally using [jazzy](https://github.com/real
|
||||
## References
|
||||
The UI examples of the demo project inspired from [Dribbble](https://dribbble.com).
|
||||
|
||||
[Player](https://dribbble.com/shots/3062636-Countdown-Timer-Daily-UI-014)
|
||||
[BasicExample](https://dribbble.com/shots/2153963-Dompet-Wallet-App)
|
||||
[OClock](https://dribbble.com/shots/2671286-Clock-Alarm-app)
|
||||
[Player](https://dribbble.com/shots/3062636-Countdown-Timer-Daily-UI-014) <br/>
|
||||
[BasicExample](https://dribbble.com/shots/2153963-Dompet-Wallet-App)<br/>
|
||||
[OClock](https://dribbble.com/shots/2671286-Clock-Alarm-app)<br/>
|
||||
|
||||
The project is Inspired from [UICircularSlider](https://github.com/Zedenem/UICircularSlider)
|
||||
The project is Inspired by [UICircularSlider](https://github.com/Zedenem/UICircularSlider)
|
||||
|
||||
## Author
|
||||
|
||||
|
||||
Reference in New Issue
Block a user