需要将Objc的枚举:
typedef NS_ENUM(NSInteger, XHBubbleMessageMediaType) { XHBubbleMessageMediaTypeText = 0, XHBubbleMessageMediaTypePhoto = 1, XHBubbleMessageMediaTypeVideo = 2, XHBubbleMessageMediaTypeVoice = 3, XHBubbleMessageMediaTypeEmotion = 4, XHBubbleMessageMediaTypeLocalPosition = 5, };
转换为Swift的版本。
搜:
swift enum
参考:
枚举 | 《The Swift Programming Language》中文版
写成:
enum BubbleMessageType { case Sending case Receiving } enum BubbleMessageMediaType { case Text case Photo case Video case Voice case Emotion case LocalPosition }
即可。
转载请注明:在路上 » [已解决]把ObjC的枚举转换为Swift的语法