on master help sign in
Make components open
commit99d4f653f6934120234cbe04dd3d810d5b965043 authorLouis D'hauwe <louisdhauwe@silverfox.be> dateMon 2 Apr 2018, 20:07 (9 years ago) parentbc3546c
6 files changed+32−32
HueKit/View/ColorBarPicker.swift+11−11 HueKit/View/ColorBarView.swift+2−2 HueKit/View/ColorIndicatorView.swift+3−3 HueKit/View/ColorSquarePicker.swift+6−6 HueKit/View/ColorSquareView.swift+2−2 HueKit/View/SourceColorView.swift+8−8
HueKit/View/ColorBarPicker.swift+11−11
@@ -10,7 +10,7 @@ import Foundation
1010import UIKit
1111
1212@IBDesignable
13−public class ColorBarPicker: UIControl {
13+open class ColorBarPicker: UIControl {
1414
1515 private var isVertical: Bool = false {
1616 didSet {
@@ -33,7 +33,7 @@ public class ColorBarPicker: UIControl {
3333 private static let indicatorSizeActive = CGSize(width: 40.0, height: 40.0)
3434
3535 @IBInspectable
36− public var hue: CGFloat {
36+ open var hue: CGFloat {
3737 get {
3838 if isVertical {
3939 return 1.0 - value
@@ -112,7 +112,7 @@ public class ColorBarPicker: UIControl {
112112
113113 // MARK: - Drawing
114114
115− override public func layoutSubviews() {
115+ override open func layoutSubviews() {
116116
117117 if colorBarView.superview == nil {
118118
@@ -182,26 +182,26 @@ public class ColorBarPicker: UIControl {
182182 self.value = percent.pinned(between: 0, and: 1)
183183 }
184184
185− override public func beginTracking(_ touch: UITouch, with event: UIEvent?) -> Bool {
185+ override open func beginTracking(_ touch: UITouch, with event: UIEvent?) -> Bool {
186186 self.trackIndicator(with: touch)
187187
188188 growIndicator()
189189 return true
190190 }
191191
192− override public func continueTracking(_ touch: UITouch, with event: UIEvent?) -> Bool {
192+ override open func continueTracking(_ touch: UITouch, with event: UIEvent?) -> Bool {
193193 self.trackIndicator(with: touch)
194194
195195 return true
196196 }
197197
198− override public func endTracking(_ touch: UITouch?, with event: UIEvent?) {
198+ override open func endTracking(_ touch: UITouch?, with event: UIEvent?) {
199199 super.endTracking(touch, with: event)
200200
201201 shrinkIndicator()
202202 }
203203
204− override public func cancelTracking(with event: UIEvent?) {
204+ override open func cancelTracking(with event: UIEvent?) {
205205 super.cancelTracking(with: event)
206206
207207 shrinkIndicator()
@@ -250,7 +250,7 @@ public class ColorBarPicker: UIControl {
250250
251251 private let accessibilityInterval: CGFloat = 0.05
252252
253− public override var accessibilityTraits: UIAccessibilityTraits {
253+ open override var accessibilityTraits: UIAccessibilityTraits {
254254 get {
255255 var t = super.accessibilityTraits
256256
@@ -263,7 +263,7 @@ public class ColorBarPicker: UIControl {
263263 }
264264 }
265265
266− public override func accessibilityIncrement() {
266+ open override func accessibilityIncrement() {
267267
268268 var newValue = self.value + accessibilityInterval
269269
@@ -274,7 +274,7 @@ public class ColorBarPicker: UIControl {
274274 self.value = newValue
275275 }
276276
277− public override func accessibilityDecrement() {
277+ open override func accessibilityDecrement() {
278278
279279 var newValue = self.value - accessibilityInterval
280280
@@ -285,7 +285,7 @@ public class ColorBarPicker: UIControl {
285285 self.value = newValue
286286 }
287287
288− public override var accessibilityValue: String? {
288+ open override var accessibilityValue: String? {
289289 get {
290290 return String(format: "%d degrees hue", (self.value * 360.0))
291291 }
HueKit/View/ColorBarView.swift+2−2
@@ -10,7 +10,7 @@ import Foundation
1010import UIKit
1111
1212@IBDesignable
13−class ColorBarView: UIView {
13+open class ColorBarView: UIView {
1414
1515 private static func createContentImage() -> CGImage? {
1616
@@ -19,7 +19,7 @@ class ColorBarView: UIView {
1919 return HSBGen.createHSVBarContentImage(hsbComponent: .hue, hsv: hsv)
2020 }
2121
22− override func draw(_ rect: CGRect) {
22+ override open func draw(_ rect: CGRect) {
2323
2424 guard let context = UIGraphicsGetCurrentContext() else {
2525 return
HueKit/View/ColorIndicatorView.swift+3−3
@@ -10,10 +10,10 @@ import Foundation
1010import UIKit
1111
1212@IBDesignable
13−public class ColorIndicatorView: UIView {
13+open class ColorIndicatorView: UIView {
1414
1515 @IBInspectable
16− public var color: UIColor = .black {
16+ open var color: UIColor = .black {
1717 didSet {
1818
1919 if oldValue != color {
@@ -35,7 +35,7 @@ public class ColorIndicatorView: UIView {
3535
3636 }
3737
38− override public func draw(_ rect: CGRect) {
38+ override open func draw(_ rect: CGRect) {
3939
4040 guard let context = UIGraphicsGetCurrentContext() else {
4141 return
HueKit/View/ColorSquarePicker.swift+6−6
@@ -10,7 +10,7 @@ import Foundation
1010import UIKit
1111
1212@IBDesignable
13−public class ColorSquarePicker: UIControl {
13+open class ColorSquarePicker: UIControl {
1414
1515 private let contentInsetX: CGFloat = 20
1616 private let contentInsetY: CGFloat = 20
@@ -60,7 +60,7 @@ public class ColorSquarePicker: UIControl {
6060 indicator.color = color
6161 }
6262
63− public override func layoutSubviews() {
63+ open override func layoutSubviews() {
6464
6565 if colorSquareView.superview == nil {
6666
@@ -104,7 +104,7 @@ public class ColorSquarePicker: UIControl {
104104 self.value = touchValue
105105 }
106106
107− override public func beginTracking(_ touch: UITouch, with event: UIEvent?) -> Bool {
107+ override open func beginTracking(_ touch: UITouch, with event: UIEvent?) -> Bool {
108108
109109 self.trackIndicator(with: touch)
110110
@@ -113,20 +113,20 @@ public class ColorSquarePicker: UIControl {
113113 return true
114114 }
115115
116− override public func continueTracking(_ touch: UITouch, with event: UIEvent?) -> Bool {
116+ override open func continueTracking(_ touch: UITouch, with event: UIEvent?) -> Bool {
117117
118118 self.trackIndicator(with: touch)
119119
120120 return true
121121 }
122122
123− override public func endTracking(_ touch: UITouch?, with event: UIEvent?) {
123+ override open func endTracking(_ touch: UITouch?, with event: UIEvent?) {
124124 super.endTracking(touch, with: event)
125125
126126 shrinkIndicator()
127127 }
128128
129− override public func cancelTracking(with event: UIEvent?) {
129+ override open func cancelTracking(with event: UIEvent?) {
130130 super.cancelTracking(with: event)
131131
132132 shrinkIndicator()
HueKit/View/ColorSquareView.swift+2−2
@@ -9,12 +9,12 @@
99import UIKit
1010
1111@IBDesignable
12−class ColorSquareView: UIImageView {
12+open class ColorSquareView: UIImageView {
1313
1414 private var drawnHue: CGFloat = 0.0
1515
1616 @IBInspectable
17− var hue: CGFloat = 0.0 {
17+ open var hue: CGFloat = 0.0 {
1818 didSet {
1919
2020 if self.image != nil && abs(drawnHue - hue) <= 1e-10 {
HueKit/View/SourceColorView.swift+8−8
@@ -10,10 +10,10 @@ import Foundation
1010import UIKit
1111
1212@IBDesignable
13−public class SourceColorView: UIControl {
13+open class SourceColorView: UIControl {
1414
1515 @IBInspectable
16− public var isTrackingInside: Bool = false {
16+ open var isTrackingInside: Bool = false {
1717 didSet {
1818 if oldValue != isTrackingInside {
1919 self.setNeedsDisplay()
@@ -22,7 +22,7 @@ public class SourceColorView: UIControl {
2222 }
2323
2424 @IBInspectable
25− public var dontShrinkWhenPressed: Bool = false {
25+ open var dontShrinkWhenPressed: Bool = false {
2626 didSet {
2727 if oldValue != dontShrinkWhenPressed {
2828 self.setNeedsDisplay()
@@ -30,7 +30,7 @@ public class SourceColorView: UIControl {
3030 }
3131 }
3232
33− public override func draw(_ rect: CGRect) {
33+ open override func draw(_ rect: CGRect) {
3434 super.draw(rect)
3535
3636 guard isEnabled && isTrackingInside && !dontShrinkWhenPressed else {
@@ -52,7 +52,7 @@ public class SourceColorView: UIControl {
5252
5353 // MARK: - UIControl overrides
5454
55− public override func beginTracking(_ touch: UITouch, with event: UIEvent?) -> Bool {
55+ open override func beginTracking(_ touch: UITouch, with event: UIEvent?) -> Bool {
5656
5757 guard self.isEnabled else {
5858 return false
@@ -63,7 +63,7 @@ public class SourceColorView: UIControl {
6363 return super.beginTracking(touch, with: event)
6464 }
6565
66− public override func continueTracking(_ touch: UITouch, with event: UIEvent?) -> Bool {
66+ open override func continueTracking(_ touch: UITouch, with event: UIEvent?) -> Bool {
6767
6868 let isTrackingInside = self.bounds.contains(touch.location(in: self))
6969
@@ -72,14 +72,14 @@ public class SourceColorView: UIControl {
7272 return super.continueTracking(touch, with: event)
7373 }
7474
75− public override func endTracking(_ touch: UITouch?, with event: UIEvent?) {
75+ open override func endTracking(_ touch: UITouch?, with event: UIEvent?) {
7676
7777 self.isTrackingInside = false
7878
7979 super.endTracking(touch, with: event)
8080 }
8181
82− public override func cancelTracking(with event: UIEvent?) {
82+ open override func cancelTracking(with event: UIEvent?) {
8383
8484 self.isTrackingInside = false
8585