This file contains hidden or 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
typedef NS_ENUM(NSInteger, CLRColorSpace) { | |
CLRColorSpaceRGB = 0, | |
CLRColorSpaceHSV | |
} NS_SWIFT_NAME(ColorSpace); | |
typedef NS_OPTIONS(NSUInteger, CLRDrawingMode) { | |
CLRDrawingModeNone = 0, | |
CLRDrawingModeFill = 1 << 0, | |
CLRDrawingModeStroke = 1 << 1 |
This file contains hidden or 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
public enum ColorSpace : Int { | |
case RGB | |
case HSV | |
} | |
public struct DrawingMode : OptionSet { | |
public init(rawValue: UInt) | |
This file contains hidden or 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
open class Palette : NSObject { | |
public /*not inherited*/ init(name: String, colors: [CLRColor]) | |
} |
This file contains hidden or 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
@interface CLRPalette : NSObject | |
+ (CLRPalette *)paletteWithName:(NSString *)name colors:(NSArray<CLRColor *> *)colors; | |
@end |
This file contains hidden or 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
@interface CLRPalette : NSObject | |
- (nullable CLRPalette *)convertToColorSpace:(CLRColorSpace)colorSpace error:(NSError **)error; | |
@end |
This file contains hidden or 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
open class Palette : NSObject { | |
open func convert(to colorSpace: ColorSpace) throws -> Palette | |
} |
This file contains hidden or 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
NS_SWIFT_NAME(Color) | |
@interface CLRColor : NSObject | |
- (void)getHue:(nullable CGFloat *)hue saturation:(nullable CGFloat *)saturation value:(nullable CGFloat *)value NS_REFINED_FOR_SWIFT; | |
@end |
This file contains hidden or 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
extension Color { | |
var hsv: (hue: CGFloat, saturation: CGFloat, value: CGFloat) { | |
var r: CGFloat = 0.0 | |
var g: CGFloat = 0.0 | |
var b: CGFloat = 0.0 | |
__getHue(&r, saturation: &g, value: &b) | |
return (hue: r, saturation: g, value: b) | |
} | |
} |
This file contains hidden or 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
#if DEBUG | |
extension UIWindow { | |
class var key: UIWindow { | |
let selector: Selector = NSSelectorFromString("keyWindow") | |
let result = UIWindow.perform(selector) | |
return result?.takeUnretainedValue() as! UIWindow | |
} | |
} |
This file contains hidden or 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
class Controller { | |
var view: View | |
var model: Model | |
} |