Fix warning: Failed to set (lineColor) user defined inspected property on (Project.UnderlinedTextField)

Published

I keep getting this warning:

2020-08-22 17:33:31.484454-0500 bob-app-ios[95799:7064579] 
Failed to set (lineColor) user defined inspected property on 
(projectName.UnderlinedTextField): [<projectName.UnderlinedTextField 0x7fbca5084e00> 
setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key lineColor.

When running my project in a simulator, this is my UnderlinedTextField class:

import UIKit

class UnderlinedTextField: UITextField {
    var isWriting = false
    let bottomLine = CALayer()
    
    func underlined() {
        self.delegate = self
        
        let width = CGFloat(1.0)
        reloadUnderlinedTextField()
        bottomLine.frame = CGRect(x: 0, y: self.frame.size.height - width, width:  self.frame.size.width, height: self.frame.size.height)
        bottomLine.borderWidth = width
        self.layer.addSublayer(bottomLine)
        self.layer.masksToBounds = true
    }
    
    func reloadUnderlinedTextField() {
        bottomLine.borderColor = isWriting ? ColorManager.PrimaryColor?.cgColor : ColorManager.Gray500?.cgColor
    }
}

extension UnderlinedTextField: UITextFieldDelegate {
    func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
        let maxLength = 1
        let currentString: NSString = (textField.text ?? "") as NSString
        let newString: NSString =
            currentString.replacingCharacters(in: range, with: string) as NSString
        return newString.length <= maxLength
    }
    
    func textFieldDidBeginEditing(_ textField: UITextField) {
        isWriting = true
        reloadUnderlinedTextField()
    }
    
    func textFieldDidEndEditing(_ textField: UITextField) {
        isWriting = false
        reloadUnderlinedTextField()
    }
}

Should I worry about it? How could I fix it?

I also get this warning:

2020-08-22 17:33:32.683970-0500 projectName[95799:7064579] Can't find keyplane that supports type 4 
for keyboard iPhone-PortraitChoco-NumberPad; using 25752_PortraitChoco_iPhone-Simple-Pad_Default

My app is not crashing but I feel like those warnings should be taken care of, so, any help might be really appreciated.

Source: Ios Questions

Published
Categorised as ios, swift, uistoryboard, uitextfield

Answers

Leave a Reply

Your email address will not be published. Required fields are marked *

Still Have Questions?


Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us
faq