-
Notifications
You must be signed in to change notification settings - Fork 0
/
Game.swift
40 lines (31 loc) · 927 Bytes
/
Game.swift
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
36
37
38
39
40
//
// Game.swift
// Game Theory App 2
//
// Created by Richard Poutier on 2/19/17.
// Copyright © 2017 Richard Poutier. All rights reserved.
//
import Foundation
import Firebase
class Game {
var key: String
var gameName: String?
var gameType: String?
var gameStatus: String?
var ref: FIRDatabaseReference?
init( _name: String?, _type: String?, _status: String?, _key: String = "") {
self.key = _key
self.gameName = _name
self.gameType = _type
self.gameStatus = _status
self.ref = nil
}
init(snapshot: FIRDataSnapshot) {
key = snapshot.key
let snapshotValue = snapshot.value as! [String: AnyObject]
gameName = snapshotValue["gameName"] as? String
gameType = snapshotValue["type"] as? String
gameStatus = snapshotValue["status"] as? String
ref = snapshot.ref
}
}