{"action":"created","issue":{"url":"https://api.github.com/repos/C4Framework/C4iOS/issues/574","labels_url":"https://api.github.com/repos/C4Framework/C4iOS/issues/574/labels{/name}","comments_url":"https://api.github.com/repos/C4Framework/C4iOS/issues/574/comments","events_url":"https://api.github.com/repos/C4Framework/C4iOS/issues/574/events","html_url":"https://github.com/C4Framework/C4iOS/issues/574","id":113544673,"number":574,"title":"backgroundColor not setting for C4View","user":{"login":"C4Framework","id":1447498,"avatar_url":"https://avatars.githubusercontent.com/u/1447498?v=3","gravatar_id":"","url":"https://api.github.com/users/C4Framework","html_url":"https://github.com/C4Framework","followers_url":"https://api.github.com/users/C4Framework/followers","following_url":"https://api.github.com/users/C4Framework/following{/other_user}","gists_url":"https://api.github.com/users/C4Framework/gists{/gist_id}","starred_url":"https://api.github.com/users/C4Framework/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/C4Framework/subscriptions","organizations_url":"https://api.github.com/users/C4Framework/orgs","repos_url":"https://api.github.com/users/C4Framework/repos","events_url":"https://api.github.com/users/C4Framework/events{/privacy}","received_events_url":"https://api.github.com/users/C4Framework/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/C4Framework/C4iOS/labels/Bug","name":"Bug","color":"e11d21"},{"url":"https://api.github.com/repos/C4Framework/C4iOS/labels/OSX","name":"OSX","color":"FD147A"}],"state":"closed","locked":false,"assignee":{"login":"C4Framework","id":1447498,"avatar_url":"https://avatars.githubusercontent.com/u/1447498?v=3","gravatar_id":"","url":"https://api.github.com/users/C4Framework","html_url":"https://github.com/C4Framework","followers_url":"https://api.github.com/users/C4Framework/followers","following_url":"https://api.github.com/users/C4Framework/following{/other_user}","gists_url":"https://api.github.com/users/C4Framework/gists{/gist_id}","starred_url":"https://api.github.com/users/C4Framework/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/C4Framework/subscriptions","organizations_url":"https://api.github.com/users/C4Framework/orgs","repos_url":"https://api.github.com/users/C4Framework/repos","events_url":"https://api.github.com/users/C4Framework/events{/privacy}","received_events_url":"https://api.github.com/users/C4Framework/received_events","type":"User","site_admin":false},"milestone":null,"comments":5,"created_at":"2015-10-27T09:46:27Z","updated_at":"2015-10-27T21:56:24Z","closed_at":"2015-10-27T21:56:24Z","body":"This does NOT work:\r\n\r\n```\r\nclass ViewController: C4CanvasController {\r\n    override func setup() {\r\n        canvas.backgroundColor = C4Blue\r\n    }\r\n}\r\n```\r\n\r\nThis DOES work:\r\n\r\n```\r\nclass ViewController: C4CanvasController {\r\n    override func setup() {\r\n        canvas.view.layer?.backgroundColor = C4Blue.CGColor\r\n    }\r\n}\r\n```\r\n\r\nI've traced the error to C4View's `backgroundColor` property:\r\n\r\n<img width=\"798\" alt=\"screen shot 2015-10-27 at 2 40 51 am\" src=\"https://cloud.githubusercontent.com/assets/1447498/10754406/9af6e3a0-7c54-11e5-9978-e48391ab098a.png\">\r\n\r\nSpecifically, I think the error is in ` if let layerView = view as? LayerView`. \r\n\r\nIn the following code `lv` returns as a `NativeView` not a `LayerView`, so the statement returns false and the setting of the backgroundColor never executes:\r\n\r\n```\r\nset {\r\n    let lv = view\r\n    if let layerView = view as? LayerView {\r\n        if let color = newValue {\r\n            layerView.backgroundColor = NativeColor(color)\r\n        } else {\r\n            layerView.backgroundColor = nil\r\n        }\r\n    }\r\n}\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/C4Framework/C4iOS/issues/comments/151657385","html_url":"https://github.com/C4Framework/C4iOS/issues/574#issuecomment-151657385","issue_url":"https://api.github.com/repos/C4Framework/C4iOS/issues/574","id":151657385,"user":{"login":"C4Framework","id":1447498,"avatar_url":"https://avatars.githubusercontent.com/u/1447498?v=3","gravatar_id":"","url":"https://api.github.com/users/C4Framework","html_url":"https://github.com/C4Framework","followers_url":"https://api.github.com/users/C4Framework/followers","following_url":"https://api.github.com/users/C4Framework/following{/other_user}","gists_url":"https://api.github.com/users/C4Framework/gists{/gist_id}","starred_url":"https://api.github.com/users/C4Framework/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/C4Framework/subscriptions","organizations_url":"https://api.github.com/users/C4Framework/orgs","repos_url":"https://api.github.com/users/C4Framework/repos","events_url":"https://api.github.com/users/C4Framework/events{/privacy}","received_events_url":"https://api.github.com/users/C4Framework/received_events","type":"User","site_admin":false},"created_at":"2015-10-27T21:56:24Z","updated_at":"2015-10-27T21:56:24Z","body":"This is an Interface Builder issue. When you create a new OSX project and embed C4, you need to also change the Main.Storyboard's view from NSView to LayerView.\r\n\r\n![screen shot 2015-10-27 at 2 54 58 pm](https://cloud.githubusercontent.com/assets/1447498/10773816/df4b0886-7cba-11e5-8947-07c148fbdb32.png)\r\n"}}