@compatibility_alias
This is a feature of the Objective-C compiler rather than of the runtime, anyway since it is documented nowhere and its existence was forgotten, we are documenting it here.
The keyword @compatibility_alias allows you to define a class name as equivalent to another class name
这是不是运行时的Objective-C编译功能,不过既然是记录的地方和它的存在被遗忘,我们记录在这里。关键词@ compatibility_alias允许你定义一个类的名字等同于另一个类的名字
例子
@compatibility_alias VIEW_CLASS UIView;
VIEW_CLASS 就等同于UIView
本文介绍了Objective-C中一个鲜为人知的功能@compatibility_alias,该关键字允许开发者定义一个类名作为另一个类名的别名。这有助于保持代码向后兼容性,尤其是在更新类名时。文章通过实例说明了如何使用这一特性。

475

被折叠的 条评论
为什么被折叠?



