Skip to content

Commit

Permalink
remove dynamic keyword (#60)
Browse files Browse the repository at this point in the history
* Update gitignore to include .DS_Store

* Remove dynamic keyword from gen'd Swift code as Xcode 10.2 no longer seems to want them on our @objcMembers classes.

* 1 more typo in README

* Update fixtures
  • Loading branch information
danielbdavis authored Mar 27, 2019
1 parent f9482a5 commit 744efe3
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 29 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,7 @@
.idea
.build

vendor/**/
vendor/**/

# OSX
.DS_Store
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

> Type-safe, cross-platform models for [Firestore](https://firebase.google.com/docs/firestore/).
Google's Firestore offering us a fantastic way to add "real time" to your product in need minutes. For simple products, what they provide of the box makes a lot of sense. You get dynamic, reflection-based API wrappers that for in with your existing code.
Google's Firestore offering is a fantastic way to add "real time" to your product in mere minutes. For simple products, what they provide out of the box makes a lot of sense. You get dynamic, reflection-based API wrappers that fit in with your existing code.

This approach breaks down, however, as you start to build against a complex or quickly changing data model, or when multiple developers need to interact with the same schema across multiple codebases.

Expand Down
4 changes: 2 additions & 2 deletions langs/ios/ios.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,15 +272,15 @@ override class var path: String { return "{{firestoreModelName . }}" }
{{- else }}
// TODO: Add documentation to {{.Name | toLowerCamel}} in firemodel schema.
{{- end}}
dynamic var {{.Name | toLowerCamel -}}: {{.Type | toSwiftType true}}
var {{.Name | toLowerCamel -}}: {{.Type | toSwiftType true}}
{{- end}}
{{- range .Collections}}
{{- if .Comment}}
// {{.Comment}}
{{- else }}
// TODO: Add documentation to {{.Name}} in firemodel schema.
{{- end}}
dynamic var {{.Name | toLowerCamel}}: Pring.NestedCollection<{{.Type.Name}}> = []
var {{.Name | toLowerCamel}}: Pring.NestedCollection<{{.Type.Name}}> = []
{{- end}}
{{- if .Fields | requiresCustomEncodeDecode }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,53 +84,53 @@ extension TestEnum: CustomDebugStringConvertible {
@objcMembers class TestModel: Pring.Object {
override class var path: String { return "test_models" }
// The name.
dynamic var name: String?
var name: String?
// The age.
dynamic var age: Int = 0
var age: Int = 0
// The number pi.
dynamic var pi: Float = 0
var pi: Float = 0
// The birth date.
dynamic var birthdate: Date?
var birthdate: Date?
// True if it is good.
dynamic var isGood: Bool = false
var isGood: Bool = false
// TODO: Add documentation to data in firemodel schema.
dynamic var data: Data?
var data: Data?
// TODO: Add documentation to friend in firemodel schema.
dynamic var friend: Pring.Reference<TestModel> = .init()
var friend: Pring.Reference<TestModel> = .init()
// TODO: Add documentation to location in firemodel schema.
dynamic var location: Pring.GeoPoint?
var location: Pring.GeoPoint?
// TODO: Add documentation to colors in firemodel schema.
dynamic var colors: [String]?
var colors: [String]?
// TODO: Add documentation to numbers in firemodel schema.
dynamic var numbers: [Int]?
var numbers: [Int]?
// TODO: Add documentation to bools in firemodel schema.
dynamic var bools: [Bool]?
var bools: [Bool]?
// TODO: Add documentation to doubles in firemodel schema.
dynamic var doubles: [Float]?
var doubles: [Float]?
// TODO: Add documentation to directions in firemodel schema.
dynamic var directions: [TestEnum]?
var directions: [TestEnum]?
// TODO: Add documentation to models in firemodel schema.
dynamic var models: [TestStruct]?
var models: [TestStruct]?
// TODO: Add documentation to models2 in firemodel schema.
dynamic var models2: [TestStruct]?
var models2: [TestStruct]?
// TODO: Add documentation to refs in firemodel schema.
dynamic var refs: [Pring.AnyReference] = .init()
var refs: [Pring.AnyReference] = .init()
// TODO: Add documentation to modelRefs in firemodel schema.
dynamic var modelRefs: [Any] = .init()
var modelRefs: [Any] = .init()
// TODO: Add documentation to meta in firemodel schema.
dynamic var meta: [String: Any] = [:]
var meta: [String: Any] = [:]
// TODO: Add documentation to metaStrs in firemodel schema.
dynamic var metaStrs: [String: String] = [:]
var metaStrs: [String: String] = [:]
// TODO: Add documentation to direction in firemodel schema.
dynamic var direction: TestEnum?
var direction: TestEnum?
// TODO: Add documentation to testFile in firemodel schema.
dynamic var testFile: Pring.File?
var testFile: Pring.File?
// TODO: Add documentation to url in firemodel schema.
dynamic var url: URL?
var url: URL?
// TODO: Add documentation to nested in firemodel schema.
dynamic var nested: TestStruct?
var nested: TestStruct?
// TODO: Add documentation to nested_collection in firemodel schema.
dynamic var nestedCollection: Pring.NestedCollection<TestModel> = []
var nestedCollection: Pring.NestedCollection<TestModel> = []

override func encode(_ key: String, value: Any?) -> Any? {
switch key {
Expand Down Expand Up @@ -185,7 +185,7 @@ override class var path: String { return "timestamps" }
// TODO: Add documentation to Test in firemodel schema.
@objcMembers class Test: Pring.Object {
// TODO: Add documentation to direction in firemodel schema.
dynamic var direction: TestEnum?
var direction: TestEnum?

override func encode(_ key: String, value: Any?) -> Any? {
switch key {
Expand Down

0 comments on commit 744efe3

Please sign in to comment.