I have a class that is a subclass of NSView. When an instance of this view is clicked, it runs notificationCenter.post(name: .tileClicked, object: tag). However, the tag is always -1. How do I ensure that my subclass has a tag?
CodePudding user response:
The tag property of NSView returns -1. If you want it to return a different value, you must create a subclass of NSView in which you override the property. (This is different from UIView, which has a mutable tag property.)
