How to custom drawing in swift?
Anyone knows how to use swift override +drawRect:withParameters:isCancelled:isRasterizing: or +displayWithParameters:isCancelled: ?
Thanks in advaince
@smalllixin you can override the drawRect as follow:
override class func drawRect(bounds: CGRect, withParameters parameters: NSObjectProtocol!, isCancelled isCancelledBlock: asdisplaynode_iscancelled_block_t, isRasterizing: Bool) {}
In case you have to pass in parameters to your drawRect, because it's a class function, use the following to return an object.
override func drawParametersForAsyncLayer(layer: _ASDisplayLayer) -> NSObjectProtocol? {}
@smalllixin please reopen or ask another question if you have more issues!
@1nput0utput Thank you very much
This seems to be broken in Swift 3. "Method does not override any method from its superclass." Any idea how I can fix this?
@henryeverett refer to #2299