QSBaseView
视图控件基类
使用方法:直接用 Pod 导入,pod 'QSBaseView'
在项目开发中,经常会自定义视图控件,一般都会重写系统的 initWithFrame 方法,但在 Swift 中,重写 init 方法,都必须重写
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
为了不每次都重写上述方法,为几个常用的控件写了基类,以后自定义控件时,只需继承对应的基类,然后直接重写 qs_setupSubViews 和 qs_bind 方法即可,这两个方法都会在 initWithFrame 方法中调用
protocol QSBaseViewProtocol {
/// 设置界面
func qs_setupSubViews()
/// 用于数据绑定
func qs_binding()
}
版本更新
2.0.0 版本之后需要使用 iOS11 才能使用,如果需要支持 iOS11 之前版本,可使用 2.0.0 之前版本