-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUserMessagesModel.swift
executable file
·55 lines (53 loc) · 1.51 KB
/
UserMessagesModel.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
//
// UserMessagesModel.swift
// MVPProject
//
// Created by Pavel Burdukovskii on 27/01/18.
// Copyright © 2018 Pavel Burdukovskii. All rights reserved.
//
import Foundation
class UserMessagesModel : GeneralModel{
var from_id : Int = 0
var to_id : Int = 0
var date: String = ""
var text : String = ""
var is_readed : Int = 0
var images : [String] = Array()
var audio : [String] = Array()
var video : [String] = Array()
var docs : [String] = Array()
internal func loadData (_ dict : [String :AnyObject]) {
if let data = dict["from_id"] {
self.from_id = data as! Int
}
if let data = dict["to_id"] {
self.to_id = data as! Int
}
if let data = dict["date"] {
self.date = data as! String
}
if let data = dict["text"] {
self.text = data as! String
}
if let data = dict["is_readed"] {
self.is_readed = data as! Int
}
if let data = dict["images"] {
self.images = data as! [String]
}
if let data = dict["audio"] {
self.audio = data as! [String]
}
if let data = dict["video"] {
self.video = data as! [String]
}
if let data = dict["docs"] {
self.docs = data as! [String]
}
}
internal func build (_ dict : [String: AnyObject]) ->GeneralModel{
let model = UserMessagesModel()
model.loadData(dict)
return model
}
}