{"action":"created","issue":{"url":"https://api.github.com/repos/evermeer/EVCloudKitDao/issues/40","labels_url":"https://api.github.com/repos/evermeer/EVCloudKitDao/issues/40/labels{/name}","comments_url":"https://api.github.com/repos/evermeer/EVCloudKitDao/issues/40/comments","events_url":"https://api.github.com/repos/evermeer/EVCloudKitDao/issues/40/events","html_url":"https://github.com/evermeer/EVCloudKitDao/issues/40","id":123185958,"number":40,"title":"Can a single record type be defined by multiple child classes?","user":{"login":"tbaggett","id":1326678,"avatar_url":"https://avatars.githubusercontent.com/u/1326678?v=3","gravatar_id":"","url":"https://api.github.com/users/tbaggett","html_url":"https://github.com/tbaggett","followers_url":"https://api.github.com/users/tbaggett/followers","following_url":"https://api.github.com/users/tbaggett/following{/other_user}","gists_url":"https://api.github.com/users/tbaggett/gists{/gist_id}","starred_url":"https://api.github.com/users/tbaggett/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tbaggett/subscriptions","organizations_url":"https://api.github.com/users/tbaggett/orgs","repos_url":"https://api.github.com/users/tbaggett/repos","events_url":"https://api.github.com/users/tbaggett/events{/privacy}","received_events_url":"https://api.github.com/users/tbaggett/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/evermeer/EVCloudKitDao/labels/enhancement","name":"enhancement","color":"84b6eb"},{"url":"https://api.github.com/repos/evermeer/EVCloudKitDao/labels/fixed?","name":"fixed?","color":"fbca04"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":34,"created_at":"2015-12-20T22:06:54Z","updated_at":"2016-01-02T06:45:32Z","closed_at":null,"body":"I was hoping to create a single private CKRecord type that contains fields that are defined by multiple child classes. For example, an ApplicationOptions record type that contains all options, but having those options divided up into child classes, like the example below. I thought a way to do this might be to have the child classes inherit from EVObject, like so:\r\n\r\n    public class ApplicationOptions: EVCloudKitDataObject {\r\n        public var audio = AudioOptions()\r\n        public var video = VideoOptions()\r\n        public var playback = PlaybackOptions()\r\n    }\r\n\r\n    public class AudioOptions: EVObject {\r\n        public audioPreferenceOne: Bool = false\r\n    }\r\n\r\n    public class VideoOptions: EVObject {\r\n        public videoPreferenceOne: Bool = false\r\n    }\r\n\r\n    public class PlaybackOptions: EVObject {\r\n        public playbackPreferenceOne: Bool = false\r\n    }\r\n\r\nThe desired result would be an ApplicationOptions CKRecord that contains fields named something like audio_audioPreferenceOne, video_videoPreferenceOne and playback_playbackPreferenceOne. In this case, there will only ever be a single record instance for application options, and it would be overkill imho to also create separate record types for each of the child classes. They are also expected to only result in a single record instance per user.\r\n\r\nWhen I attempt something like the above example, I get this unhandled exception:\r\n\r\n    *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Objects of class __NSDictionaryM cannot be set on CKRecord'\r\n\r\nIs there any way to accomplish this type of thing, or is this beyond the scope of what is supposed to be possible? Thanks..."},"comment":{"url":"https://api.github.com/repos/evermeer/EVCloudKitDao/issues/comments/168368242","html_url":"https://github.com/evermeer/EVCloudKitDao/issues/40#issuecomment-168368242","issue_url":"https://api.github.com/repos/evermeer/EVCloudKitDao/issues/40","id":168368242,"user":{"login":"evermeer","id":130834,"avatar_url":"https://avatars.githubusercontent.com/u/130834?v=3","gravatar_id":"","url":"https://api.github.com/users/evermeer","html_url":"https://github.com/evermeer","followers_url":"https://api.github.com/users/evermeer/followers","following_url":"https://api.github.com/users/evermeer/following{/other_user}","gists_url":"https://api.github.com/users/evermeer/gists{/gist_id}","starred_url":"https://api.github.com/users/evermeer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/evermeer/subscriptions","organizations_url":"https://api.github.com/users/evermeer/orgs","repos_url":"https://api.github.com/users/evermeer/repos","events_url":"https://api.github.com/users/evermeer/events{/privacy}","received_events_url":"https://api.github.com/users/evermeer/received_events","type":"User","site_admin":false},"created_at":"2016-01-02T06:45:32Z","updated_at":"2016-01-02T06:45:32Z","body":"I often use the output window and use one of these commands:\npo myVar\nP myVar\npo \"/(myVar)\"\n\n"}}