Skip to content

Commit

Permalink
ios: Fix bug in reference arrays (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
mickeyreiss authored Oct 4, 2018
1 parent dcc6585 commit 483da52
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 6 additions & 1 deletion langs/ios/ios.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,12 @@ func toSwiftType(root bool, firetype firemodel.SchemaFieldType) string {
}
case *firemodel.Array:
if firetype.T != nil {
return fmt.Sprintf("[%s]?", toSwiftType(false, firetype.T))
switch firetype.T.(type) {
case *firemodel.Reference:
return fmt.Sprintf("[%s] = .init()", toSwiftType(false, firetype.T))
default:
return fmt.Sprintf("[%s]?", toSwiftType(false, firetype.T))
}
}
return "[Any]"
case *firemodel.File:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ static var testModelId: String = ""
// TODO: Add documentation to models in firemodel schema.
dynamic var models: [TestStruct]?
// TODO: Add documentation to refs in firemodel schema.
dynamic var refs: [Pring.AnyReference]?
dynamic var refs: [Pring.AnyReference] = .init()
// TODO: Add documentation to modelRefs in firemodel schema.
dynamic var modelRefs: [Pring.Reference<TestTimestamps>]?
dynamic var modelRefs: [Pring.Reference<TestTimestamps>] = .init()
// TODO: Add documentation to meta in firemodel schema.
dynamic var meta: [String: Any] = [:]
// TODO: Add documentation to metaStrs in firemodel schema.
Expand Down

0 comments on commit 483da52

Please sign in to comment.