ServerModel.swift 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. //
  2. // ServerModel.swift
  3. // Model file Generated using JSONExport: https://github.com/Ahmed-Ali/JSONExport
  4. import Foundation
  5. struct ServerModel{
  6. var ret : Int!
  7. var msg : String!
  8. var data : ServerData!
  9. /**
  10. * Instantiate the instance using the passed dictionary values to set the properties values
  11. */
  12. init(fromDictionary dictionary: NSDictionary){
  13. if let dataData = dictionary["data"] as? NSDictionary{
  14. data = ServerData(fromDictionary: dataData)
  15. }
  16. msg = dictionary["msg"] as? String
  17. ret = dictionary["ret"] as? Int
  18. }
  19. init(){
  20. data = nil
  21. msg = nil
  22. ret = nil
  23. }
  24. /**
  25. * Returns all the available property values in the form of NSDictionary object where the key is the approperiate json key and the value is the value of the corresponding property
  26. */
  27. func toDictionary() -> NSDictionary
  28. {
  29. var dictionary = NSMutableDictionary()
  30. if data != nil{
  31. dictionary["data"] = data.toDictionary()
  32. }
  33. if msg != nil{
  34. dictionary["msg"] = msg
  35. }
  36. if ret != nil{
  37. dictionary["ret"] = ret
  38. }
  39. return dictionary
  40. }
  41. }