If I understand correctly, the swift button is a custom view.
The ide does not know what a custom view "is", nor what view it mimics... to the idea, the custom view is just a panel.
I would use the tag property of the base panel and use it as a means of getting that type of info.