#ios #swift #swift3
#iOS #swift #swift3
Вопрос:
Я получаю «Метод не переопределяет какой-либо метод из своего суперкласса» для функции is first responder. Я посмотрел это в Интернете, и решения нет. не могли бы вы, пожалуйста, помочь мне исправить это. Вот код.
public override func isFirstResponder() -> Bool {
// Return true if any of `self`'s subviews is the current first responder.
// Needs to unwrap the IBOutlets otherwise IBInspectable is crashing when using CardTextField because IBOutlets
// are not initialized yet when IBInspectable engine runs.
guard let numberInputTextField = numberInputTextField, let monthTextField = monthTextField, let yearTextField = yearTextField, let cvcTextField = cvcTextField else {
return false
}
return [numberInputTextField, monthTextField, yearTextField, cvcTextField]
.filter({$0.isFirstResponder})
.isEmpty == false
}
Вот изображение ошибки
Ответ №1:
Попробуйте заменить это:
public override func isFirstResponder() -> Bool {
с помощью этого:
public override var isFirstResponder: Bool {