@@ -20,12 +20,6 @@ public protocol ColorComponentsContract {
2020 var strokeWeight : CGFloat { get set }
2121}
2222
23- class ColorComponents : ColorComponentsContract {
24- var fill : UIColor = UIColor . white
25- var stroke : UIColor = UIColor . clear
26- var strokeWeight : CGFloat = 1.0
27- }
28-
2923public protocol ColorModelContract {
3024 func background( _ color: UIColor )
3125 func background( _ r: CGFloat , _ g: CGFloat , _ b: CGFloat , _ a: CGFloat )
@@ -39,56 +33,62 @@ public protocol ColorModelContract {
3933 mutating func noStroke( )
4034}
4135
42- struct ColorModel : ColorModelContract {
36+ public class ColorComponents : ColorComponentsContract {
37+ public var fill : UIColor = UIColor . white
38+ public var stroke : UIColor = UIColor . clear
39+ public var strokeWeight : CGFloat = 1.0
40+ }
41+
42+ public struct ColorModel : ColorModelContract {
4343 private var contextComponents : ContextComponenetsContract
4444 private var colorComponents : ColorComponentsContract
4545 private var frameComponents : FrameComponentsContract
4646
47- init ( contextComponents: ContextComponenetsContract , colorComponents: ColorComponentsContract , frameComponents: FrameComponentsContract ) {
47+ public init ( contextComponents: ContextComponenetsContract , colorComponents: ColorComponentsContract , frameComponents: FrameComponentsContract ) {
4848 self . contextComponents = contextComponents
4949 self . colorComponents = colorComponents
5050 self . frameComponents = frameComponents
5151 }
5252
53- func background( _ color: UIColor ) {
53+ public func background( _ color: UIColor ) {
5454 let g = self . contextComponents. context ( )
5555 g? . clear ( self . frameComponents. bounds)
5656 }
5757
58- func background( _ r: CGFloat , _ g: CGFloat , _ b: CGFloat , _ a: CGFloat ) {
58+ public func background( _ r: CGFloat , _ g: CGFloat , _ b: CGFloat , _ a: CGFloat ) {
5959 self . background ( UIColor ( red: r / 255.0 , green: g / 255.0 , blue: b / 255.0 , alpha: a / 255.0 ) )
6060 }
6161
62- func clear( ) {
62+ public func clear( ) {
6363 let g = self . contextComponents. context ( )
6464 g? . clear ( self . frameComponents. bounds)
6565 }
6666
67- mutating func fill( _ color: UIColor ) {
67+ public mutating func fill( _ color: UIColor ) {
6868 self . colorComponents. fill = color
6969 }
7070
71- mutating func fill( _ r: CGFloat , _ g: CGFloat , _ b: CGFloat , _ a: CGFloat ) {
71+ public mutating func fill( _ r: CGFloat , _ g: CGFloat , _ b: CGFloat , _ a: CGFloat ) {
7272 self . fill ( UIColor ( red: r / 255.0 , green: g / 255.0 , blue: b / 255.0 , alpha: a / 255.0 ) )
7373 }
7474
75- mutating func stroke( _ color: UIColor ) {
75+ public mutating func stroke( _ color: UIColor ) {
7676 self . colorComponents. stroke = color
7777 }
7878
79- mutating func stroke( _ r: CGFloat , _ g: CGFloat , _ b: CGFloat , _ a: CGFloat ) {
79+ public mutating func stroke( _ r: CGFloat , _ g: CGFloat , _ b: CGFloat , _ a: CGFloat ) {
8080 self . stroke ( UIColor ( red: r / 255.0 , green: g / 255.0 , blue: b / 255.0 , alpha: a / 255.0 ) )
8181 }
8282
83- mutating func strokeWeight( _ weight: CGFloat ) {
83+ public mutating func strokeWeight( _ weight: CGFloat ) {
8484 self . colorComponents. strokeWeight = weight
8585 }
8686
87- mutating func noFill( ) {
87+ public mutating func noFill( ) {
8888 self . colorComponents. fill = UIColor . clear
8989 }
9090
91- mutating func noStroke( ) {
91+ public mutating func noStroke( ) {
9292 self . colorComponents. stroke = UIColor . clear
9393 }
9494}
0 commit comments