swift framework中的方法如何在objective-c中调用呢?
类或属性加@objc public
To access a swift class in objc, that is not inherited from NSObject you need to: @objc public class VeediUtils
A Swift class or protocol must be marked with the @objc attribute to be accessible and usable in Objective-C. This attribute tells the compiler that this piece of Swift code can be accessed from Objective-C. If your Swift class is a descendant of an Objective-C class, the compiler automatically adds the @objc attribute for you.
示例如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
|