Swift - How to call swift function with ENUM parameter from Objective-C? -
Swift - How to call swift function with ENUM parameter from Objective-C? -
this question has reply here:
is possible utilize swift's enum in obj-c? 3 answersi created swift class notification view (uiview) has enum setup type of notification set (i.e. defining colors, text, etc different predetermined types of notifications).
i need able phone call existing objective-c class, whenever set enum in swift function arguments, objective-c can't find specific function (it removed "-swift.h" file.
is possible this?
here swift function:
enum notificationviewtype: int { case custom = 0 case success case error case warning } init(inviewcontroller: uiviewcontroller, fortype: notificationviewtype, duration: float = 0.0, leftbuttonhandler: () -> void, rightbuttonhandler: () -> void) { .... }
i can't find explicitly says swift enumerations not supported in objective-c, quick glance on documentation shows feature of swift quite alien c-style enumerations.
your best bet interoperable enumeration declare first in objective-c , utilize in both languages.
see here in documentation on using c enumerations in swift. find no comparable documentation talking swift enumerations in (objective-)c.
objective-c function swift enums
Comments
Post a Comment