Пользовательская форма быстрой эврика возвращает всегда пустую строку - PullRequest
0 голосов
/ 27 апреля 2020

Я занимаюсь разработкой приложения iOS с пользовательским Eureka Row с текстовым полем и кнопкой. Я новичок ie, поэтому у меня недостаточно ресурсов, чтобы понять, что не так с моим кодом.

Вот мой код customRow "textWithButtonCell.swift"

public class textWithButtonCell: Cell<String>, CellType {

    @IBOutlet weak var label: UILabel!
    @IBOutlet weak var textField: UITextField!
    @IBOutlet weak var button: UIButton!

    public override func setup() {
        super.setup()

        button.addTarget(self, action: #selector(textWithButtonCell.copyCode), for: .touchUpInside)
        textField.text = row.value
        selectionStyle = .none
    }

    @objc func copyCode(){

        let pasteboard = UIPasteboard.general
        pasteboard.string = textField.text

        let message = MDCSnackbarMessage()
        message.text = strConfirmCodeCopied
        MDCSnackbarManager.show(message)

        row.updateCell()
    }

    public override func update() {
        super.update()
        if let value = row.value {
            textField.text = value
        }
        if let title = row.title {
            label.text = title
        }
    }

}

// The custom Row also has the cell: CustomCell and its correspond value
public final class textWithButtonRow: Row<textWithButtonCell>, RowType {

    public var placeholder: String? = "Password"

    required public init(tag: String?) {
        super.init(tag: tag)
        // We set the cellProvider to load the .xib corresponding to our cell
        cellProvider = CellProvider<textWithButtonCell>(nibName: "textWithButtonRow")
    }
}

Я использую xib-файл с кнопкой, текстовым полем и меткой.

Я называю это с помощью

let identifiantRow = textWithButtonRow("identifiant"){ row in
            row.title = appStrings.strIdentifiant
            if(self.editMode == false){
                row.value = ""
            }else{
                row.value = self.site?.identifiant
            }
        }

Моя проблема в том, что когда я печатаю

let values = form.values()
        print(values)

.. .значение идентификатор поле не заполнено

Можете ли вы мне помочь, пожалуйста?

Заранее спасибо.

...