Tencent / QMUI_iOS

QMUI iOS——致力于提高项目 UI 开发效率的解决方案
http://qmuiteam.com/ios
Other
7.07k stars 1.37k forks source link

建议把一些属性名与系统属性名区分开 #1299

Closed CoderMaurice closed 2 years ago

CoderMaurice commented 2 years ago

例如 QMUIPopupContainerView 里的 image

因为发现在使用swift的时候这些和一些第三方库的extension冲突了 加个前缀啥的就最好了

QMUI YYDS!

MoLice commented 2 years ago

这是你用的库的 extension 的问题,不应该改 QMUI。

CoderMaurice commented 2 years ago

不是很明白你说的逻辑 并不是说哪个库有问题 如果大家都加前缀,就不会有冲突问题了,不是吗

MoLice commented 2 years ago

Extension 应该加前缀,类本身不需要加前缀。你贴的例子是 QMUIPopupContainerView 这个类的,它增加的任何接口都可以随便命名,但如果你讨论的是 UIView(QMUI) 的接口,就必须带上 qmui_ 前缀避免冲突。

现在 Extension 是你的其他库引入的,那么就应该由实现 Extension 的库自己加前缀。

你也不会看到系统定义一个叫“UITableView”的类,它的接口都写上 uikit_ 前缀吧?