Transform IUO into `Optional` to prevent errors.
This commit is contained in:
parent
9d6ecf889c
commit
7ad094cf78
|
@ -11,7 +11,7 @@ extension Templates {
|
|||
{% for property in container.properties %}
|
||||
{{ property.accessibility }}{% if container.@type == "ClassDeclaration" %} override{% endif %} var {{ property.name }}: {{ property.type }} {
|
||||
get {
|
||||
return DefaultValueRegistry.defaultValue(for: ({{property.type}}).self)
|
||||
return DefaultValueRegistry.defaultValue(for: ({{property.type|genericSafe}}).self)
|
||||
}
|
||||
{% ifnot property.isReadOnly %}
|
||||
set { }
|
||||
|
|
|
@ -29,14 +29,13 @@ public struct InstanceVariable: Token {
|
|||
}
|
||||
|
||||
public func serialize() -> [String : Any] {
|
||||
let readOnlyString = readOnly ? "ReadOnly" : ""
|
||||
return [
|
||||
"name": name,
|
||||
"type": type,
|
||||
"accessibility": accessibility.sourceName,
|
||||
"isReadOnly": readOnly,
|
||||
"stubType": readOnly ?
|
||||
(overriding ? "ClassToBeStubbedReadOnlyProperty" : "ProtocolToBeStubbedReadOnlyProperty") :
|
||||
(overriding ? "ClassToBeStubbedProperty" : "ProtocolToBeStubbedProperty")
|
||||
"stubType": overriding ? "ClassToBeStubbed\(readOnlyString)Property" : "ProtocolToBeStubbed\(readOnlyString)Property"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue