[英]How to write this code in swift 3.0, specially how to use Macro in swift3?
How to write this code in swift 3.0? 如何在Swift 3.0中编写此代码?
NSSTring *countString=[NSString stringWithFormat:@"%d %@",count,EDIT_CHAR];
where, EDIT_CHAR is a Macro & count is integer. 其中, EDIT_CHAR是宏,而count是整数。
Swift haven't a preprocessor, but you can create a structure with all you constants or flags. Swift还没有预处理器,但是您可以使用所有常量或标志创建一个结构。
struct MyAppConstants {
static let editChar = "f"
// Etc...
}
You can call it as MyAppConstants.editChar
您可以将其称为
MyAppConstants.editChar
You question is tagged swift but the code you've posted is ObjC. 您的问题被标记为swift,但您发布的代码是ObjC。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.