关于如何提交 Tips
alfredcc opened this issue · 4 comments
建议统一制作一个类似 swift-evolution 的 proposal 模板。
比如:
提议内容
iOS11 的 UISearchBar 高度改成了56个点,当放在高度为44的NavigationBar上时,和其他BarButtonItem对不齐了,可以override intrinsicContentSize方法改回44
相关链接
https://twitter.com/Alex___0394/status/953301416604442625
https://stackoverflow.com/questions/46318022/uisearchbar-increases-navigation-bar-height-in-ios-11/48283158#48283158
标题
Bool
另一种更加优雅的写法
提议内容
For Bool
variables, it is common to want to toggle the state of the variable. In larger (nested) structs, the duplication involved can become especially annoying:
myVar.prop1.prop2.enabled = !myVar.prop1.prop2.enabled
It's also easy to make a mistake in the code above if there are multiple Bool
vars
代码实现
extension Bool {
mutating func toggle() {
self = !self
}
}
myVar.prop1.prop2.enabled.toggle()
相关链接
https://www.objc.io/blog/2018/01/16/toggle-extension-on-bool/
@alfredcc ,感谢分享哈,提交tip可以直接在微博上发#iOS知识小集#
的话题哈,可以按照你自己的方式,或者参考我们的模板 https://github.com/southpeak/iOS-tech-set/wiki/%E5%BE%AE%E5%8D%9A-%23iOS%E7%9F%A5%E8%AF%86%E5%B0%8F%E9%9B%86%23-%E8%AF%9D%E9%A2%98%E6%A8%A1%E6%9D%BF 哈~~内容方面我们最近在整理RSS,因为每条内容比较短,所以整理成proposal的方式可能不太合适哈
好