This repository has been archived by the owner on Oct 31, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
_TestAssociatedEnum.swift
143 lines (117 loc) · 5.28 KB
/
_TestAssociatedEnum.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
//
// AUTO GENERATED FILE
// _TestAssociatedEnum.swift
//
import Foundation
import State
import UIKit
public enum TestAssociatedEnum : Model {
case binaryType (Data)
case booleanType (Bool)
case dateType (Date)
case decimalType (NSDecimalNumber)
case doubleType (Double)
case floatType (Float)
case intType (Int)
case stringType (String)
case transformableColorType (UIColor)
case decodableToManyType ([Employee])
case decodableToOneType (Employee)
}
extension TestAssociatedEnum {
public init?(with source: Store) {
let store = TestAssociatedEnum.migrate(source: source)
guard let type: String = store.value(forKey: "TestAssociatedEnum") else { return nil }
switch type {
case "binaryType":
if let value: Data = store.value(forKey: "value") {
self = TestAssociatedEnum.binaryType(value)
} else { return nil }
case "booleanType":
if let value: Bool = store.value(forKey: "value") {
self = TestAssociatedEnum.booleanType(value)
} else { return nil }
case "dateType":
if let value: Date = store.value(forKey: "value") {
self = TestAssociatedEnum.dateType(value)
} else { return nil }
case "decimalType":
if let value: NSDecimalNumber = store.value(forKey: "value") {
self = TestAssociatedEnum.decimalType(value)
} else { return nil }
case "doubleType":
if let value: Double = store.value(forKey: "value") {
self = TestAssociatedEnum.doubleType(value)
} else { return nil }
case "floatType":
if let value: Float = store.value(forKey: "value") {
self = TestAssociatedEnum.floatType(value)
} else { return nil }
case "intType":
if let value: Int = store.value(forKey: "value") {
self = TestAssociatedEnum.intType(value)
} else { return nil }
case "stringType":
if let value: String = store.value(forKey: "value") {
self = TestAssociatedEnum.stringType(value)
} else { return nil }
case "transformableColorType":
if let value: UIColor = store.value(forKey: "value") {
self = TestAssociatedEnum.transformableColorType(value)
} else { return nil }
case "decodableToManyType":
if let value: [Employee] = store.value(forKey: "value") {
self = TestAssociatedEnum.decodableToManyType(value)
} else { return nil }
case "decodableToOneType":
if let value: Employee = store.value(forKey: "value") {
self = TestAssociatedEnum.decodableToOneType(value)
} else { return nil }
default:
return nil
}
}
// MARK: - Storeable
public static func restore(from store: Store) -> TestAssociatedEnum? {
return self.init(with: store)
}
public func store(to store: inout Store) {
switch self {
case let .binaryType(value):
store.set("binaryType", forKey: "TestAssociatedEnum")
store.set(value, forKey: "value")
case let .booleanType(value):
store.set("booleanType", forKey: "TestAssociatedEnum")
store.set(value, forKey: "value")
case let .dateType(value):
store.set("dateType", forKey: "TestAssociatedEnum")
store.set(value, forKey: "value")
case let .decimalType(value):
store.set("decimalType", forKey: "TestAssociatedEnum")
store.set(value, forKey: "value")
case let .doubleType(value):
store.set("doubleType", forKey: "TestAssociatedEnum")
store.set(value, forKey: "value")
case let .floatType(value):
store.set("floatType", forKey: "TestAssociatedEnum")
store.set(value, forKey: "value")
case let .intType(value):
store.set("intType", forKey: "TestAssociatedEnum")
store.set(value, forKey: "value")
case let .stringType(value):
store.set("stringType", forKey: "TestAssociatedEnum")
store.set(value, forKey: "value")
case let .transformableColorType(value):
store.set("transformableColorType", forKey: "TestAssociatedEnum")
store.set(value, forKey: "value")
case let .decodableToManyType(value):
store.set("decodableToManyType", forKey: "TestAssociatedEnum")
store.set(value, forKey: "value")
case let .decodableToOneType(value):
store.set("decodableToOneType", forKey: "TestAssociatedEnum")
store.set(value, forKey: "value")
}
TestAssociatedEnum.writeVersion(to: &store)
finishWriting(to: &store)
}
}