Comments (3)
You have to implement the init method. As an example check out the following code:
import Foundation
import SwiftDDP
class JobDocument : MeteorDocument {
var _id: String?
var type: String?
var data: [String: AnyObject]?
var status: String?
required init(id: String, fields: NSDictionary?) {
super.init(id: id, fields: fields)
self._id = id
}
override func update(fields: NSDictionary?, cleared: [String]?) {
super.update(fields, cleared: cleared)
}
override func setValue(value: AnyObject?, forKey key: String) {
if (key == "type") {
self.type = value as? String
}
if (key == "data") {
self.data = value as? [String: AnyObject]
}
if (key == "status") {
self.status = value as? String
}
}
}
from swiftddp.
That worked flawlessly. Thank you for the quick and thorough reply!
from swiftddp.
Code snipped as follows:
class Person: MeteorDocument{ var collection: String = "people" var userId: String? var name: String? var _id: String? }
When attempting to access _id, nil is always returned even after configuring the subscription to explicitly return _id on Meteor. All other fields are returned properly. When _id is removed from this document, the compiler doesn't tell say that the document is not key-value coding compliant like it would if 'name' was left out, for example.
Any thoughts/suggestions would be much appreciated. Thanks
from swiftddp.
Related Issues (20)
- Keep sending request to server HOT 3
- subscribe observer
- Duplication HOT 1
- outdated CryptoSwift dependency HOT 4
- How to get info user?
- make custom id
- Swift 4 errors HOT 7
- Not able to compile on xcode9.4 with swift 4.1 HOT 1
- [Question] How can I use SwiftDDP in a command line tool? HOT 1
- Cocoapods version of the podspec file IS NOT up to date with the current version on GitHub HOT 2
- Unsupported version requirements in SwiftDDP.podspec HOT 4
- Xcode10/swift4 support HOT 1
- Unencrypted connection (ws://) throws 'SSLHandshake failed' HOT 1
- Unable to build after adding pod for Swift DDP in podfile for Xcode 10.1 and Swift 4.2.
- login meteor server with native facebook sdk in iOS ? HOT 1
- Doesn't build with new xcode HOT 2
- How to receive subscription with message and error log
- Expired Meteor login tokens are not being handled correctly HOT 1
- Ambiguous us of 'init(callback:)' HOT 4
- how To Access Direct Local database. without Creating Collections
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from swiftddp.