-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFile.swift
More file actions
35 lines (29 loc) · 869 Bytes
/
File.swift
File metadata and controls
35 lines (29 loc) · 869 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import Foundation
import Firebase
struct NoteItem {
let dbRef: DatabaseReference?
let description : String
var completed : String
init(description : String, completed : String) {
self.dbRef = nil
self.completed = completed
self.description = description
}
init?(snapshot: DataSnapshot){
guard
let value = snapshot.value as? [String: AnyObject],
let description = value["description"] as? String,
let completed = value["completed"] as? String else {
return nil
}
self.dbRef = snapshot.ref
self.completed = completed
self.description = description
}
func toAnyObject() -> Any {
return [
"completed": completed,
"description": description,
]
}
}