{"action":"created","issue":{"url":"https://api.github.com/repos/facebook/AsyncDisplayKit/issues/2278","repository_url":"https://api.github.com/repos/facebook/AsyncDisplayKit","labels_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/issues/2278/labels{/name}","comments_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/issues/2278/comments","events_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/issues/2278/events","html_url":"https://github.com/facebook/AsyncDisplayKit/issues/2278","id":178870999,"number":2278,"title":"[ASControlNode] ASControlStateNormal disappears in Swift 3.0","user":{"login":"george-gw","id":13870100,"avatar_url":"https://avatars.githubusercontent.com/u/13870100?v=3","gravatar_id":"","url":"https://api.github.com/users/george-gw","html_url":"https://github.com/george-gw","followers_url":"https://api.github.com/users/george-gw/followers","following_url":"https://api.github.com/users/george-gw/following{/other_user}","gists_url":"https://api.github.com/users/george-gw/gists{/gist_id}","starred_url":"https://api.github.com/users/george-gw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/george-gw/subscriptions","organizations_url":"https://api.github.com/users/george-gw/orgs","repos_url":"https://api.github.com/users/george-gw/repos","events_url":"https://api.github.com/users/george-gw/events{/privacy}","received_events_url":"https://api.github.com/users/george-gw/received_events","type":"User","site_admin":false},"labels":[{"id":320152589,"url":"https://api.github.com/repos/facebook/AsyncDisplayKit/labels/Swift","name":"Swift","color":"fe6420","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-09-23T13:01:15Z","updated_at":"2016-11-09T11:24:06Z","closed_at":null,"body":"AsyncDisplayKit: master\nSwift 3.0\nXcode: Version 8.0 (8A218a)\n\nUsing:\n`buttonNode.setBackgroundImage(image, for: .normal)`\nError:\n`'normal' is unavailable: use [] to construct an empty option set`\n\nYou can still get it to work without modifying ASDK by using:\n`buttonNode.setBackgroundImage(image, for: ASControlState())`\n\nWhile Xcode converts `UIControlState`'s `.normal` to `UIControlState()` as well, `.normal` works just fine.\n\nThe reason I'm getting the error is that the generated swift code for ASControlState is:\n\n```\npublic struct ASControlState : OptionSet {\n\n    public init(rawValue: UInt)\n\n\n    public static var highlighted: ASControlState { get } // used when ASControlNode isHighlighted is set\n\n    public static var disabled: ASControlState { get }\n\n    public static var selected: ASControlState { get } // used when ASControlNode isSelected is set\n\n    public static var reserved: ASControlState { get } // flags reserved for internal framework use\n}\n```\n\nThere's no `normal` variable.\nI believe it's because `ASControlStateNormal` has a value of `0`, if you change the Objective-C code to:\n\n```\ntypedef NS_OPTIONS(NSUInteger, ASControlState) {\n    ASControlStateNormal       = 1 << 0,\n    ASControlStateHighlighted  = 1 << 1,                  // used when ASControlNode isHighlighted is set\n    ASControlStateDisabled     = 1 << 2,\n    ASControlStateSelected     = 1 << 3,                  // used when ASControlNode isSelected is set\n    ASControlStateReserved     = 0xFF000000               // flags reserved for internal framework use\n};\n```\n\nThen you get the `.normal` option, but I'm not sure if that's a desired change.\n"},"comment":{"url":"https://api.github.com/repos/facebook/AsyncDisplayKit/issues/comments/259392357","html_url":"https://github.com/facebook/AsyncDisplayKit/issues/2278#issuecomment-259392357","issue_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/issues/2278","id":259392357,"user":{"login":"DeOk","id":1751176,"avatar_url":"https://avatars.githubusercontent.com/u/1751176?v=3","gravatar_id":"","url":"https://api.github.com/users/DeOk","html_url":"https://github.com/DeOk","followers_url":"https://api.github.com/users/DeOk/followers","following_url":"https://api.github.com/users/DeOk/following{/other_user}","gists_url":"https://api.github.com/users/DeOk/gists{/gist_id}","starred_url":"https://api.github.com/users/DeOk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DeOk/subscriptions","organizations_url":"https://api.github.com/users/DeOk/orgs","repos_url":"https://api.github.com/users/DeOk/repos","events_url":"https://api.github.com/users/DeOk/events{/privacy}","received_events_url":"https://api.github.com/users/DeOk/received_events","type":"User","site_admin":false},"created_at":"2016-11-09T11:24:06Z","updated_at":"2016-11-09T11:24:06Z","body":"I know I am posting very late but here is another workaround\r\n\r\nAdd UILable in ASButtonNode if you have same text for normal , highlight or for any state like\r\n\r\n`ASButtonNode(viewBlock: { () -> UIView in\r\n            let lblTitle:UILabel = UILabel()\r\n            lblTitle.text=\"Submit\"\r\n            lblTitle.textColor = Color.white\r\n            lblTitle.font = // define your font\r\n\r\n// make label alignment center \r\n\r\n            return lblTitle\r\n        })`\r\n"}}
{"actor":{"display_login":"DeOk"}}