AsyncDisplayKit: master
Swift 3.0
Xcode: Version 8.0 (8A218a)
Using:
buttonNode.setBackgroundImage(image, for: .normal)
Error:
'normal' is unavailable: use [] to construct an empty option set
You can still get it to work without modifying ASDK by using:
buttonNode.setBackgroundImage(image, for: ASControlState())
While Xcode converts UIControlState's .normal to UIControlState() as well, .normal works just fine.
The reason I'm getting the error is that the generated swift code for ASControlState is:
public struct ASControlState : OptionSet {
public init(rawValue: UInt)
public static var highlighted: ASControlState { get } // used when ASControlNode isHighlighted is set
public static var disabled: ASControlState { get }
public static var selected: ASControlState { get } // used when ASControlNode isSelected is set
public static var reserved: ASControlState { get } // flags reserved for internal framework use
}
There's no normal variable.
I believe it's because ASControlStateNormal has a value of 0, if you change the Objective-C code to:
typedef NS_OPTIONS(NSUInteger, ASControlState) {
ASControlStateNormal = 1 << 0,
ASControlStateHighlighted = 1 << 1, // used when ASControlNode isHighlighted is set
ASControlStateDisabled = 1 << 2,
ASControlStateSelected = 1 << 3, // used when ASControlNode isSelected is set
ASControlStateReserved = 0xFF000000 // flags reserved for internal framework use
};
Then you get the .normal option, but I'm not sure if that's a desired change.
AsyncDisplayKit: master
Swift 3.0
Xcode: Version 8.0 (8A218a)
Using:
buttonNode.setBackgroundImage(image, for: .normal)Error:
'normal' is unavailable: use [] to construct an empty option setYou can still get it to work without modifying ASDK by using:
buttonNode.setBackgroundImage(image, for: ASControlState())While Xcode converts
UIControlState's.normaltoUIControlState()as well,.normalworks just fine.The reason I'm getting the error is that the generated swift code for ASControlState is:
There's no
normalvariable.I believe it's because
ASControlStateNormalhas a value of0, if you change the Objective-C code to:Then you get the
.normaloption, but I'm not sure if that's a desired change.