Skip to content

Commit 2e618e7

Browse files
committed
[FIX-10522] Adding nil for the optional parameters in the Swift5 model constructors similar to Swift4.
1 parent 45812fd commit 2e618e7

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/main/resources/handlebars/swift5/modelObject.mustache

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public struct {{classname}}: Codable {
2525
{{/allVars}}
2626

2727
{{#hasVars}}
28-
public init({{#allVars}}{{name}}: {{{datatypeWithEnum}}}{{^required}}?{{/required}}{{#hasMore}}, {{/hasMore}}{{/allVars}}) {
28+
public init({{#allVars}}{{name}}: {{{datatypeWithEnum}}}{{^required}}? = nil{{/required}}{{#hasMore}}, {{/hasMore}}{{/allVars}}) {
2929
{{#allVars}}
3030
self.{{name}} = {{name}}
3131
{{/allVars}}
@@ -84,4 +84,3 @@ public struct {{classname}}: Codable {
8484
{{/vendorExtensions.x-codegen-has-escaped-property-names}}{{/additionalPropertiesType}}
8585

8686
}
87-

0 commit comments

Comments
 (0)