Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Runtime 第七题:Category 和 Extension 有什么区别 #31

Open
Brances opened this issue Dec 24, 2020 · 2 comments
Open

Runtime 第七题:Category 和 Extension 有什么区别 #31

Brances opened this issue Dec 24, 2020 · 2 comments

Comments

@Brances
Copy link

Brances commented Dec 24, 2020

--类拓展 不能给系统的类添加方法
这里是不是描述错了,应该是可以给系统类添加方法的吧?
@liberalisman

@x554960766
Copy link

Extension一般用来隐藏类的私有消息,你必须有一个类的源码才能添加一个类的Extension,所以对于系统一些类,如NSString,就无法添加类扩展

@Brances
Copy link
Author

Brances commented Jul 28, 2021

@xluoyeyoushang 是的,我弄错了,应该是category可以添加方法

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants