Other answers are fine, but if someone wants to have a clean structure with error recognition: SnapshotParser
To get a complete working quick view, you need the following code:
func main(){ let devices=SnapshotParser().parseAsList(snap: Snapshot, type: Device.self) } class Device: ParsableSnapshot { var id: String? var field1:String?=nil var field2:String?=nil required init(){} func bindProperties(binder: SnapshotParser.Binder) { binder.bindField(name: "id", field: &id) binder.bindField(name: "field1", field: &field1) binder.bindField(name: "field2", field: &field2) } }
Appyx source share