From 152ed336e0c6aafcb2ce1fe52a6220f3613900c4 Mon Sep 17 00:00:00 2001 From: Jim van Zummeren Date: Tue, 16 Apr 2019 10:35:44 +0200 Subject: [PATCH 1/2] Fix issue where the textfield would be cleared when losing focus on iOS 10 --- Source/TextInput/TextInputField/TextInputField.swift | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Source/TextInput/TextInputField/TextInputField.swift b/Source/TextInput/TextInputField/TextInputField.swift index ba42494..3236877 100644 --- a/Source/TextInput/TextInputField/TextInputField.swift +++ b/Source/TextInput/TextInputField/TextInputField.swift @@ -28,16 +28,16 @@ open class TextInputField: AttributedTextInputField, TextInput { // MARK: - Unavailable fields @available(*, unavailable, message: "use content instead") open override var text: String? { - set {} - get { return nil } + set { super.text = newValue } + get { return super.text } } - + @available(*, unavailable, message: "use attributedContent instead") open override var attributedText: NSAttributedString? { - set {} - get { return nil } + set { super.attributedText = newValue } + get { return super.attributedText } } - + @available(*, unavailable, message: "use textInputDelegates and textInputFieldDelegates instead") open override var delegate: UITextFieldDelegate? { set {} From 04dd047b4f965101f959b19c5cc9ed85c9cfd6f3 Mon Sep 17 00:00:00 2001 From: Jim van Zummeren Date: Tue, 16 Apr 2019 11:42:13 +0200 Subject: [PATCH 2/2] Return content instead of super.text and return attributedContent instead of super.attributedText in TextInputField --- Source/TextInput/TextInputField/TextInputField.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/TextInput/TextInputField/TextInputField.swift b/Source/TextInput/TextInputField/TextInputField.swift index 3236877..8870d6b 100644 --- a/Source/TextInput/TextInputField/TextInputField.swift +++ b/Source/TextInput/TextInputField/TextInputField.swift @@ -28,14 +28,14 @@ open class TextInputField: AttributedTextInputField, TextInput { // MARK: - Unavailable fields @available(*, unavailable, message: "use content instead") open override var text: String? { - set { super.text = newValue } - get { return super.text } + set { content = newValue } + get { return content } } @available(*, unavailable, message: "use attributedContent instead") open override var attributedText: NSAttributedString? { - set { super.attributedText = newValue } - get { return super.attributedText } + set { attributedContent = newValue } + get { return attributedContent } } @available(*, unavailable, message: "use textInputDelegates and textInputFieldDelegates instead")