import Foundation class NotificationModel { var body = "" var senderId = "" var receiverId = "" var notificationId = "" var serviceProviderId = "" var timestamp = 0 var title = "" var date = "" init(notification : [String:Any]) { self.body = notification["body"] as? String ?? "" self.senderId = notification["senderId"] as? String ?? "" self.receiverId = notification["receiverId"] as? String ?? "" self.notificationId = notification["notificationId"] as? String ?? "" self.serviceProviderId = notification["serviceProviderId"] as? String ?? "" self.title = notification["title"] as? String ?? "" self.date = notification["date"] as? String ?? "" self.timestamp = notification["timestamp"] as? Int ?? 0 } }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter