Skip to content

Commit

Permalink
public un-hex controls
Browse files Browse the repository at this point in the history
  • Loading branch information
noppefoxwolf committed Jul 9, 2022
1 parent 477d51e commit 48e0ce2
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 12 deletions.
4 changes: 2 additions & 2 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/SnapKit/SnapKit",
"state" : {
"revision" : "d458564516e5676af9c70b4f4b2a9178294f1bc6",
"version" : "5.0.1"
"revision" : "f222cbdf325885926566172f6f5f06af95473158",
"version" : "5.6.0"
}
}
],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import UIKit

class HSBColorSlidersView: UIControl {
public class HSBColorSlidersView: UIControl, ColorPicker {
public let id: String = #function
public let title: String = LocalizedString.hsb

let hueSlider = ColorSliderWithInputView()
let saturationSlider = ColorSliderWithInputView()
let brightnessSlider = ColorSliderWithInputView()

private var _color: CGColor = .white

var color: CGColor {
public var color: CGColor {
get { _color }
set {
_color = newValue
Expand All @@ -17,15 +20,15 @@ class HSBColorSlidersView: UIControl {
}
}

var continuously: Bool {
public var continuously: Bool {
[
hueSlider.slider.panGestureRecognizer.state,
saturationSlider.slider.panGestureRecognizer.state,
brightnessSlider.slider.panGestureRecognizer.state
].contains(.changed)
}

override init(frame: CGRect) {
public override init(frame: CGRect) {
super.init(frame: frame)

hueSlider.slider.configuration = .hue
Expand Down Expand Up @@ -59,6 +62,7 @@ class HSBColorSlidersView: UIControl {
brightnessSlider.addAction(valueSyncAction, for: .primaryActionTriggered)
}

@available(*, unavailable)
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import UIKit

public class HSBHexSliderColorPicker: UIControl, ColorPicker {
public let id: String = #function
public var title: String = LocalizedString.hsb
public let title: String = LocalizedString.hsb

let hsbSlidersView = HSBColorSlidersView(frame: .null)
let hexInputView = HexInputView(frame: .null)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import UIKit

class RGBColorSlidersView: UIControl {
public class RGBColorSlidersView: UIControl, ColorPicker {
public let id: String = #function
public let title: String = LocalizedString.rgb

let redSlider = ColorSliderWithInputView()
let greenSlider = ColorSliderWithInputView()
let blueSlider = ColorSliderWithInputView()

private var _color: CGColor = .white

var color: CGColor {
public var color: CGColor {
get { _color }
set {
_color = newValue
Expand All @@ -17,15 +20,15 @@ class RGBColorSlidersView: UIControl {
}
}

var continuously: Bool {
public var continuously: Bool {
[
redSlider.slider.panGestureRecognizer.state,
greenSlider.slider.panGestureRecognizer.state,
blueSlider.slider.panGestureRecognizer.state
].contains(.changed)
}

override init(frame: CGRect) {
public override init(frame: CGRect) {
super.init(frame: frame)

redSlider.slider.configuration = .red
Expand Down Expand Up @@ -59,6 +62,7 @@ class RGBColorSlidersView: UIControl {
blueSlider.addAction(valueSyncAction, for: .primaryActionTriggered)
}

@available(*, unavailable)
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import UIKit

public class RGBHexSliderColorPicker: UIControl, ColorPicker {
public let id: String = #function
public var title: String = LocalizedString.rgb
public let title: String = LocalizedString.rgb

let rgbSlidersView = RGBColorSlidersView(frame: .null)
let hexInputView = HexInputView(frame: .null)
Expand Down

0 comments on commit 48e0ce2

Please sign in to comment.