OC调用Swift的set方法,调用Bool的set方法报错 Property cannot be marked @objc because its type cannot be represented in Objective-C
swift中的写法
//set传值
@objc var titleString:String? {
willSet{
}
didSet{
//处理逻辑
}
}
//set
@objc var collectState:Bool = false { //此处一定要给初始值
willSet{
}
didSet{
//处理逻辑
}
}
如果不给定初始值的话会报错,
Property cannot be marked @objc because its type cannot be represented in Objective-C
oc中调用
self.XXX.titleString = @"测试数据";
self.XXX.collectState = true;
记录下来用于提醒自己,如有错误望指正。