Commit fbe27cce authored by Eyad Hasan's avatar Eyad Hasan
Browse files

Fixing the realm stuff

I wrote the objects wrong, now they're probably correct, they are according to the realm site
parent 3db60418
......@@ -8,49 +8,62 @@ import RealmSwift
final class Facility: CreatableFromJSON {
/// Attempts to configure a new instance of the conforming type with values from a JSON dictionary.
init?(json: [String : Any]) {
<#code#>
}
dynamic var slug: String = ""
dynamic var name: String = ""
dynamic var location: Any?
dynamic var category: Any?
dynamic var tags: Array<Any>
let mainSchedule = List<MainSchedule>()
class Facility: Object {
dynamic var slug = ""
dynamic var facilityName = ""
dynamic var facilityLocation = Locations()
dynamic var category = Categories()
let facilityTags = List<FacilityTags>()
dynamic var mainSchedule = MainSchedule()
}
final class MainSchedule: CreatableFromJSON {
/// Attempts to configure a new instance of the conforming type with values from a JSON dictionary.
init?(json: [String : Any]) {
<#code#>
}
dynamic var id: String = ""
dynamic var openTimes = [OpenTimes]()
class Locations: Object {
dynamic var id = 0
dynamic var created = ""
dynamic var lastmodified = ""
dynamic var building = ""
dynamic var address = ""
dynamic var campus = ""
dynamic var onCampus = false
}
final class OpenTimes: CreatableFromJSON {
/// Attempts to configure a new instance of the conforming type with values from a JSON dictionary.
init?(json: [String : Any]) {
<#code#>
}
class Categories: Object {
dynamic var id = 0
dynamic var created = ""
dynamic var modified = ""
dynamic var categoryName = ""
}
dynamic var schedule: Int
dynamic var modified: String
dynamic var startDay: Int
dynamic var endDay: Int
dynamic var startTime: String
dynamic var endTime: String
class FacilityTags: Object {
dynamic var tags = ""
}
class MainSchedule: Object {
dynamic var id = 0
let openTimes = List<OpenTimes>()
dynamic var lastModified = ""
dynamic var name = ""
dynamic var validStart = ""
dynamic var validEnd = ""
dynamic var twentyFourHours = false
}
class OpenTimes: Object {
dynamic var schedule = 0
dynamic var lastModified = ""
dynamic var startDay = 0
dynamic var endDay = 0
dynamic var startTime = ""
dynamic var endTime = ""
}
/**struct OpenTimes: CreatableFromJSON { // TODO: Rename this struct
......
......@@ -30,7 +30,7 @@ class SRCTNetworkController: NSObject {
let json = try? JSONSerialization.jsonObject(with: dataN, options: [])
if let schedule = json as? [String: Any]{
if let currentSchedule = schedule["main_schedule"] as? Array{
schedules.append(currentSchedule)
schedule.append(currentSchedule)
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment