Skip to content

Instantly share code, notes, and snippets.

@PreetikaSingh
Last active March 7, 2019 05:32
Show Gist options
  • Save PreetikaSingh/f0a2c5884ac39d0988a4cbd723b7bbd7 to your computer and use it in GitHub Desktop.
Save PreetikaSingh/f0a2c5884ac39d0988a4cbd723b7bbd7 to your computer and use it in GitHub Desktop.
Json Serialization
import Foundation
import SwiftyJSON
class CategoryActivity : NSObject, NSCoding{
var createdAt : String!
var id : String!
var image : String!
var secondCategory : SecondCategory!
var tags : [AnyObject]!
var title : String!
var updatedAt : String!
/**
* Instantiate the instance using the passed json values to set the properties values
*/
init(fromJson json: JSON!){
if json.isEmpty{
return
}
createdAt = json["createdAt"].stringValue
id = json["id"].stringValue
image = json["image"].stringValue
let secondCategoryJson = json["secondCategory"]
if !secondCategoryJson.isEmpty{
secondCategory = SecondCategory(fromJson: secondCategoryJson)
}
tags = [Int]() as [AnyObject]
let tagsArray = json["tags"].arrayValue
for tagsJson in tagsArray{
tags.append(tagsJson as AnyObject)
}
title = json["title"].stringValue
updatedAt = json["updatedAt"].stringValue
}
/**
* Returns all the available property values in the form of [String:Any] object where the key is the approperiate json key and the value is the value of the corresponding property
*/
func toDictionary() -> [String:Any]
{
var dictionary = [String:Any]()
if createdAt != nil{
dictionary["createdAt"] = createdAt
}
if id != nil{
dictionary["id"] = id
}
if image != nil{
dictionary["image"] = image
}
if secondCategory != nil{
dictionary["secondCategory"] = secondCategory.toDictionary()
}
if tags != nil{
dictionary["tags"] = tags
}
if title != nil{
dictionary["title"] = title
}
if updatedAt != nil{
dictionary["updatedAt"] = updatedAt
}
return dictionary
}
/**
* NSCoding required initializer.
* Fills the data from the passed decoder
*/
@objc required init(coder aDecoder: NSCoder)
{
createdAt = aDecoder.decodeObject(forKey: "createdAt") as? String
id = aDecoder.decodeObject(forKey: "id") as? String
image = aDecoder.decodeObject(forKey: "image") as? String
secondCategory = aDecoder.decodeObject(forKey: "secondCategory") as? SecondCategory
tags = aDecoder.decodeObject(forKey: "tags") as? [AnyObject]
title = aDecoder.decodeObject(forKey: "title") as? String
updatedAt = aDecoder.decodeObject(forKey: "updatedAt") as? String
}
/**
* NSCoding required method.
* Encodes mode properties into the decoder
*/
func encode(with aCoder: NSCoder)
{
if createdAt != nil{
aCoder.encode(createdAt, forKey: "createdAt")
}
if id != nil{
aCoder.encode(id, forKey: "id")
}
if image != nil{
aCoder.encode(image, forKey: "image")
}
if secondCategory != nil{
aCoder.encode(secondCategory, forKey: "secondCategory")
}
if tags != nil{
aCoder.encode(tags, forKey: "tags")
}
if title != nil{
aCoder.encode(title, forKey: "title")
}
if updatedAt != nil{
aCoder.encode(updatedAt, forKey: "updatedAt")
}
}
}
import Foundation
import SwiftyJSON
class Cover : NSObject, NSCoding{
var h : Int!
var img : String!
var w : Int!
var x : Int!
var y : Int!
/**
* Instantiate the instance using the passed json values to set the properties values
*/
init(fromJson json: JSON!){
if json.isEmpty{
return
}
h = json["h"].intValue
img = json["img"].stringValue
w = json["w"].intValue
x = json["x"].intValue
y = json["y"].intValue
}
/**
* Returns all the available property values in the form of [String:Any] object where the key is the approperiate json key and the value is the value of the corresponding property
*/
func toDictionary() -> [String:Any]
{
var dictionary = [String:Any]()
if h != nil{
dictionary["h"] = h
}
if img != nil{
dictionary["img"] = img
}
if w != nil{
dictionary["w"] = w
}
if x != nil{
dictionary["x"] = x
}
if y != nil{
dictionary["y"] = y
}
return dictionary
}
/**
* NSCoding required initializer.
* Fills the data from the passed decoder
*/
@objc required init(coder aDecoder: NSCoder)
{
h = aDecoder.decodeObject(forKey: "h") as? Int
img = aDecoder.decodeObject(forKey: "img") as? String
w = aDecoder.decodeObject(forKey: "w") as? Int
x = aDecoder.decodeObject(forKey: "x") as? Int
y = aDecoder.decodeObject(forKey: "y") as? Int
}
/**
* NSCoding required method.
* Encodes mode properties into the decoder
*/
func encode(with aCoder: NSCoder)
{
if h != nil{
aCoder.encode(h, forKey: "h")
}
if img != nil{
aCoder.encode(img, forKey: "img")
}
if w != nil{
aCoder.encode(w, forKey: "w")
}
if x != nil{
aCoder.encode(x, forKey: "x")
}
if y != nil{
aCoder.encode(y, forKey: "y")
}
}
}
import Foundation
import SwiftyJSON
class Creator : NSObject, NSCoding{
var id : String!
var profilepictureurl : Profilepictureurl!
var state : Int!
var username : String!
/**
* Instantiate the instance using the passed json values to set the properties values
*/
init(fromJson json: JSON!){
if json.isEmpty{
return
}
id = json["id"].stringValue
let profilepictureurlJson = json["profilepictureurl"]
if !profilepictureurlJson.isEmpty{
profilepictureurl = Profilepictureurl(fromJson: profilepictureurlJson)
}
state = json["state"].intValue
username = json["username"].stringValue
}
/**
* Returns all the available property values in the form of [String:Any] object where the key is the approperiate json key and the value is the value of the corresponding property
*/
func toDictionary() -> [String:Any]
{
var dictionary = [String:Any]()
if id != nil{
dictionary["id"] = id
}
if profilepictureurl != nil{
dictionary["profilepictureurl"] = profilepictureurl.toDictionary()
}
if state != nil{
dictionary["state"] = state
}
if username != nil{
dictionary["username"] = username
}
return dictionary
}
/**
* NSCoding required initializer.
* Fills the data from the passed decoder
*/
@objc required init(coder aDecoder: NSCoder)
{
id = aDecoder.decodeObject(forKey: "id") as? String
profilepictureurl = aDecoder.decodeObject(forKey: "profilepictureurl") as? Profilepictureurl
state = aDecoder.decodeObject(forKey: "state") as? Int
username = aDecoder.decodeObject(forKey: "username") as? String
}
/**
* NSCoding required method.
* Encodes mode properties into the decoder
*/
func encode(with aCoder: NSCoder)
{
if id != nil{
aCoder.encode(id, forKey: "id")
}
if profilepictureurl != nil{
aCoder.encode(profilepictureurl, forKey: "profilepictureurl")
}
if state != nil{
aCoder.encode(state, forKey: "state")
}
if username != nil{
aCoder.encode(username, forKey: "username")
}
}
}
import Foundation
import SwiftyJSON
class Fri : NSObject, NSCoding{
var enabled : Bool!
var schedule : [ScheduleActivity]!
/**
* Instantiate the instance using the passed json values to set the properties values
*/
init(fromJson json: JSON!){
if json.isEmpty{
return
}
enabled = json["enabled"].boolValue
schedule = [ScheduleActivity]()
let scheduleArray = json["schedule"].arrayValue
for scheduleJson in scheduleArray{
let value = ScheduleActivity(fromJson: scheduleJson)
schedule.append(value)
}
}
/**
* Returns all the available property values in the form of [String:Any] object where the key is the approperiate json key and the value is the value of the corresponding property
*/
func toDictionary() -> [String:Any]
{
var dictionary = [String:Any]()
if enabled != nil{
dictionary["enabled"] = enabled
}
if schedule != nil{
var dictionaryElements = [[String:Any]]()
for scheduleElement in schedule {
dictionaryElements.append(scheduleElement.toDictionary())
}
dictionary["schedule"] = dictionaryElements
}
return dictionary
}
/**
* NSCoding required initializer.
* Fills the data from the passed decoder
*/
@objc required init(coder aDecoder: NSCoder)
{
enabled = aDecoder.decodeObject(forKey: "enabled") as? Bool
schedule = aDecoder.decodeObject(forKey: "schedule") as? [ScheduleActivity]
}
/**
* NSCoding required method.
* Encodes mode properties into the decoder
*/
func encode(with aCoder: NSCoder)
{
if enabled != nil{
aCoder.encode(enabled, forKey: "enabled")
}
if schedule != nil{
aCoder.encode(schedule, forKey: "schedule")
}
}
}
import Foundation
import SwiftyJSON
class HoursOfOperationActivity : NSObject, NSCoding{
var fri : Fri!
var mon : Mon!
var sat : Sat!
var sun : Sun!
var thu : Thu!
var tue : Tue!
var wed : Wed!
/**
* Instantiate the instance using the passed json values to set the properties values
*/
init(fromJson json: JSON!){
if json.isEmpty{
return
}
let friJson = json["fri"]
if !friJson.isEmpty{
fri = Fri(fromJson: friJson)
}
let monJson = json["mon"]
if !monJson.isEmpty{
mon = Mon(fromJson: monJson)
}
let satJson = json["sat"]
if !satJson.isEmpty{
sat = Sat(fromJson: satJson)
}
let sunJson = json["sun"]
if !sunJson.isEmpty{
sun = Sun(fromJson: sunJson)
}
let thuJson = json["thu"]
if !thuJson.isEmpty{
thu = Thu(fromJson: thuJson)
}
let tueJson = json["tue"]
if !tueJson.isEmpty{
tue = Tue(fromJson: tueJson)
}
let wedJson = json["wed"]
if !wedJson.isEmpty{
wed = Wed(fromJson: wedJson)
}
}
/**
* Returns all the available property values in the form of [String:Any] object where the key is the approperiate json key and the value is the value of the corresponding property
*/
func toDictionary() -> [String:Any]
{
var dictionary = [String:Any]()
if fri != nil{
dictionary["fri"] = fri.toDictionary()
}
if mon != nil{
dictionary["mon"] = mon.toDictionary()
}
if sat != nil{
dictionary["sat"] = sat.toDictionary()
}
if sun != nil{
dictionary["sun"] = sun.toDictionary()
}
if thu != nil{
dictionary["thu"] = thu.toDictionary()
}
if tue != nil{
dictionary["tue"] = tue.toDictionary()
}
if wed != nil{
dictionary["wed"] = wed.toDictionary()
}
return dictionary
}
/**
* NSCoding required initializer.
* Fills the data from the passed decoder
*/
@objc required init(coder aDecoder: NSCoder)
{
fri = aDecoder.decodeObject(forKey: "fri") as? Fri
mon = aDecoder.decodeObject(forKey: "mon") as? Mon
sat = aDecoder.decodeObject(forKey: "sat") as? Sat
sun = aDecoder.decodeObject(forKey: "sun") as? Sun
thu = aDecoder.decodeObject(forKey: "thu") as? Thu
tue = aDecoder.decodeObject(forKey: "tue") as? Tue
wed = aDecoder.decodeObject(forKey: "wed") as? Wed
}
/**
* NSCoding required method.
* Encodes mode properties into the decoder
*/
func encode(with aCoder: NSCoder)
{
if fri != nil{
aCoder.encode(fri, forKey: "fri")
}
if mon != nil{
aCoder.encode(mon, forKey: "mon")
}
if sat != nil{
aCoder.encode(sat, forKey: "sat")
}
if sun != nil{
aCoder.encode(sun, forKey: "sun")
}
if thu != nil{
aCoder.encode(thu, forKey: "thu")
}
if tue != nil{
aCoder.encode(tue, forKey: "tue")
}
if wed != nil{
aCoder.encode(wed, forKey: "wed")
}
}
}
import Foundation
import SwiftyJSON
class Image : NSObject, NSCoding{
var attitudeH : Int!
var attitudeW : Int!
var cover : Cover!
var originalH : Int!
var originalW : Int!
var originImg : String!
var preview : Preview!
var value : Float!
/**
* Instantiate the instance using the passed json values to set the properties values
*/
init(fromJson json: JSON!){
if json.isEmpty{
return
}
attitudeH = json["attitudeH"].intValue
attitudeW = json["attitudeW"].intValue
let coverJson = json["cover"]
if !coverJson.isEmpty{
cover = Cover(fromJson: coverJson)
}
originalH = json["originalH"].intValue
originalW = json["originalW"].intValue
originImg = json["originImg"].stringValue
let previewJson = json["preview"]
if !previewJson.isEmpty{
preview = Preview(fromJson: previewJson)
}
value = json["value"].floatValue
}
/**
* Returns all the available property values in the form of [String:Any] object where the key is the approperiate json key and the value is the value of the corresponding property
*/
func toDictionary() -> [String:Any]
{
var dictionary = [String:Any]()
if attitudeH != nil{
dictionary["attitudeH"] = attitudeH
}
if attitudeW != nil{
dictionary["attitudeW"] = attitudeW
}
if cover != nil{
dictionary["cover"] = cover.toDictionary()
}
if originalH != nil{
dictionary["originalH"] = originalH
}
if originalW != nil{
dictionary["originalW"] = originalW
}
if originImg != nil{
dictionary["originImg"] = originImg
}
if preview != nil{
dictionary["preview"] = preview.toDictionary()
}
if value != nil{
dictionary["value"] = value
}
return dictionary
}
/**
* NSCoding required initializer.
* Fills the data from the passed decoder
*/
@objc required init(coder aDecoder: NSCoder)
{
attitudeH = aDecoder.decodeObject(forKey: "attitudeH") as? Int
attitudeW = aDecoder.decodeObject(forKey: "attitudeW") as? Int
cover = aDecoder.decodeObject(forKey: "cover") as? Cover
originalH = aDecoder.decodeObject(forKey: "originalH") as? Int
originalW = aDecoder.decodeObject(forKey: "originalW") as? Int
originImg = aDecoder.decodeObject(forKey: "originImg") as? String
preview = aDecoder.decodeObject(forKey: "preview") as? Preview
value = aDecoder.decodeObject(forKey: "value") as? Float
}
/**
* NSCoding required method.
* Encodes mode properties into the decoder
*/
func encode(with aCoder: NSCoder)
{
if attitudeH != nil{
aCoder.encode(attitudeH, forKey: "attitudeH")
}
if attitudeW != nil{
aCoder.encode(attitudeW, forKey: "attitudeW")
}
if cover != nil{
aCoder.encode(cover, forKey: "cover")
}
if originalH != nil{
aCoder.encode(originalH, forKey: "originalH")
}
if originalW != nil{
aCoder.encode(originalW, forKey: "originalW")
}
if originImg != nil{
aCoder.encode(originImg, forKey: "originImg")
}
if preview != nil{
aCoder.encode(preview, forKey: "preview")
}
if value != nil{
aCoder.encode(value, forKey: "value")
}
}
}
import Foundation
import SwiftyJSON
class LocationActivity : NSObject, NSCoding{
var lat : Float!
var lon : Float!
/**
* Instantiate the instance using the passed json values to set the properties values
*/
init(fromJson json: JSON!){
if json.isEmpty{
return
}
lat = json["lat"].floatValue
lon = json["lon"].floatValue
}
/**
* Returns all the available property values in the form of [String:Any] object where the key is the approperiate json key and the value is the value of the corresponding property
*/
func toDictionary() -> [String:Any]
{
var dictionary = [String:Any]()
if lat != nil{
dictionary["lat"] = lat
}
if lon != nil{
dictionary["lon"] = lon
}
return dictionary
}
/**
* NSCoding required initializer.
* Fills the data from the passed decoder
*/
@objc required init(coder aDecoder: NSCoder)
{
lat = aDecoder.decodeObject(forKey: "lat") as? Float
lon = aDecoder.decodeObject(forKey: "lon") as? Float
}
/**
* NSCoding required method.
* Encodes mode properties into the decoder
*/
func encode(with aCoder: NSCoder)
{
if lat != nil{
aCoder.encode(lat, forKey: "lat")
}
if lon != nil{
aCoder.encode(lon, forKey: "lon")
}
}
}
import Foundation
import SwiftyJSON
class LocationInfoActivity : NSObject, NSCoding{
var address : String!
var city : String!
var country : String!
var email : String!
var formattedAddress : String!
var hoursOfOperation : HoursOfOperationActivity!
var location : LocationActivity!
var locationName : String!
var phone : String!
var reservation : Int!
var stateProvince : String!
var website : String!
/**
* Instantiate the instance using the passed json values to set the properties values
*/
init(fromJson json: JSON!){
if json.isEmpty{
return
}
address = json["address"].stringValue
city = json["city"].stringValue
country = json["country"].stringValue
email = json["email"].stringValue
formattedAddress = json["formatted_address"].stringValue
let hoursOfOperationJson = json["hoursOfOperation"]
if !hoursOfOperationJson.isEmpty{
hoursOfOperation = HoursOfOperationActivity(fromJson: hoursOfOperationJson)
}
let locationJson = json["location"]
if !locationJson.isEmpty{
location = LocationActivity(fromJson: locationJson)
}
locationName = json["locationName"].stringValue
phone = json["phone"].stringValue
reservation = json["reservation"].intValue
stateProvince = json["state_province"].stringValue
website = json["website"].stringValue
}
/**
* Returns all the available property values in the form of [String:Any] object where the key is the approperiate json key and the value is the value of the corresponding property
*/
func toDictionary() -> [String:Any]
{
var dictionary = [String:Any]()
if address != nil{
dictionary["address"] = address
}
if city != nil{
dictionary["city"] = city
}
if country != nil{
dictionary["country"] = country
}
if email != nil{
dictionary["email"] = email
}
if formattedAddress != nil{
dictionary["formatted_address"] = formattedAddress
}
if hoursOfOperation != nil{
dictionary["hoursOfOperation"] = hoursOfOperation.toDictionary()
}
if location != nil{
dictionary["location"] = location.toDictionary()
}
if locationName != nil{
dictionary["locationName"] = locationName
}
if phone != nil{
dictionary["phone"] = phone
}
if reservation != nil{
dictionary["reservation"] = reservation
}
if stateProvince != nil{
dictionary["state_province"] = stateProvince
}
if website != nil{
dictionary["website"] = website
}
return dictionary
}
/**
* NSCoding required initializer.
* Fills the data from the passed decoder
*/
@objc required init(coder aDecoder: NSCoder)
{
address = aDecoder.decodeObject(forKey: "address") as? String
city = aDecoder.decodeObject(forKey: "city") as? String
country = aDecoder.decodeObject(forKey: "country") as? String
email = aDecoder.decodeObject(forKey: "email") as? String
formattedAddress = aDecoder.decodeObject(forKey: "formatted_address") as? String
hoursOfOperation = aDecoder.decodeObject(forKey: "hoursOfOperation") as? HoursOfOperationActivity
location = aDecoder.decodeObject(forKey: "location") as? LocationActivity
locationName = aDecoder.decodeObject(forKey: "locationName") as? String
phone = aDecoder.decodeObject(forKey: "phone") as? String
reservation = aDecoder.decodeObject(forKey: "reservation") as? Int
stateProvince = aDecoder.decodeObject(forKey: "state_province") as? String
website = aDecoder.decodeObject(forKey: "website") as? String
}
/**
* NSCoding required method.
* Encodes mode properties into the decoder
*/
func encode(with aCoder: NSCoder)
{
if address != nil{
aCoder.encode(address, forKey: "address")
}
if city != nil{
aCoder.encode(city, forKey: "city")
}
if country != nil{
aCoder.encode(country, forKey: "country")
}
if email != nil{
aCoder.encode(email, forKey: "email")
}
if formattedAddress != nil{
aCoder.encode(formattedAddress, forKey: "formatted_address")
}
if hoursOfOperation != nil{
aCoder.encode(hoursOfOperation, forKey: "hoursOfOperation")
}
if location != nil{
aCoder.encode(location, forKey: "location")
}
if locationName != nil{
aCoder.encode(locationName, forKey: "locationName")
}
if phone != nil{
aCoder.encode(phone, forKey: "phone")
}
if reservation != nil{
aCoder.encode(reservation, forKey: "reservation")
}
if stateProvince != nil{
aCoder.encode(stateProvince, forKey: "state_province")
}
if website != nil{
aCoder.encode(website, forKey: "website")
}
}
}
import Foundation
import SwiftyJSON
class Metric : NSObject, NSCoding{
var cloned : Int!
var earned : Int!
var played : Int!
var rate : Int!
/**
* Instantiate the instance using the passed json values to set the properties values
*/
init(fromJson json: JSON!){
if json.isEmpty{
return
}
cloned = json["cloned"].intValue
earned = json["earned"].intValue
played = json["played"].intValue
rate = json["rate"].intValue
}
/**
* Returns all the available property values in the form of [String:Any] object where the key is the approperiate json key and the value is the value of the corresponding property
*/
func toDictionary() -> [String:Any]
{
var dictionary = [String:Any]()
if cloned != nil{
dictionary["cloned"] = cloned
}
if earned != nil{
dictionary["earned"] = earned
}
if played != nil{
dictionary["played"] = played
}
if rate != nil{
dictionary["rate"] = rate
}
return dictionary
}
/**
* NSCoding required initializer.
* Fills the data from the passed decoder
*/
@objc required init(coder aDecoder: NSCoder)
{
cloned = aDecoder.decodeObject(forKey: "cloned") as? Int
earned = aDecoder.decodeObject(forKey: "earned") as? Int
played = aDecoder.decodeObject(forKey: "played") as? Int
rate = aDecoder.decodeObject(forKey: "rate") as? Int
}
/**
* NSCoding required method.
* Encodes mode properties into the decoder
*/
func encode(with aCoder: NSCoder)
{
if cloned != nil{
aCoder.encode(cloned, forKey: "cloned")
}
if earned != nil{
aCoder.encode(earned, forKey: "earned")
}
if played != nil{
aCoder.encode(played, forKey: "played")
}
if rate != nil{
aCoder.encode(rate, forKey: "rate")
}
}
}
import Foundation
import SwiftyJSON
class Mon : NSObject, NSCoding{
var enabled : Bool!
var schedule : [ScheduleActivity]!
/**
* Instantiate the instance using the passed json values to set the properties values
*/
init(fromJson json: JSON!){
if json.isEmpty{
return
}
enabled = json["enabled"].boolValue
schedule = [ScheduleActivity]()
let scheduleArray = json["schedule"].arrayValue
for scheduleJson in scheduleArray{
let value = ScheduleActivity(fromJson: scheduleJson)
schedule.append(value)
}
}
/**
* Returns all the available property values in the form of [String:Any] object where the key is the approperiate json key and the value is the value of the corresponding property
*/
func toDictionary() -> [String:Any]
{
var dictionary = [String:Any]()
if enabled != nil{
dictionary["enabled"] = enabled
}
if schedule != nil{
var dictionaryElements = [[String:Any]]()
for scheduleElement in schedule {
dictionaryElements.append(scheduleElement.toDictionary())
}
dictionary["schedule"] = dictionaryElements
}
return dictionary
}
/**
* NSCoding required initializer.
* Fills the data from the passed decoder
*/
@objc required init(coder aDecoder: NSCoder)
{
enabled = aDecoder.decodeObject(forKey: "enabled") as? Bool
schedule = aDecoder.decodeObject(forKey: "schedule") as? [ScheduleActivity]
}
/**
* NSCoding required method.
* Encodes mode properties into the decoder
*/
func encode(with aCoder: NSCoder)
{
if enabled != nil{
aCoder.encode(enabled, forKey: "enabled")
}
if schedule != nil{
aCoder.encode(schedule, forKey: "schedule")
}
}
}
import Foundation
import SwiftyJSON
class Preview : NSObject, NSCoding{
var h : Int!
var img : String!
var w : Int!
var x : Int!
var y : Float!
/**
* Instantiate the instance using the passed json values to set the properties values
*/
init(fromJson json: JSON!){
if json.isEmpty{
return
}
h = json["h"].intValue
img = json["img"].stringValue
w = json["w"].intValue
x = json["x"].intValue
y = json["y"].floatValue
}
/**
* Returns all the available property values in the form of [String:Any] object where the key is the approperiate json key and the value is the value of the corresponding property
*/
func toDictionary() -> [String:Any]
{
var dictionary = [String:Any]()
if h != nil{
dictionary["h"] = h
}
if img != nil{
dictionary["img"] = img
}
if w != nil{
dictionary["w"] = w
}
if x != nil{
dictionary["x"] = x
}
if y != nil{
dictionary["y"] = y
}
return dictionary
}
/**
* NSCoding required initializer.
* Fills the data from the passed decoder
*/
@objc required init(coder aDecoder: NSCoder)
{
h = aDecoder.decodeObject(forKey: "h") as? Int
img = aDecoder.decodeObject(forKey: "img") as? String
w = aDecoder.decodeObject(forKey: "w") as? Int
x = aDecoder.decodeObject(forKey: "x") as? Int
y = aDecoder.decodeObject(forKey: "y") as? Float
}
/**
* NSCoding required method.
* Encodes mode properties into the decoder
*/
func encode(with aCoder: NSCoder)
{
if h != nil{
aCoder.encode(h, forKey: "h")
}
if img != nil{
aCoder.encode(img, forKey: "img")
}
if w != nil{
aCoder.encode(w, forKey: "w")
}
if x != nil{
aCoder.encode(x, forKey: "x")
}
if y != nil{
aCoder.encode(y, forKey: "y")
}
}
}
import Foundation
import SwiftyJSON
class Profilepictureurl : NSObject, NSCoding{
var avatar : String!
var value : Int!
/**
* Instantiate the instance using the passed json values to set the properties values
*/
init(fromJson json: JSON!){
if json.isEmpty{
return
}
avatar = json["avatar"].stringValue
value = json["value"].intValue
}
/**
* Returns all the available property values in the form of [String:Any] object where the key is the approperiate json key and the value is the value of the corresponding property
*/
func toDictionary() -> [String:Any]
{
var dictionary = [String:Any]()
if avatar != nil{
dictionary["avatar"] = avatar
}
if value != nil{
dictionary["value"] = value
}
return dictionary
}
/**
* NSCoding required initializer.
* Fills the data from the passed decoder
*/
@objc required init(coder aDecoder: NSCoder)
{
avatar = aDecoder.decodeObject(forKey: "avatar") as? String
value = aDecoder.decodeObject(forKey: "value") as? Int
}
/**
* NSCoding required method.
* Encodes mode properties into the decoder
*/
func encode(with aCoder: NSCoder)
{
if avatar != nil{
aCoder.encode(avatar, forKey: "avatar")
}
if value != nil{
aCoder.encode(value, forKey: "value")
}
}
}
import Foundation
import SwiftyJSON
class Restriction : NSObject, NSCoding{
var athleticAbility : String!
var five : String!
var four : String!
var free : String!
var noPreference : Bool!
var one : String!
var six : String!
var two : String!
/**
* Instantiate the instance using the passed json values to set the properties values
*/
init(fromJson json: JSON!){
if json.isEmpty{
return
}
athleticAbility = json["athleticAbility"].stringValue
five = json["five"].stringValue
four = json["four"].stringValue
free = json["free"].stringValue
noPreference = json["noPreference"].boolValue
one = json["one"].stringValue
six = json["six"].stringValue
two = json["two"].stringValue
}
/**
* Returns all the available property values in the form of [String:Any] object where the key is the approperiate json key and the value is the value of the corresponding property
*/
func toDictionary() -> [String:Any]
{
var dictionary = [String:Any]()
if athleticAbility != nil{
dictionary["athleticAbility"] = athleticAbility
}
if five != nil{
dictionary["five"] = five
}
if four != nil{
dictionary["four"] = four
}
if free != nil{
dictionary["free"] = free
}
if noPreference != nil{
dictionary["noPreference"] = noPreference
}
if one != nil{
dictionary["one"] = one
}
if six != nil{
dictionary["six"] = six
}
if two != nil{
dictionary["two"] = two
}
return dictionary
}
/**
* NSCoding required initializer.
* Fills the data from the passed decoder
*/
@objc required init(coder aDecoder: NSCoder)
{
athleticAbility = aDecoder.decodeObject(forKey: "athleticAbility") as? String
five = aDecoder.decodeObject(forKey: "five") as? String
four = aDecoder.decodeObject(forKey: "four") as? String
free = aDecoder.decodeObject(forKey: "free") as? String
noPreference = aDecoder.decodeObject(forKey: "noPreference") as? Bool
one = aDecoder.decodeObject(forKey: "one") as? String
six = aDecoder.decodeObject(forKey: "six") as? String
two = aDecoder.decodeObject(forKey: "two") as? String
}
/**
* NSCoding required method.
* Encodes mode properties into the decoder
*/
func encode(with aCoder: NSCoder)
{
if athleticAbility != nil{
aCoder.encode(athleticAbility, forKey: "athleticAbility")
}
if five != nil{
aCoder.encode(five, forKey: "five")
}
if four != nil{
aCoder.encode(four, forKey: "four")
}
if free != nil{
aCoder.encode(free, forKey: "free")
}
if noPreference != nil{
aCoder.encode(noPreference, forKey: "noPreference")
}
if one != nil{
aCoder.encode(one, forKey: "one")
}
if six != nil{
aCoder.encode(six, forKey: "six")
}
if two != nil{
aCoder.encode(two, forKey: "two")
}
}
}
import Foundation
import SwiftyJSON
class RootClass : NSObject, NSCoding{
var score : AnyObject!
var category : CategoryActivity!
var clonedFrom : AnyObject!
var cloner : AnyObject!
var createdAt : String!
var creator : Creator!
var endDate : AnyObject!
var energyLevel : Float!
var id : String!
var image : Image!
var info : String!
var isDeleted : Int!
var locationInfo : LocationInfoActivity!
var metrics : Metric!
var mood : [String]!
var parentId : String!
var reason : String!
var restrictions : Restriction!
var season : SeasonActivity!
var startDate : AnyObject!
var status : Int!
var tags : String!
var timeOfDay : Int!
var title : String!
var typeActivity : Int!
var typicalCostPG : Int!
var typicalCostPP : Int!
var typicalDuration : Int!
var updatedAt : String!
var valid : Int!
var whatToBringWear : WhatToBringWearActivity!
/**
* Instantiate the instance using the passed json values to set the properties values
*/
init(fromJson json: JSON!){
if json.isEmpty{
return
}
score = json["_score"] as AnyObject
let categoryJson = json["category"]
if !categoryJson.isEmpty{
category = CategoryActivity(fromJson: categoryJson)
}
clonedFrom = json["clonedFrom"] as AnyObject
cloner = json["cloner"] as AnyObject
createdAt = json["createdAt"].stringValue
let creatorJson = json["creator"]
if !creatorJson.isEmpty{
creator = Creator(fromJson: creatorJson)
}
endDate = json["endDate"] as AnyObject
energyLevel = json["energyLevel"].floatValue
id = json["id"].stringValue
let imageJson = json["image"]
if !imageJson.isEmpty{
image = Image(fromJson: imageJson)
}
info = json["info"].stringValue
isDeleted = json["isDeleted"].intValue
let locationInfoJson = json["locationInfo"]
if !locationInfoJson.isEmpty{
locationInfo = LocationInfoActivity(fromJson: locationInfoJson)
}
let metricsJson = json["metrics"]
if !metricsJson.isEmpty{
metrics = Metric(fromJson: metricsJson)
}
mood = [String]()
let moodArray = json["mood"].arrayValue
for moodJson in moodArray{
mood.append(moodJson.stringValue)
}
parentId = json["parentId"].stringValue
reason = json["reason"].stringValue
let restrictionsJson = json["restrictions"]
if !restrictionsJson.isEmpty{
restrictions = Restriction(fromJson: restrictionsJson)
}
let seasonJson = json["season"]
if !seasonJson.isEmpty{
season = SeasonActivity(fromJson: seasonJson)
}
startDate = json["startDate"] as AnyObject
status = json["status"].intValue
tags = json["tags"].stringValue
timeOfDay = json["timeOfDay"].intValue
title = json["title"].stringValue
typeActivity = json["typeActivity"].intValue
typicalCostPG = json["typicalCostPG"].intValue
typicalCostPP = json["typicalCostPP"].intValue
typicalDuration = json["typicalDuration"].intValue
updatedAt = json["updatedAt"].stringValue
valid = json["valid"].intValue
let whatToBringWearJson = json["whatToBringWear"]
if !whatToBringWearJson.isEmpty{
whatToBringWear = WhatToBringWearActivity(fromJson: whatToBringWearJson)
}
}
/**
* Returns all the available property values in the form of [String:Any] object where the key is the approperiate json key and the value is the value of the corresponding property
*/
func toDictionary() -> [String:Any]
{
var dictionary = [String:Any]()
if score != nil{
dictionary["_score"] = score
}
if category != nil{
dictionary["category"] = category.toDictionary()
}
if clonedFrom != nil{
dictionary["clonedFrom"] = clonedFrom
}
if cloner != nil{
dictionary["cloner"] = cloner
}
if createdAt != nil{
dictionary["createdAt"] = createdAt
}
if creator != nil{
dictionary["creator"] = creator.toDictionary()
}
if endDate != nil{
dictionary["endDate"] = endDate
}
if energyLevel != nil{
dictionary["energyLevel"] = energyLevel
}
if id != nil{
dictionary["id"] = id
}
if image != nil{
dictionary["image"] = image.toDictionary()
}
if info != nil{
dictionary["info"] = info
}
if isDeleted != nil{
dictionary["isDeleted"] = isDeleted
}
if locationInfo != nil{
dictionary["locationInfo"] = locationInfo.toDictionary()
}
if metrics != nil{
dictionary["metrics"] = metrics.toDictionary()
}
if mood != nil{
dictionary["mood"] = mood
}
if parentId != nil{
dictionary["parentId"] = parentId
}
if reason != nil{
dictionary["reason"] = reason
}
if restrictions != nil{
dictionary["restrictions"] = restrictions.toDictionary()
}
if season != nil{
dictionary["season"] = season.toDictionary()
}
if startDate != nil{
dictionary["startDate"] = startDate
}
if status != nil{
dictionary["status"] = status
}
if tags != nil{
dictionary["tags"] = tags
}
if timeOfDay != nil{
dictionary["timeOfDay"] = timeOfDay
}
if title != nil{
dictionary["title"] = title
}
if typeActivity != nil{
dictionary["typeActivity"] = typeActivity
}
if typicalCostPG != nil{
dictionary["typicalCostPG"] = typicalCostPG
}
if typicalCostPP != nil{
dictionary["typicalCostPP"] = typicalCostPP
}
if typicalDuration != nil{
dictionary["typicalDuration"] = typicalDuration
}
if updatedAt != nil{
dictionary["updatedAt"] = updatedAt
}
if valid != nil{
dictionary["valid"] = valid
}
if whatToBringWear != nil{
dictionary["whatToBringWear"] = whatToBringWear.toDictionary()
}
return dictionary
}
/**
* NSCoding required initializer.
* Fills the data from the passed decoder
*/
@objc required init(coder aDecoder: NSCoder)
{
score = aDecoder.decodeObject(forKey: "_score") as? AnyObject
category = aDecoder.decodeObject(forKey: "category") as? CategoryActivity
clonedFrom = aDecoder.decodeObject(forKey: "clonedFrom") as? AnyObject
cloner = aDecoder.decodeObject(forKey: "cloner") as? AnyObject
createdAt = aDecoder.decodeObject(forKey: "createdAt") as? String
creator = aDecoder.decodeObject(forKey: "creator") as? Creator
endDate = aDecoder.decodeObject(forKey: "endDate") as? AnyObject
energyLevel = aDecoder.decodeObject(forKey: "energyLevel") as? Float
id = aDecoder.decodeObject(forKey: "id") as? String
image = aDecoder.decodeObject(forKey: "image") as? Image
info = aDecoder.decodeObject(forKey: "info") as? String
isDeleted = aDecoder.decodeObject(forKey: "isDeleted") as? Int
locationInfo = aDecoder.decodeObject(forKey: "locationInfo") as? LocationInfoActivity
metrics = aDecoder.decodeObject(forKey: "metrics") as? Metric
mood = aDecoder.decodeObject(forKey: "mood") as? [String]
parentId = aDecoder.decodeObject(forKey: "parentId") as? String
reason = aDecoder.decodeObject(forKey: "reason") as? String
restrictions = aDecoder.decodeObject(forKey: "restrictions") as? Restriction
season = aDecoder.decodeObject(forKey: "season") as? SeasonActivity
startDate = aDecoder.decodeObject(forKey: "startDate") as? AnyObject
status = aDecoder.decodeObject(forKey: "status") as? Int
tags = aDecoder.decodeObject(forKey: "tags") as? String
timeOfDay = aDecoder.decodeObject(forKey: "timeOfDay") as? Int
title = aDecoder.decodeObject(forKey: "title") as? String
typeActivity = aDecoder.decodeObject(forKey: "typeActivity") as? Int
typicalCostPG = aDecoder.decodeObject(forKey: "typicalCostPG") as? Int
typicalCostPP = aDecoder.decodeObject(forKey: "typicalCostPP") as? Int
typicalDuration = aDecoder.decodeObject(forKey: "typicalDuration") as? Int
updatedAt = aDecoder.decodeObject(forKey: "updatedAt") as? String
valid = aDecoder.decodeObject(forKey: "valid") as? Int
whatToBringWear = aDecoder.decodeObject(forKey: "whatToBringWear") as? WhatToBringWearActivity
}
/**
* NSCoding required method.
* Encodes mode properties into the decoder
*/
func encode(with aCoder: NSCoder)
{
if score != nil{
aCoder.encode(score, forKey: "_score")
}
if category != nil{
aCoder.encode(category, forKey: "category")
}
if clonedFrom != nil{
aCoder.encode(clonedFrom, forKey: "clonedFrom")
}
if cloner != nil{
aCoder.encode(cloner, forKey: "cloner")
}
if createdAt != nil{
aCoder.encode(createdAt, forKey: "createdAt")
}
if creator != nil{
aCoder.encode(creator, forKey: "creator")
}
if endDate != nil{
aCoder.encode(endDate, forKey: "endDate")
}
if energyLevel != nil{
aCoder.encode(energyLevel, forKey: "energyLevel")
}
if id != nil{
aCoder.encode(id, forKey: "id")
}
if image != nil{
aCoder.encode(image, forKey: "image")
}
if info != nil{
aCoder.encode(info, forKey: "info")
}
if isDeleted != nil{
aCoder.encode(isDeleted, forKey: "isDeleted")
}
if locationInfo != nil{
aCoder.encode(locationInfo, forKey: "locationInfo")
}
if metrics != nil{
aCoder.encode(metrics, forKey: "metrics")
}
if mood != nil{
aCoder.encode(mood, forKey: "mood")
}
if parentId != nil{
aCoder.encode(parentId, forKey: "parentId")
}
if reason != nil{
aCoder.encode(reason, forKey: "reason")
}
if restrictions != nil{
aCoder.encode(restrictions, forKey: "restrictions")
}
if season != nil{
aCoder.encode(season, forKey: "season")
}
if startDate != nil{
aCoder.encode(startDate, forKey: "startDate")
}
if status != nil{
aCoder.encode(status, forKey: "status")
}
if tags != nil{
aCoder.encode(tags, forKey: "tags")
}
if timeOfDay != nil{
aCoder.encode(timeOfDay, forKey: "timeOfDay")
}
if title != nil{
aCoder.encode(title, forKey: "title")
}
if typeActivity != nil{
aCoder.encode(typeActivity, forKey: "typeActivity")
}
if typicalCostPG != nil{
aCoder.encode(typicalCostPG, forKey: "typicalCostPG")
}
if typicalCostPP != nil{
aCoder.encode(typicalCostPP, forKey: "typicalCostPP")
}
if typicalDuration != nil{
aCoder.encode(typicalDuration, forKey: "typicalDuration")
}
if updatedAt != nil{
aCoder.encode(updatedAt, forKey: "updatedAt")
}
if valid != nil{
aCoder.encode(valid, forKey: "valid")
}
if whatToBringWear != nil{
aCoder.encode(whatToBringWear, forKey: "whatToBringWear")
}
}
}
struct AddActivityToRequest {
let activity: RootClass
let id_dowoodle: String?
}
extension AddActivityToRequest {
func toRequestParameters() -> RequestParameters {
var params = RequestParameters()
if let isDeleted = activity.isDeleted {
params[kKeyIsDeleted] = isDeleted //loc.toRequestDictionary(range: Int(filterOptions.radius)) as AnyObject?
}
if let typicalCostPG = activity.typicalCostPG {
params[kKeyCostFlatPerGroup] = typicalCostPG
}
if let status = activity.status{
params[kKeyStatus] = status
}
if let title = activity.title{
params[kKeyTitle] = title
}
if let creator = activity.creator{
params[kKeyCreator] = creator.toDictionary()//.toRequestDictionary(range: Int(filterOptions.radius)) as AnyObject?
}
if let tags = activity.tags{
params[kKeyTags] = tags
}
if let image = activity.image{
params[kKeyImage] = image.toDictionary()
}
if let whatToBringWear = activity.whatToBringWear{
params[kKeyWhatToBringWear] = whatToBringWear.toDictionary()
}
if let score = activity.score{
params[kKeyScore] = score
}
if let typicalDuration = activity.typicalDuration{
params[kKeyDuration] = typicalDuration
}
if let category = activity.category{
params[kKeyCategory] = category.toDictionary()
}
if let timeOfDay = activity.timeOfDay{
params[kKeyTimeOfDay] = timeOfDay
}
if let createdAt = activity.createdAt{
params[kKeyCreatedAt] = createdAt
}
if let info = activity.info{
params[kKeyDescription] = info
}
if let endDate = activity.endDate{
params[kKeyEndDate] = endDate
}
if let typicalCostPP = activity.typicalCostPP{
params[kKeyCostPerPerson] = typicalCostPP
}
if let id = activity.id{
params[kKeyId] = id
}
if let season = activity.season{
params[kKeySeason] = season.toDictionary()
}
if let restrictions = activity.restrictions{
params[kKeyRestrictions] = restrictions.toDictionary()
}
if let locationInfo = activity.locationInfo{
params[kKeyLocationInfo] = locationInfo.toDictionary()
}
if let mood = activity.mood{
params[kKeyMood] = mood
}
if let typeActivity = activity.typeActivity{
params[kKeyActivityType] = typeActivity
}
if let valid = activity.valid{
params[kKeyValid] = valid
}
if let energyLevel = activity.energyLevel{
params[kKeyEnergyLevel] = energyLevel
}
if let parentId = activity.parentId{
params[kKeyParentId] = parentId
}
if let startDate = activity.startDate{
params[kKeyStartDate] = startDate
}
if let reason = activity.reason{
params["reason"] = reason
}
if let metrics = activity.metrics{
params[kKeyMetrics] = metrics.toDictionary()
}
if let updatedAt = activity.updatedAt{
params[kKeyUpdatedAt] = updatedAt
}
return params
}
}
import Foundation
import SwiftyJSON
class Sat : NSObject, NSCoding{
var enabled : Bool!
var schedule : [ScheduleActivity]!
/**
* Instantiate the instance using the passed json values to set the properties values
*/
init(fromJson json: JSON!){
if json.isEmpty{
return
}
enabled = json["enabled"].boolValue
schedule = [ScheduleActivity]()
let scheduleArray = json["schedule"].arrayValue
for scheduleJson in scheduleArray{
let value = ScheduleActivity(fromJson: scheduleJson)
schedule.append(value)
}
}
/**
* Returns all the available property values in the form of [String:Any] object where the key is the approperiate json key and the value is the value of the corresponding property
*/
func toDictionary() -> [String:Any]
{
var dictionary = [String:Any]()
if enabled != nil{
dictionary["enabled"] = enabled
}
if schedule != nil{
var dictionaryElements = [[String:Any]]()
for scheduleElement in schedule {
dictionaryElements.append(scheduleElement.toDictionary())
}
dictionary["schedule"] = dictionaryElements
}
return dictionary
}
/**
* NSCoding required initializer.
* Fills the data from the passed decoder
*/
@objc required init(coder aDecoder: NSCoder)
{
enabled = aDecoder.decodeObject(forKey: "enabled") as? Bool
schedule = aDecoder.decodeObject(forKey: "schedule") as? [ScheduleActivity]
}
/**
* NSCoding required method.
* Encodes mode properties into the decoder
*/
func encode(with aCoder: NSCoder)
{
if enabled != nil{
aCoder.encode(enabled, forKey: "enabled")
}
if schedule != nil{
aCoder.encode(schedule, forKey: "schedule")
}
}
}
import Foundation
import SwiftyJSON
class ScheduleActivity : NSObject, NSCoding{
var time : Time!
/**
* Instantiate the instance using the passed json values to set the properties values
*/
init(fromJson json: JSON!){
if json.isEmpty{
return
}
let timeJson = json["time"]
if !timeJson.isEmpty{
time = Time(fromJson: timeJson)
}
}
/**
* Returns all the available property values in the form of [String:Any] object where the key is the approperiate json key and the value is the value of the corresponding property
*/
func toDictionary() -> [String:Any]
{
var dictionary = [String:Any]()
if time != nil{
dictionary["time"] = time.toDictionary()
}
return dictionary
}
/**
* NSCoding required initializer.
* Fills the data from the passed decoder
*/
@objc required init(coder aDecoder: NSCoder)
{
time = aDecoder.decodeObject(forKey: "time") as? Time
}
/**
* NSCoding required method.
* Encodes mode properties into the decoder
*/
func encode(with aCoder: NSCoder)
{
if time != nil{
aCoder.encode(time, forKey: "time")
}
}
}
import Foundation
import SwiftyJSON
class SeasonActivity : NSObject, NSCoding{
var fall : Bool!
var spring : Bool!
var summer : Bool!
var winter : Bool!
/**
* Instantiate the instance using the passed json values to set the properties values
*/
init(fromJson json: JSON!){
if json.isEmpty{
return
}
fall = json["fall"].boolValue
spring = json["spring"].boolValue
summer = json["summer"].boolValue
winter = json["winter"].boolValue
}
/**
* Returns all the available property values in the form of [String:Any] object where the key is the approperiate json key and the value is the value of the corresponding property
*/
func toDictionary() -> [String:Any]
{
var dictionary = [String:Any]()
if fall != nil{
dictionary["fall"] = fall
}
if spring != nil{
dictionary["spring"] = spring
}
if summer != nil{
dictionary["summer"] = summer
}
if winter != nil{
dictionary["winter"] = winter
}
return dictionary
}
/**
* NSCoding required initializer.
* Fills the data from the passed decoder
*/
@objc required init(coder aDecoder: NSCoder)
{
fall = aDecoder.decodeObject(forKey: "fall") as? Bool
spring = aDecoder.decodeObject(forKey: "spring") as? Bool
summer = aDecoder.decodeObject(forKey: "summer") as? Bool
winter = aDecoder.decodeObject(forKey: "winter") as? Bool
}
/**
* NSCoding required method.
* Encodes mode properties into the decoder
*/
func encode(with aCoder: NSCoder)
{
if fall != nil{
aCoder.encode(fall, forKey: "fall")
}
if spring != nil{
aCoder.encode(spring, forKey: "spring")
}
if summer != nil{
aCoder.encode(summer, forKey: "summer")
}
if winter != nil{
aCoder.encode(winter, forKey: "winter")
}
}
}
import Foundation
import SwiftyJSON
class SecondCategory : NSObject, NSCoding{
/**
* Instantiate the instance using the passed json values to set the properties values
*/
init(fromJson json: JSON!){
if json.isEmpty{
return
}
}
/**
* Returns all the available property values in the form of [String:Any] object where the key is the approperiate json key and the value is the value of the corresponding property
*/
func toDictionary() -> [String:Any]
{
let dictionary = [String:Any]()
return dictionary
}
/**
* NSCoding required initializer.
* Fills the data from the passed decoder
*/
@objc required init(coder aDecoder: NSCoder)
{
}
/**
* NSCoding required method.
* Encodes mode properties into the decoder
*/
func encode(with aCoder: NSCoder)
{
}
}
import Foundation
import SwiftyJSON
class Sun : NSObject, NSCoding{
var enabled : Bool!
var schedule : [ScheduleActivity]!
/**
* Instantiate the instance using the passed json values to set the properties values
*/
init(fromJson json: JSON!){
if json.isEmpty{
return
}
enabled = json["enabled"].boolValue
schedule = [ScheduleActivity]()
let scheduleArray = json["schedule"].arrayValue
for scheduleJson in scheduleArray{
let value = ScheduleActivity(fromJson: scheduleJson)
schedule.append(value)
}
}
/**
* Returns all the available property values in the form of [String:Any] object where the key is the approperiate json key and the value is the value of the corresponding property
*/
func toDictionary() -> [String:Any]
{
var dictionary = [String:Any]()
if enabled != nil{
dictionary["enabled"] = enabled
}
if schedule != nil{
var dictionaryElements = [[String:Any]]()
for scheduleElement in schedule {
dictionaryElements.append(scheduleElement.toDictionary())
}
dictionary["schedule"] = dictionaryElements
}
return dictionary
}
/**
* NSCoding required initializer.
* Fills the data from the passed decoder
*/
@objc required init(coder aDecoder: NSCoder)
{
enabled = aDecoder.decodeObject(forKey: "enabled") as? Bool
schedule = aDecoder.decodeObject(forKey: "schedule") as? [ScheduleActivity]
}
/**
* NSCoding required method.
* Encodes mode properties into the decoder
*/
func encode(with aCoder: NSCoder)
{
if enabled != nil{
aCoder.encode(enabled, forKey: "enabled")
}
if schedule != nil{
aCoder.encode(schedule, forKey: "schedule")
}
}
}
import Foundation
import SwiftyJSON
class Thu : NSObject, NSCoding{
var enabled : Bool!
var schedule : [ScheduleActivity]!
/**
* Instantiate the instance using the passed json values to set the properties values
*/
init(fromJson json: JSON!){
if json.isEmpty{
return
}
enabled = json["enabled"].boolValue
schedule = [ScheduleActivity]()
let scheduleArray = json["schedule"].arrayValue
for scheduleJson in scheduleArray{
let value = ScheduleActivity(fromJson: scheduleJson)
schedule.append(value)
}
}
/**
* Returns all the available property values in the form of [String:Any] object where the key is the approperiate json key and the value is the value of the corresponding property
*/
func toDictionary() -> [String:Any]
{
var dictionary = [String:Any]()
if enabled != nil{
dictionary["enabled"] = enabled
}
if schedule != nil{
var dictionaryElements = [[String:Any]]()
for scheduleElement in schedule {
dictionaryElements.append(scheduleElement.toDictionary())
}
dictionary["schedule"] = dictionaryElements
}
return dictionary
}
/**
* NSCoding required initializer.
* Fills the data from the passed decoder
*/
@objc required init(coder aDecoder: NSCoder)
{
enabled = aDecoder.decodeObject(forKey: "enabled") as? Bool
schedule = aDecoder.decodeObject(forKey: "schedule") as? [ScheduleActivity]
}
/**
* NSCoding required method.
* Encodes mode properties into the decoder
*/
func encode(with aCoder: NSCoder)
{
if enabled != nil{
aCoder.encode(enabled, forKey: "enabled")
}
if schedule != nil{
aCoder.encode(schedule, forKey: "schedule")
}
}
}
import Foundation
import SwiftyJSON
class Time : NSObject, NSCoding{
var close : Int!
var open : Int!
/**
* Instantiate the instance using the passed json values to set the properties values
*/
init(fromJson json: JSON!){
if json.isEmpty{
return
}
close = json["close"].intValue
open = json["open"].intValue
}
/**
* Returns all the available property values in the form of [String:Any] object where the key is the approperiate json key and the value is the value of the corresponding property
*/
func toDictionary() -> [String:Any]
{
var dictionary = [String:Any]()
if close != nil{
dictionary["close"] = close
}
if open != nil{
dictionary["open"] = open
}
return dictionary
}
/**
* NSCoding required initializer.
* Fills the data from the passed decoder
*/
@objc required init(coder aDecoder: NSCoder)
{
close = aDecoder.decodeObject(forKey: "close") as? Int
open = aDecoder.decodeObject(forKey: "open") as? Int
}
/**
* NSCoding required method.
* Encodes mode properties into the decoder
*/
func encode(with aCoder: NSCoder)
{
if close != nil{
aCoder.encode(close, forKey: "close")
}
if open != nil{
aCoder.encode(open, forKey: "open")
}
}
}
import Foundation
import SwiftyJSON
class Tue : NSObject, NSCoding{
var enabled : Bool!
var schedule : [ScheduleActivity]!
/**
* Instantiate the instance using the passed json values to set the properties values
*/
init(fromJson json: JSON!){
if json.isEmpty{
return
}
enabled = json["enabled"].boolValue
schedule = [ScheduleActivity]()
let scheduleArray = json["schedule"].arrayValue
for scheduleJson in scheduleArray{
let value = ScheduleActivity(fromJson: scheduleJson)
schedule.append(value)
}
}
/**
* Returns all the available property values in the form of [String:Any] object where the key is the approperiate json key and the value is the value of the corresponding property
*/
func toDictionary() -> [String:Any]
{
var dictionary = [String:Any]()
if enabled != nil{
dictionary["enabled"] = enabled
}
if schedule != nil{
var dictionaryElements = [[String:Any]]()
for scheduleElement in schedule {
dictionaryElements.append(scheduleElement.toDictionary())
}
dictionary["schedule"] = dictionaryElements
}
return dictionary
}
/**
* NSCoding required initializer.
* Fills the data from the passed decoder
*/
@objc required init(coder aDecoder: NSCoder)
{
enabled = aDecoder.decodeObject(forKey: "enabled") as? Bool
schedule = aDecoder.decodeObject(forKey: "schedule") as? [ScheduleActivity]
}
/**
* NSCoding required method.
* Encodes mode properties into the decoder
*/
func encode(with aCoder: NSCoder)
{
if enabled != nil{
aCoder.encode(enabled, forKey: "enabled")
}
if schedule != nil{
aCoder.encode(schedule, forKey: "schedule")
}
}
}
import Foundation
import SwiftyJSON
class Wed : NSObject, NSCoding{
var enabled : Bool!
var schedule : [ScheduleActivity]!
/**
* Instantiate the instance using the passed json values to set the properties values
*/
init(fromJson json: JSON!){
if json.isEmpty{
return
}
enabled = json["enabled"].boolValue
schedule = [ScheduleActivity]()
let scheduleArray = json["schedule"].arrayValue
for scheduleJson in scheduleArray{
let value = ScheduleActivity(fromJson: scheduleJson)
schedule.append(value)
}
}
/**
* Returns all the available property values in the form of [String:Any] object where the key is the approperiate json key and the value is the value of the corresponding property
*/
func toDictionary() -> [String:Any]
{
var dictionary = [String:Any]()
if enabled != nil{
dictionary["enabled"] = enabled
}
if schedule != nil{
var dictionaryElements = [[String:Any]]()
for scheduleElement in schedule {
dictionaryElements.append(scheduleElement.toDictionary())
}
dictionary["schedule"] = dictionaryElements
}
return dictionary
}
/**
* NSCoding required initializer.
* Fills the data from the passed decoder
*/
@objc required init(coder aDecoder: NSCoder)
{
enabled = aDecoder.decodeObject(forKey: "enabled") as? Bool
schedule = aDecoder.decodeObject(forKey: "schedule") as? [ScheduleActivity]
}
/**
* NSCoding required method.
* Encodes mode properties into the decoder
*/
func encode(with aCoder: NSCoder)
{
if enabled != nil{
aCoder.encode(enabled, forKey: "enabled")
}
if schedule != nil{
aCoder.encode(schedule, forKey: "schedule")
}
}
}
import Foundation
import SwiftyJSON
class WhatToBringWearActivity : NSObject, NSCoding{
var clothing : String!
var equipment : String!
var food : String!
var footwear : String!
var noPreference : Bool!
var protection : String!
var stuff : String!
/**
* Instantiate the instance using the passed json values to set the properties values
*/
init(fromJson json: JSON!){
if json.isEmpty{
return
}
clothing = json["clothing"].stringValue
equipment = json["equipment"].stringValue
food = json["food"].stringValue
footwear = json["footwear"].stringValue
noPreference = json["noPreference"].boolValue
protection = json["protection"].stringValue
stuff = json["stuff"].stringValue
}
/**
* Returns all the available property values in the form of [String:Any] object where the key is the approperiate json key and the value is the value of the corresponding property
*/
func toDictionary() -> [String:Any]
{
var dictionary = [String:Any]()
if clothing != nil{
dictionary["clothing"] = clothing
}
if equipment != nil{
dictionary["equipment"] = equipment
}
if food != nil{
dictionary["food"] = food
}
if footwear != nil{
dictionary["footwear"] = footwear
}
if noPreference != nil{
dictionary["noPreference"] = noPreference
}
if protection != nil{
dictionary["protection"] = protection
}
if stuff != nil{
dictionary["stuff"] = stuff
}
return dictionary
}
/**
* NSCoding required initializer.
* Fills the data from the passed decoder
*/
@objc required init(coder aDecoder: NSCoder)
{
clothing = aDecoder.decodeObject(forKey: "clothing") as? String
equipment = aDecoder.decodeObject(forKey: "equipment") as? String
food = aDecoder.decodeObject(forKey: "food") as? String
footwear = aDecoder.decodeObject(forKey: "footwear") as? String
noPreference = aDecoder.decodeObject(forKey: "noPreference") as? Bool
protection = aDecoder.decodeObject(forKey: "protection") as? String
stuff = aDecoder.decodeObject(forKey: "stuff") as? String
}
/**
* NSCoding required method.
* Encodes mode properties into the decoder
*/
func encode(with aCoder: NSCoder)
{
if clothing != nil{
aCoder.encode(clothing, forKey: "clothing")
}
if equipment != nil{
aCoder.encode(equipment, forKey: "equipment")
}
if food != nil{
aCoder.encode(food, forKey: "food")
}
if footwear != nil{
aCoder.encode(footwear, forKey: "footwear")
}
if noPreference != nil{
aCoder.encode(noPreference, forKey: "noPreference")
}
if protection != nil{
aCoder.encode(protection, forKey: "protection")
}
if stuff != nil{
aCoder.encode(stuff, forKey: "stuff")
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment