I have created a custom IBDesignable
UISegmentedControl
class.
The class has no build errors but has warnings, it does not update inside of Xcode. There are the warnings, see the screenshot below.
@IBDesignable open class UISegmentedControlBorderless : UISegmentedControl {
@IBInspectable var borderColor:UIColor = UIColor.white {
didSet {
setupUI()
}
}
@IBInspectable var textColor:UIColor = UIColor.white {
didSet {
setupUI()
}
}
@IBInspectable var textSelectedColor:UIColor = UIColor.red {
didSet {
setupUI()
}
}
required public init?(coder aDecoder:NSCoder) {
super.init(coder:aDecoder)
setupUI()
}
override init(frame:CGRect) {
super.init(frame:frame)
setupUI()
}
override open func awakeFromNib() {
super.awakeFromNib()
setupUI()
}
override open func prepareForInterfaceBuilder() {
super.prepareForInterfaceBuilder()
setupUI()
}
fileprivate func setupUI() {
tintColor = borderColor
let attributes = [NSAttributedStringKey.foregroundColor: textColor]
let attributes2 = [NSAttributedStringKey.foregroundColor: textSelectedColor]
setTitleTextAttributes(attributes, for: .normal)
setTitleTextAttributes(attributes2, for: .selected)
}
}
Warnings:
Unticking inherit module