Skip to content

Commit 621bd25

Browse files
committed
Initial commit
0 parents  commit 621bd25

39 files changed

+4996
-0
lines changed

.swift-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
4.0

.swift-version.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
4.0

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2017 Mohamed Shahawy
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.

MSCircularSlider.podspec

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
Pod::Spec.new do |s|
2+
s.name = 'MSCircularSlider'
3+
s.version = '0.1.0'
4+
s.license = { :type => 'MIT', :file => 'LICENSE' }
5+
s.authors = { 'ThunderStruct' => '[email protected]' }
6+
s.summary = 'A full-featured circular slider for iOS applications'
7+
s.homepage = 'https://github.com/ThunderStruct/MSCircularSlider'
8+
9+
# Source Info
10+
s.platform = :ios, '9.3'
11+
s.source = { :git => 'https://github.com/ThunderStruct/MSCircularSlider.git', :tag => "0.1.0" }
12+
s.source_files = 'MSCircularSlider/*.{swift}'
13+
s.pod_target_xcconfig = { 'SWIFT_VERSION' => '4.0' }
14+
15+
s.requires_arc = true
16+
end
Lines changed: 231 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,231 @@
1+
//
2+
// MSCircularSlider+IB.swift
3+
//
4+
// Created by Mohamed Shahawy on 27/09/17.
5+
// Copyright © 2017 Mohamed Shahawy. All rights reserved.
6+
//
7+
8+
import UIKit
9+
10+
extension MSCircularSlider {
11+
12+
//================================================================================
13+
// VALUE PROPERTIES
14+
//================================================================================
15+
16+
@IBInspectable var _minimumValue: Double {
17+
get {
18+
return minimumValue
19+
}
20+
set {
21+
minimumValue = newValue
22+
}
23+
}
24+
25+
@IBInspectable var _maximumValue: Double {
26+
get {
27+
return maximumValue
28+
}
29+
set {
30+
maximumValue = newValue
31+
}
32+
}
33+
34+
@IBInspectable var _currentValue: Double {
35+
get {
36+
return currentValue
37+
}
38+
set {
39+
currentValue = min(max(newValue, minimumValue), maximumValue)
40+
}
41+
}
42+
43+
//================================================================================
44+
// SHAPE PROPERTIES
45+
//================================================================================
46+
47+
@IBInspectable var _maximumAngle: CGFloat {
48+
get {
49+
return maximumAngle
50+
}
51+
set {
52+
let modifiedNewValue = newValue < 0.0 ? 360.0 - (newValue.truncatingRemainder(dividingBy: 360.0)) : newValue
53+
maximumAngle = modifiedNewValue < 360.0 ? modifiedNewValue : modifiedNewValue.truncatingRemainder(dividingBy: 360.0)
54+
}
55+
}
56+
57+
@IBInspectable var _lineWidth: Int {
58+
get {
59+
return lineWidth
60+
}
61+
set {
62+
lineWidth = newValue
63+
}
64+
}
65+
66+
@IBInspectable var _filledColor: UIColor {
67+
get {
68+
return filledColor
69+
}
70+
set {
71+
filledColor = newValue
72+
}
73+
}
74+
75+
@IBInspectable var _unfilledColor: UIColor {
76+
get {
77+
return unfilledColor
78+
}
79+
set {
80+
unfilledColor = newValue
81+
}
82+
}
83+
84+
@IBInspectable var _rotationAngle: CGFloat {
85+
get {
86+
return rotationAngle ?? 0 as CGFloat
87+
}
88+
set {
89+
rotationAngle = newValue
90+
}
91+
}
92+
93+
//================================================================================
94+
// HANDLE PROPERTIES
95+
//================================================================================
96+
97+
@IBInspectable var _handleType: Int { // Takes values from 0 to 3 only
98+
get {
99+
return handleType.rawValue
100+
}
101+
set {
102+
if let temp = MSCircularSliderHandleType(rawValue: newValue) {
103+
handleType = temp
104+
}
105+
}
106+
}
107+
108+
@IBInspectable var _handleColor: UIColor {
109+
get {
110+
return handleColor
111+
}
112+
set {
113+
handleColor = newValue
114+
}
115+
}
116+
117+
@IBInspectable var _handleEnlargementPoints: Int {
118+
get {
119+
return handleEnlargementPoints
120+
}
121+
set {
122+
handleEnlargementPoints = newValue
123+
}
124+
}
125+
126+
@IBInspectable var _handleHighlightable: Bool {
127+
get {
128+
return handleHighlightable
129+
}
130+
set {
131+
handleHighlightable = newValue
132+
}
133+
}
134+
135+
//================================================================================
136+
// LABELS PROPERTIES
137+
//================================================================================
138+
139+
@IBInspectable var _commaSeparatedLabels: String {
140+
get {
141+
return labels.isEmpty ? "" : labels.joined(separator: ",")
142+
}
143+
set {
144+
if !newValue.trimmingCharacters(in: .whitespaces).isEmpty {
145+
146+
labels = newValue.components(separatedBy: ",")
147+
}
148+
}
149+
}
150+
151+
@IBInspectable var _labelFont: UIFont {
152+
get {
153+
return labelFont
154+
}
155+
set {
156+
labelFont = newValue
157+
}
158+
}
159+
160+
@IBInspectable var _labelColor: UIColor {
161+
get {
162+
return labelColor
163+
}
164+
set {
165+
labelColor = newValue
166+
}
167+
}
168+
169+
@IBInspectable var _labelOffset: CGFloat {
170+
get {
171+
return labelOffset
172+
}
173+
set {
174+
labelOffset = newValue
175+
}
176+
}
177+
178+
@IBInspectable var _snapToLabels: Bool {
179+
get {
180+
return snapToLabels
181+
}
182+
set {
183+
snapToLabels = newValue
184+
}
185+
}
186+
187+
//================================================================================
188+
// MARKERS PROPERTIES
189+
//================================================================================
190+
191+
@IBInspectable var _markerCount: Int {
192+
get {
193+
return markerCount
194+
}
195+
set {
196+
markerCount = max(0, newValue)
197+
}
198+
}
199+
200+
@IBInspectable var _markerColor: UIColor {
201+
get {
202+
return markerColor
203+
}
204+
set {
205+
markerColor = newValue
206+
}
207+
}
208+
209+
@IBInspectable var _markerImage: UIImage {
210+
get {
211+
return markerImage ?? UIImage()
212+
}
213+
set {
214+
markerImage = newValue
215+
}
216+
}
217+
218+
@IBInspectable var _snapToMarkers: Bool {
219+
get {
220+
return snapToMarkers
221+
}
222+
set {
223+
snapToMarkers = newValue
224+
}
225+
}
226+
227+
}
228+
229+
230+
231+

0 commit comments

Comments
 (0)