Created
June 30, 2015 03:42
-
-
Save andrewgrant/a4c076c9e3664f8e6e5f to your computer and use it in GitHub Desktop.
Revisions
-
andrewgrant renamed this gist
Jun 30, 2015 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
andrewgrant created this gist
Jun 30, 2015 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,16 @@ required init(coder aDecoder: NSCoder) { let colorArray = aDecoder.decodeObjectForKey("colors") as! [CGFloat] self.CGColor = CGColorCreate(CGColorSpaceCreateDeviceRGB(), colorArray) super.init() } func encodeWithCoder(aCoder: NSCoder) { let colors = CGColorGetComponents(CGColor) let colorBuffer = UnsafeBufferPointer(start: colors, count: 4) let colorArray = [CGFloat](colorBuffer) aCoder.encodeObject(colorArray, forKey: "colors") }