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

希望更具有语义化 #4

Open
manondidi opened this issue Dec 27, 2018 · 5 comments
Open

希望更具有语义化 #4

manondidi opened this issue Dec 27, 2018 · 5 comments

Comments

@manondidi
Copy link

.i35("3.5 inches (iPhone 4, 4s)")
.i40("3.5 inches (iPhone 5, 5s, SE)")
.i47("3.5 inches (iPhone 6, 7, 8)")
.i55("3.5 inches (iPhone 6, 7, 8 Plus)")
.ifull("full screen (iPhone X, Xs, XsMax)")
.i58full("5.8 inches (iPhone X, Xs)")
.i61full("6.1 inches (iPhone XR)")
.i65full("6.5 inches (iPhone XsMax)")

希望可以 更具语义化 i40 这种可读性太差

@lixiang1994
Copy link
Owner

考虑到过长的命名可能带来代码风格过于啰嗦, 我也在寻找更简洁明确的命名方式, 您有什么好的建议吗?

@manondidi
Copy link
Author

通常以宽度为准啊
asIphone5Width asIphone6Width asIphone6PWidth asIphoneXWidth
这样会不会更语义化一些呢

@lixiang1994
Copy link
Owner

宽度的API我也有提供的 目前叫做 w320() w375() w414(), 过长的命名会让调用时代码显得非啰嗦, 就像OC的代码 又臭又长, 我现在已经由几个好的idea了 正在尝试, 确定下来后再更新哈.

@manondidi
Copy link
Author

w320() w375() w414() 也是不错的, asIphone5Width配合上代码换行 并不会又臭又长,
写代码可以不写注释,尽量要让代码的可读性增强.

@manondidi
Copy link
Author

这块改善了吗

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