how to override UIView.pointInside in swift? -


i'm trying port code obj-c swift, experienced lot of troubles.

one of issues overriding pointinside of uiview class:

class myview : uiview{ func pointinside(point: cgpoint, withevent event: uievent) -> bool {     if point.x < 0 {         return false     } else {         return true      } }} 

if don't add "override", error:

/xxx.swift:37:10: method 'pointinside(_:withevent:)' objective-c selector 'pointinside:withevent:' conflicts method 'pointinside(_:withevent:)' superclass 'uiview' same objective-c selector 

if add "override", error:

/xxx.swift:37:19: method not override method superclass 

according doc, there should pointinside function

https://developer.apple.com/library/ios/documentation/uikit/reference/uiview_class/#//apple_ref/occ/instm/uiview/pointinside:withevent:

the function in uikit declared as

func pointinside(_ point: cgpoint, withevent event: uievent?) -> bool 

the optionality (namely uievent?) needs match.

this error message seems less useful; might want file bug.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -