-
Notifications
You must be signed in to change notification settings - Fork 26
/
Colors.swift
42 lines (35 loc) · 1.45 KB
/
Colors.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
//
// Colors.swift
// SwiftColorArt
//
// Created by Jan Gregor Triebel on 29.01.15.
// Copyright (c) 2015 Jan Gregor Triebel. All rights reserved.
//
import Foundation
import UIKit
class Colors: NSObject, NSCoding {
var backgroundColor: UIColor
var primaryColor: UIColor
var secondaryColor: UIColor
var detailColor: UIColor
init(backgroundColor: UIColor, primaryColor: UIColor, secondaryColor: UIColor, detailColor: UIColor) {
self.backgroundColor = backgroundColor
self.primaryColor = primaryColor
self.secondaryColor = secondaryColor
self.detailColor = detailColor
}
// MARK: NSCoding
required convenience init(coder decoder: NSCoder) {
let backgroundColor = decoder.decodeObject(forKey: "backgroundColor") as! UIColor!
let primaryColor = decoder.decodeObject(forKey: "primaryColor") as! UIColor!
let secondaryColor = decoder.decodeObject(forKey: "secondaryColor") as! UIColor!
let detailColor = decoder.decodeObject(forKey: "detailColor") as! UIColor!
self.init(backgroundColor: backgroundColor!, primaryColor: primaryColor!, secondaryColor: secondaryColor!, detailColor: detailColor!);
}
func encode(with coder: NSCoder) {
coder.encode(self.backgroundColor, forKey: "backgroundColor")
coder.encode(self.primaryColor, forKey: "primaryColor")
coder.encode(self.secondaryColor, forKey: "secondaryColor")
coder.encode(self.detailColor, forKey: "detailColor")
}
}