-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathinternal_class_template.txt
More file actions
59 lines (44 loc) · 1.4 KB
/
Copy pathinternal_class_template.txt
File metadata and controls
59 lines (44 loc) · 1.4 KB
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
import Foundation{ BASE_CLASS_LIBRARY_IMPORT }
{ TEST_IMPORT }
class _{ CLASSNAME } { BASE_CLASS } {
{ NONOPTIONALS }
{ OPTIONALS }
required init({ REQUIRED_INIT_PARAMS }) {
{ REQUIRED_INIT_SETTERS }
}
convenience init?(_ dictionary: Dictionary<String, AnyObject>) {
let dynamicTypeString = "\(type(of: self))"
let className = dynamicTypeString.components(separatedBy: ".").last
if let valuesDict = JSONModelKit.mapValues(from: dictionary,
forType: className!,
employing: JMInstantiator.sharedInstance,
defaultsEnabled : true)
{{ FAILABLE_INIT_TEMP_NONOPTIONALS }
self.init({ SELF_NONOPTIONALS_INIT })
{ OPTIONALS_UNWRAP }
} else {
return nil
}
}
func updateWithDictionary(dictionary: Dictionary<String, AnyObject>) {
let dynamicTypeString = "\(type(of: self))"
let className = dynamicTypeString.components(separatedBy: ".").last
if let valuesDict = JSONModelKit.mapValues(from: dictionary,
forType: className!,
employing: JMInstantiator.sharedInstance,
defaultsEnabled : false)
{
{ OPTIONALS_UNWRAP }
{ NONOPTIONALS_UNWRAP }
}
}
}
extension _{ CLASSNAME } : CustomDebugStringConvertible {
var debugDescription: String {
var debug_string = "[{ CLASSNAME }]"
{ DEBUG_DESCRIPTION_OPTIONALS }
{ DEBUG_DESCRIPTION_NONOPTIONALS }
debug_string += "\n"
return debug_string
}
}