-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 621bd25
Showing
39 changed files
with
4,996 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
4.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
4.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2017 Mohamed Shahawy | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
Pod::Spec.new do |s| | ||
s.name = 'MSCircularSlider' | ||
s.version = '0.1.0' | ||
s.license = { :type => 'MIT', :file => 'LICENSE' } | ||
s.authors = { 'ThunderStruct' => 'mohamedshahawy@aucegypt.edu' } | ||
s.summary = 'A full-featured circular slider for iOS applications' | ||
s.homepage = 'https://github.com/ThunderStruct/MSCircularSlider' | ||
|
||
# Source Info | ||
s.platform = :ios, '9.3' | ||
s.source = { :git => 'https://github.com/ThunderStruct/MSCircularSlider.git', :tag => "0.1.0" } | ||
s.source_files = 'MSCircularSlider/*.{swift}' | ||
s.pod_target_xcconfig = { 'SWIFT_VERSION' => '4.0' } | ||
|
||
s.requires_arc = true | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,231 @@ | ||
// | ||
// MSCircularSlider+IB.swift | ||
// | ||
// Created by Mohamed Shahawy on 27/09/17. | ||
// Copyright © 2017 Mohamed Shahawy. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
|
||
extension MSCircularSlider { | ||
|
||
//================================================================================ | ||
// VALUE PROPERTIES | ||
//================================================================================ | ||
|
||
@IBInspectable var _minimumValue: Double { | ||
get { | ||
return minimumValue | ||
} | ||
set { | ||
minimumValue = newValue | ||
} | ||
} | ||
|
||
@IBInspectable var _maximumValue: Double { | ||
get { | ||
return maximumValue | ||
} | ||
set { | ||
maximumValue = newValue | ||
} | ||
} | ||
|
||
@IBInspectable var _currentValue: Double { | ||
get { | ||
return currentValue | ||
} | ||
set { | ||
currentValue = min(max(newValue, minimumValue), maximumValue) | ||
} | ||
} | ||
|
||
//================================================================================ | ||
// SHAPE PROPERTIES | ||
//================================================================================ | ||
|
||
@IBInspectable var _maximumAngle: CGFloat { | ||
get { | ||
return maximumAngle | ||
} | ||
set { | ||
let modifiedNewValue = newValue < 0.0 ? 360.0 - (newValue.truncatingRemainder(dividingBy: 360.0)) : newValue | ||
maximumAngle = modifiedNewValue < 360.0 ? modifiedNewValue : modifiedNewValue.truncatingRemainder(dividingBy: 360.0) | ||
} | ||
} | ||
|
||
@IBInspectable var _lineWidth: Int { | ||
get { | ||
return lineWidth | ||
} | ||
set { | ||
lineWidth = newValue | ||
} | ||
} | ||
|
||
@IBInspectable var _filledColor: UIColor { | ||
get { | ||
return filledColor | ||
} | ||
set { | ||
filledColor = newValue | ||
} | ||
} | ||
|
||
@IBInspectable var _unfilledColor: UIColor { | ||
get { | ||
return unfilledColor | ||
} | ||
set { | ||
unfilledColor = newValue | ||
} | ||
} | ||
|
||
@IBInspectable var _rotationAngle: CGFloat { | ||
get { | ||
return rotationAngle ?? 0 as CGFloat | ||
} | ||
set { | ||
rotationAngle = newValue | ||
} | ||
} | ||
|
||
//================================================================================ | ||
// HANDLE PROPERTIES | ||
//================================================================================ | ||
|
||
@IBInspectable var _handleType: Int { // Takes values from 0 to 3 only | ||
get { | ||
return handleType.rawValue | ||
} | ||
set { | ||
if let temp = MSCircularSliderHandleType(rawValue: newValue) { | ||
handleType = temp | ||
} | ||
} | ||
} | ||
|
||
@IBInspectable var _handleColor: UIColor { | ||
get { | ||
return handleColor | ||
} | ||
set { | ||
handleColor = newValue | ||
} | ||
} | ||
|
||
@IBInspectable var _handleEnlargementPoints: Int { | ||
get { | ||
return handleEnlargementPoints | ||
} | ||
set { | ||
handleEnlargementPoints = newValue | ||
} | ||
} | ||
|
||
@IBInspectable var _handleHighlightable: Bool { | ||
get { | ||
return handleHighlightable | ||
} | ||
set { | ||
handleHighlightable = newValue | ||
} | ||
} | ||
|
||
//================================================================================ | ||
// LABELS PROPERTIES | ||
//================================================================================ | ||
|
||
@IBInspectable var _commaSeparatedLabels: String { | ||
get { | ||
return labels.isEmpty ? "" : labels.joined(separator: ",") | ||
} | ||
set { | ||
if !newValue.trimmingCharacters(in: .whitespaces).isEmpty { | ||
|
||
labels = newValue.components(separatedBy: ",") | ||
} | ||
} | ||
} | ||
|
||
@IBInspectable var _labelFont: UIFont { | ||
get { | ||
return labelFont | ||
} | ||
set { | ||
labelFont = newValue | ||
} | ||
} | ||
|
||
@IBInspectable var _labelColor: UIColor { | ||
get { | ||
return labelColor | ||
} | ||
set { | ||
labelColor = newValue | ||
} | ||
} | ||
|
||
@IBInspectable var _labelOffset: CGFloat { | ||
get { | ||
return labelOffset | ||
} | ||
set { | ||
labelOffset = newValue | ||
} | ||
} | ||
|
||
@IBInspectable var _snapToLabels: Bool { | ||
get { | ||
return snapToLabels | ||
} | ||
set { | ||
snapToLabels = newValue | ||
} | ||
} | ||
|
||
//================================================================================ | ||
// MARKERS PROPERTIES | ||
//================================================================================ | ||
|
||
@IBInspectable var _markerCount: Int { | ||
get { | ||
return markerCount | ||
} | ||
set { | ||
markerCount = max(0, newValue) | ||
} | ||
} | ||
|
||
@IBInspectable var _markerColor: UIColor { | ||
get { | ||
return markerColor | ||
} | ||
set { | ||
markerColor = newValue | ||
} | ||
} | ||
|
||
@IBInspectable var _markerImage: UIImage { | ||
get { | ||
return markerImage ?? UIImage() | ||
} | ||
set { | ||
markerImage = newValue | ||
} | ||
} | ||
|
||
@IBInspectable var _snapToMarkers: Bool { | ||
get { | ||
return snapToMarkers | ||
} | ||
set { | ||
snapToMarkers = newValue | ||
} | ||
} | ||
|
||
} | ||
|
||
|
||
|
||
|
Oops, something went wrong.