Post marked as solved
Click to stop watching this thread.
You have stopped watching this post. Click to start watching again.
contentPostList.repliessolved.tooltip
Replied In
CrashReport from Organizer
I have been able to run on ios 12 device there is a custom label but when I run my app on devices on ios 12 it crash with this error NSUnknownKeyException', reason: '[<EFontRegular 0x10999e050> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key boldColor but works fine for ios 13 and above
final class EFontRegular: BaseUILabel {
override var fontType: UIFont? {
return UIFont(name: EFontConstant.Name.regular.rawValue, size: fontSize)
}
}
class BaseUILabel: UILabel {
let lineSpacing: CGFloat = 8
@IBInspectable var fontSize: CGFloat {
return self.font.pointSize
}
@IBInspectable var fontType: UIFont? {
return UIFont(name: EFontConstant.Name.regular.rawValue, size: EFontConstant.Size.regular.rawValue)
}
@IBInspectable var underline: Bool = false {
didSet {
if underline {
self.underline()
}
}
}
@IBInspectable var alignCenter: Bool = false {
didSet {
if alignCenter {
attributedText = text?.lineSpaced(lineSpacing, .center)
}
}
}
@IBInspectable var stringToColor: String = "" {
didSet {
let alignment: NSTextAlignment = alignCenter ? .center : .left
attributedText = text?.lineSpacedWithInlineColor(lineSpacing, alignment, stringToColor: stringToColor)
}
}
@IBInspectable var boldColor: UIColor {
// R.color.primaryLabelColor() ?? UIColor()
traitCollection.userInterfaceStyle == .light ? .black : .white
}
@IBInspectable var stringToBold: String = "" {
didSet {
let alignment: NSTextAlignment = alignCenter ? .center : .left
attributedText = text?.lineSpacedWithInlineColor(lineSpacing, alignment, stringToColor: stringToBold, color: boldColor, bold: true, boldTextSize: fontSize)
}
}
@IBInspectable var characterSpacing: Double = 0 {
didSet {
self.addCharacterSpacing(kernValue: characterSpacing)
}
}
override init(frame: CGRect) {
super.init(frame: frame)
commonInit()
}
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
commonInit()
}
override func prepareForInterfaceBuilder() {
super.prepareForInterfaceBuilder()
commonInit()
}
func commonInit() {
guard let customFont = fontType else {
fatalError("""
Failed to load the "\(String(describing: fontType?.fontName))" font.
Make sure the font file is included in the project and the font name is spelled correctly.
"""
)
}
font = UIFontMetrics.default.scaledFont(for: customFont)
adjustsFontForContentSizeCategory = true
attributedText = text?.lineSpaced(lineSpacing)
}
}