How to use Swift struct in Objective-C

前端 未结 4 798
甜味超标
甜味超标 2020-11-28 21:07

Simply I have a struct that stores the application constants as below:

struct Constant {

    static let ParseApplicationId = \"xxx\"
    static let ParseCli         


        
4条回答
  •  谎友^
    谎友^ (楼主)
    2020-11-28 21:29

    Though this might be late or redundant, I could make it work with the following code :

    @objcMembers class Flags: NSObject {
        static let abcEnabled = false
        static let pqrEnabled = false
        .
        .
        .
    }
    

    Obviously, to use in objc c code, you have to do #import "ProjectModuleName-Swift.h"

提交回复
热议问题