Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何在 swift 3.0 中编写此代码?
NSSTring *countString=[NSString stringWithFormat:@"%d %@",count,EDIT_CHAR];
其中,EDIT_CHAR是一个宏,计数是整数。
Swift 没有预处理器,但您可以创建一个包含所有常量或标志的结构。
struct MyAppConstants { static let editChar = "f" // Etc... }
您可以调用它,因为MyAppConstants.editChar 您的问题被标记为 swift,但您发布的代码是 ObjC。
MyAppConstants.editChar