diff --git a/Cartfile b/Cartfile index a766ebc..08a155d 100644 --- a/Cartfile +++ b/Cartfile @@ -6,4 +6,5 @@ github "Anviking/Decodable" "master" github "Hearst-DD/ObjectMapper" ~> 2.2 github "vdka/json" ~> 0.15 github "hkellaway/Gloss" "master" -github "LoganWright/Genome" == 3.0.3 \ No newline at end of file +github "LoganWright/Genome" == 3.0.3 +github "evermeer/EVReflection" "master" diff --git a/Cartfile.resolved b/Cartfile.resolved index 55e78fb..fbfe2c3 100644 --- a/Cartfile.resolved +++ b/Cartfile.resolved @@ -1,9 +1,10 @@ github "Anviking/Decodable" "5cbd5cf2a13376e11f8c8808c437c7e8f9e45e27" +github "evermeer/EVReflection" "a53304c7be4fb59faa6b5ff45e7345b410990022" github "LoganWright/Genome" "3.0.3" github "hkellaway/Gloss" "731d09219477c1765505473af6d5152dc968d778" -github "utahiosmac/Marshal" "5dac3b70996bbba099709528f183512ad01c7f55" +github "utahiosmac/Marshal" "ba0c55e5edfc216aae486229f6f5456ce3db4473" github "Hearst-DD/ObjectMapper" "2.2.0" -github "SwiftyJSON/SwiftyJSON" "6a0c3a82e2b4a07723b4958146315c7928220189" +github "SwiftyJSON/SwiftyJSON" "ffbc7e4b8ee0e9ec76966007e7a7bef659aea284" github "JohnSundell/Unbox" "0be5e80a43b247a10d4a2f08150b847c7e784967" github "vdka/json" "0.15.0" github "lyft/mapper" "8f5b51bee8627eaa162eb42953ef0a6521880041" diff --git a/JSONShootout.xcodeproj/project.pbxproj b/JSONShootout.xcodeproj/project.pbxproj index 2183438..6506e50 100644 --- a/JSONShootout.xcodeproj/project.pbxproj +++ b/JSONShootout.xcodeproj/project.pbxproj @@ -40,6 +40,15 @@ 7C3FCD311DC1B2A100C82DEE /* Program+Gloss.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C3FCD301DC1B2A100C82DEE /* Program+Gloss.swift */; }; 7C3FCD331DC1B2AE00C82DEE /* Recording+Gloss.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C3FCD321DC1B2AE00C82DEE /* Recording+Gloss.swift */; }; 7C3FCD351DC1B61600C82DEE /* Gloss_Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C3FCD341DC1B61600C82DEE /* Gloss_Tests.swift */; }; + 7F53096D1DC7E53300BD0C9B /* EVReflection.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7F53096C1DC7E53300BD0C9B /* EVReflection.framework */; }; + 7F53096F1DC7E56000BD0C9B /* EVReflection.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7F53096E1DC7E56000BD0C9B /* EVReflection.framework */; }; + 7F5309711DC7E58800BD0C9B /* EVReflection.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7F5309701DC7E58800BD0C9B /* EVReflection.framework */; }; + 7F5309721DC7E58800BD0C9B /* EVReflection.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 7F5309701DC7E58800BD0C9B /* EVReflection.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 7F5309741DC7E63900BD0C9B /* RecordingObject.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7F5309731DC7E63900BD0C9B /* RecordingObject.swift */; }; + 7F5309761DC7E65A00BD0C9B /* ProgramObject.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7F5309751DC7E65A00BD0C9B /* ProgramObject.swift */; }; + 7F5309781DC7E66D00BD0C9B /* Recording+EVReflection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7F5309771DC7E66D00BD0C9B /* Recording+EVReflection.swift */; }; + 7F53097A1DC7E67800BD0C9B /* Program+EVReflection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7F5309791DC7E67800BD0C9B /* Program+EVReflection.swift */; }; + 7F53097C1DC7E68A00BD0C9B /* EVReflection_Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7F53097B1DC7E68A00BD0C9B /* EVReflection_Tests.swift */; }; AA2B38CB1DC0B4AE008CECCD /* JSON.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AA2B38CA1DC0B4AE008CECCD /* JSON.framework */; }; AA2B38CC1DC0B4AE008CECCD /* JSON.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = AA2B38CA1DC0B4AE008CECCD /* JSON.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; AA2B38D01DC0B4D2008CECCD /* Program+JSON.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA2B38CD1DC0B4CC008CECCD /* Program+JSON.swift */; }; @@ -111,6 +120,7 @@ CC3023421CF9616600B51746 /* Unbox.framework in Embed Frameworks */, CCFD5B571D0A71990021C2B3 /* SwiftyJSON.framework in Embed Frameworks */, 716A8A9B1DC1D10A00BF314B /* Gloss.framework in Embed Frameworks */, + 7F5309721DC7E58800BD0C9B /* EVReflection.framework in Embed Frameworks */, ); name = "Embed Frameworks"; runOnlyForDeploymentPostprocessing = 0; @@ -122,7 +132,7 @@ 20A0B9561DC2584D001D8A14 /* Recording+Genome.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Recording+Genome.swift"; sourceTree = ""; }; 20A0B9581DC25B60001D8A14 /* Program+Genome.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Program+Genome.swift"; sourceTree = ""; }; 20A0B95A1DC25F03001D8A14 /* Genome_Test.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Genome_Test.swift; sourceTree = ""; }; - 20A0B9691DC26803001D8A14 /* GenomeFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GenomeFoundation.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 20A0B9691DC26803001D8A14 /* GenomeFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = GenomeFoundation.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 5B69A1D91DBEC84200B12579 /* Recording+Decodable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Recording+Decodable.swift"; sourceTree = ""; }; 5B69A1DB1DBEC86A00B12579 /* Program+Decodable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Program+Decodable.swift"; sourceTree = ""; }; 5B69A1DD1DBEC9A400B12579 /* Decodable_Tests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Decodable_Tests.swift; sourceTree = ""; }; @@ -145,6 +155,14 @@ 7C3FCD301DC1B2A100C82DEE /* Program+Gloss.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Program+Gloss.swift"; sourceTree = ""; }; 7C3FCD321DC1B2AE00C82DEE /* Recording+Gloss.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Recording+Gloss.swift"; sourceTree = ""; }; 7C3FCD341DC1B61600C82DEE /* Gloss_Tests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Gloss_Tests.swift; sourceTree = ""; }; + 7F53096C1DC7E53300BD0C9B /* EVReflection.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = EVReflection.framework; path = "Carthage/Checkouts/EVReflection/EVReflection/build/Debug-iphoneos/EVReflection.framework"; sourceTree = ""; }; + 7F53096E1DC7E56000BD0C9B /* EVReflection.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = EVReflection.framework; path = "Carthage/Checkouts/EVReflection/EVReflection/build/Debug-iphoneos/EVReflection.framework"; sourceTree = ""; }; + 7F5309701DC7E58800BD0C9B /* EVReflection.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = EVReflection.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 7F5309731DC7E63900BD0C9B /* RecordingObject.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RecordingObject.swift; sourceTree = ""; }; + 7F5309751DC7E65A00BD0C9B /* ProgramObject.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ProgramObject.swift; sourceTree = ""; }; + 7F5309771DC7E66D00BD0C9B /* Recording+EVReflection.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Recording+EVReflection.swift"; sourceTree = ""; }; + 7F5309791DC7E67800BD0C9B /* Program+EVReflection.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Program+EVReflection.swift"; sourceTree = ""; }; + 7F53097B1DC7E68A00BD0C9B /* EVReflection_Tests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EVReflection_Tests.swift; sourceTree = ""; }; AA2B38CA1DC0B4AE008CECCD /* JSON.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = JSON.framework; sourceTree = BUILT_PRODUCTS_DIR; }; AA2B38CD1DC0B4CC008CECCD /* Program+JSON.swift */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.swift; path = "Program+JSON.swift"; sourceTree = ""; tabWidth = 4; }; AA2B38D11DC0B57F008CECCD /* Recording+JSON.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Recording+JSON.swift"; sourceTree = ""; }; @@ -180,6 +198,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 7F53096F1DC7E56000BD0C9B /* EVReflection.framework in Frameworks */, 20A0B96B1DC26810001D8A14 /* GenomeFoundation.framework in Frameworks */, 2098D54A1DC1F5E800A15075 /* Genome.framework in Frameworks */, 681299051DBFFCAB009960BE /* ObjectMapper.framework in Frameworks */, @@ -190,6 +209,7 @@ AA2B38CB1DC0B4AE008CECCD /* JSON.framework in Frameworks */, CC3023451CF9616700B51746 /* Mapper.framework in Frameworks */, CC9786B31CEBABE7005A5DEA /* ModelObjects.framework in Frameworks */, + 7F5309711DC7E58800BD0C9B /* EVReflection.framework in Frameworks */, CC3023411CF9616600B51746 /* Unbox.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -206,6 +226,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 7F53096D1DC7E53300BD0C9B /* EVReflection.framework in Frameworks */, 2098D54C1DC1F5FB00A15075 /* Genome.framework in Frameworks */, 716A8A9D1DC1D18B00BF314B /* JSON.framework in Frameworks */, 716A8A981DC1D0E900BF314B /* Gloss.framework in Frameworks */, @@ -224,6 +245,8 @@ 7C3FCD281DC1B16100C82DEE /* Frameworks */ = { isa = PBXGroup; children = ( + 7F53096E1DC7E56000BD0C9B /* EVReflection.framework */, + 7F53096C1DC7E53300BD0C9B /* EVReflection.framework */, 2098D5491DC1F5E800A15075 /* Genome.framework */, 7C3FCD2D1DC1B19E00C82DEE /* Gloss.framework */, AA2B38CA1DC0B4AE008CECCD /* JSON.framework */, @@ -243,6 +266,7 @@ CC5A19F51CEADE59007238F3 = { isa = PBXGroup; children = ( + 7F5309701DC7E58800BD0C9B /* EVReflection.framework */, CC5A1A001CEADE59007238F3 /* JSONShootout */, CC5A1A151CEADE59007238F3 /* JSONShootoutTests */, CC97869F1CEBABE7005A5DEA /* ModelObjects */, @@ -286,6 +310,7 @@ 681299171DC00DB1009960BE /* ObjectMapper_Test.swift */, CC3023491CF9692700B51746 /* Unbox_Tests.swift */, AA2B38D31DC0B6D3008CECCD /* JSON_Tests.swift */, + 7F53097B1DC7E68A00BD0C9B /* EVReflection_Tests.swift */, CC5A1A4C1CEAE182007238F3 /* Large.json */, CC5A1A181CEADE59007238F3 /* Info.plist */, ); @@ -298,6 +323,8 @@ CC9786A01CEBABE7005A5DEA /* ModelObjects.h */, CC9786A21CEBABE7005A5DEA /* Info.plist */, CC9786BB1CEBAC14005A5DEA /* Recording.swift */, + 7F5309731DC7E63900BD0C9B /* RecordingObject.swift */, + 7F5309751DC7E65A00BD0C9B /* ProgramObject.swift */, CC9786BD1CEBAC21005A5DEA /* Program.swift */, CC9786BF1CEBAC6C005A5DEA /* NSDate+JSON.swift */, 71337C8A1DBEBC6B00DCA374 /* Recording+Marshal.swift */, @@ -309,6 +336,7 @@ AA2B38D11DC0B57F008CECCD /* Recording+JSON.swift */, 7C3FCD321DC1B2AE00C82DEE /* Recording+Gloss.swift */, 20A0B9561DC2584D001D8A14 /* Recording+Genome.swift */, + 7F5309771DC7E66D00BD0C9B /* Recording+EVReflection.swift */, 71337C921DBEBFB400DCA374 /* Program+Marshal.swift */, 71337C941DBEBFC300DCA374 /* Program+Mapper.swift */, 71337C961DBEBFD000DCA374 /* Program+Unbox.swift */, @@ -318,6 +346,7 @@ AA2B38CD1DC0B4CC008CECCD /* Program+JSON.swift */, 7C3FCD301DC1B2A100C82DEE /* Program+Gloss.swift */, 20A0B9581DC25B60001D8A14 /* Program+Genome.swift */, + 7F5309791DC7E67800BD0C9B /* Program+EVReflection.swift */, ); path = ModelObjects; sourceTree = ""; @@ -485,6 +514,7 @@ AA2B38D41DC0B6D3008CECCD /* JSON_Tests.swift in Sources */, 5B69A1DE1DBEC9A400B12579 /* Decodable_Tests.swift in Sources */, CCD5105B1CFFFF7000E9C0D1 /* SwiftyJSON_Tests.swift in Sources */, + 7F53097C1DC7E68A00BD0C9B /* EVReflection_Tests.swift in Sources */, 7C3FCD351DC1B61600C82DEE /* Gloss_Tests.swift in Sources */, 681299181DC00DB1009960BE /* ObjectMapper_Test.swift in Sources */, ); @@ -496,6 +526,7 @@ files = ( 71337C8F1DBEBC8600DCA374 /* Recording+Unbox.swift in Sources */, 6812991C1DC00DBB009960BE /* Recording+ObjectMapper.swift in Sources */, + 7F5309741DC7E63900BD0C9B /* RecordingObject.swift in Sources */, 71337C971DBEBFD000DCA374 /* Program+Unbox.swift in Sources */, CC9786BE1CEBAC21005A5DEA /* Program.swift in Sources */, 71337C8D1DBEBC7900DCA374 /* Recording+Mapper.swift in Sources */, @@ -506,13 +537,16 @@ 5B69A1DA1DBEC84200B12579 /* Recording+Decodable.swift in Sources */, AA2B38D01DC0B4D2008CECCD /* Program+JSON.swift in Sources */, 7C3FCD311DC1B2A100C82DEE /* Program+Gloss.swift in Sources */, + 7F5309781DC7E66D00BD0C9B /* Recording+EVReflection.swift in Sources */, 5B69A1DC1DBEC86A00B12579 /* Program+Decodable.swift in Sources */, 7C3FCD331DC1B2AE00C82DEE /* Recording+Gloss.swift in Sources */, + 7F5309761DC7E65A00BD0C9B /* ProgramObject.swift in Sources */, AA2B38D21DC0B57F008CECCD /* Recording+JSON.swift in Sources */, 71337C911DBEBCA300DCA374 /* Recording+SwiftyJSON.swift in Sources */, 20A0B9571DC2584D001D8A14 /* Recording+Genome.swift in Sources */, 71337C951DBEBFC300DCA374 /* Program+Mapper.swift in Sources */, 71337C8B1DBEBC6B00DCA374 /* Recording+Marshal.swift in Sources */, + 7F53097A1DC7E67800BD0C9B /* Program+EVReflection.swift in Sources */, 20A0B9591DC25B60001D8A14 /* Program+Genome.swift in Sources */, CC9786BC1CEBAC14005A5DEA /* Recording.swift in Sources */, ); @@ -646,7 +680,10 @@ buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - FRAMEWORK_SEARCH_PATHS = "$(inherited)"; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Carthage/Checkouts/EVReflection/EVReflection/build/Debug-iphoneos", + ); INFOPLIST_FILE = JSONShootout/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "com.swift-bit.JSONShootout"; @@ -660,7 +697,10 @@ buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - FRAMEWORK_SEARCH_PATHS = "$(inherited)"; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Carthage/Checkouts/EVReflection/EVReflection/build/Debug-iphoneos", + ); INFOPLIST_FILE = JSONShootout/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "com.swift-bit.JSONShootout"; @@ -703,7 +743,10 @@ DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; - FRAMEWORK_SEARCH_PATHS = "$(inherited)"; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Carthage/Checkouts/EVReflection/EVReflection/build/Debug-iphoneos", + ); INFOPLIST_FILE = ModelObjects/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; @@ -728,7 +771,10 @@ DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; - FRAMEWORK_SEARCH_PATHS = "$(inherited)"; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Carthage/Checkouts/EVReflection/EVReflection/build/Debug-iphoneos", + ); INFOPLIST_FILE = ModelObjects/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; diff --git a/JSONShootout.xcworkspace/contents.xcworkspacedata b/JSONShootout.xcworkspace/contents.xcworkspacedata index d974545..b927555 100644 --- a/JSONShootout.xcworkspace/contents.xcworkspacedata +++ b/JSONShootout.xcworkspace/contents.xcworkspacedata @@ -31,4 +31,7 @@ + + diff --git a/JSONShootoutTests/EVReflection_Tests.swift b/JSONShootoutTests/EVReflection_Tests.swift new file mode 100644 index 0000000..cd3aa25 --- /dev/null +++ b/JSONShootoutTests/EVReflection_Tests.swift @@ -0,0 +1,37 @@ +// +// EVReflection_Tests.swift +// JSONShootout +// +// Created by Edwin Vermeer on 26/10/2016. +// Copyright © 2016 SwiftBit. All rights reserved. +// + +import XCTest +import ModelObjects +import EVReflection + +class EVReflection_Tests: XCTestCase { + + func testDeserialization() { + self.measure { + let d:NSDictionary = try! JSONSerialization.jsonObject(with: self.data, options: []) as! NSDictionary + XCTAssert(d.count > 0) + } + } + + func testPerformance() { + EVReflection.setBundleIdentifier(ProgramObject.self) + self.measure { + let programs = [ProgramObject](data: self.data, forKeyPath: "ProgramList.Programs") + XCTAssert(programs.count > 1000) + } + } + + + private lazy var data:Data = { + let path = Bundle(for: type(of: self)).url(forResource: "Large", withExtension: "json") + let data = try! Data(contentsOf: path!) + return data + }() + +} diff --git a/ModelObjects/Program+EVReflection.swift b/ModelObjects/Program+EVReflection.swift new file mode 100644 index 0000000..806b5fc --- /dev/null +++ b/ModelObjects/Program+EVReflection.swift @@ -0,0 +1,16 @@ +// +// Program+EVReflection.swift +// JSONShootout +// +// Created by Edwin Vermeer on 26/10/2016. +// Copyright © 2016 SwiftBit. All rights reserved. +// + +import EVReflection + +// If you change the base class of ProgramObject from NSObject to EVObject then you don't need this extension. +extension ProgramObject : EVReflectable { + public override func setValue(_ value: Any?, forUndefinedKey key: String) { + // Easy way to ignore all unknown keys + } +} diff --git a/ModelObjects/ProgramObject.swift b/ModelObjects/ProgramObject.swift new file mode 100644 index 0000000..46d8e9c --- /dev/null +++ b/ModelObjects/ProgramObject.swift @@ -0,0 +1,20 @@ +// +// ProgramObject.swift +// JSONShootout +// +// Created by Edwin Vermeer on 27/10/2016. +// Copyright © 2016 SwiftBit. All rights reserved. +// + +public class ProgramObject: NSObject { + var title:String? + var chanId:String? + // Date parsing is slow. Remove dates to better measure performance. + // let startTime:NSDate + // let endTime:NSDate + var Description:String? + var subtitle:String? + var recording:RecordingObject? + var season:NSNumber? + var episode:NSNumber? +} diff --git a/ModelObjects/Recording+EVReflection.swift b/ModelObjects/Recording+EVReflection.swift new file mode 100644 index 0000000..3a332f4 --- /dev/null +++ b/ModelObjects/Recording+EVReflection.swift @@ -0,0 +1,16 @@ +// +// Recording+EVReflection.swift +// JSONShootout +// +// Created by Edwin Vermeer on 26/10/2016. +// Copyright © 2016 SwiftBit. All rights reserved. +// + +import EVReflection + +// If you change the base class of RecordingObject from NSObject to EVObject then you don't need this extension. +extension RecordingObject: EVReflectable { + public override func setValue(_ value: Any?, forUndefinedKey key: String) { + // Easy way to ignore all unknown keys + } +} diff --git a/ModelObjects/RecordingObject.swift b/ModelObjects/RecordingObject.swift new file mode 100644 index 0000000..9653d80 --- /dev/null +++ b/ModelObjects/RecordingObject.swift @@ -0,0 +1,31 @@ +// +// RecordingObject.swift +// JSONShootout +// +// Created by Edwin Vermeer on 27/10/2016. +// Copyright © 2016 SwiftBit. All rights reserved. +// + +class RecordingObject: NSObject { + enum Status: String { + case None = "0" + case Recorded = "-3" + case Recording = "-2" + case Unknown + } + + enum RecGroup: String { + case Deleted = "Deleted" + case Default = "Default" + case LiveTV = "LiveTV" + case Unknown + } + + // Date parsing is slow. Remove dates to better measure performance. + // var startTs:NSDate? + // var endTs:NSDate? + var startTsStr:String? + var status:Status? + var recordId:String? + var recGroup:RecGroup? +}