Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Added property for autocorrection #97

Merged
merged 2 commits into from
Apr 30, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions AnimatedTextInput/Classes/AnimatedTextField.swift
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,11 @@ extension AnimatedTextField: TextInput {
get { return text }
set { self.text = newValue }
}

public var autocorrection: UITextAutocorrectionType {
get { return self.autocorrectionType }
set { self.autocorrectionType = newValue }
}

public var currentSelectedTextRange: UITextRange? {
get { return self.selectedTextRange }
Expand Down
11 changes: 10 additions & 1 deletion AnimatedTextInput/Classes/AnimatedTextInput.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,13 @@ open class AnimatedTextInput: UIControl {
configureType()
}
}


open var autocorrection: UITextAutocorrectionType = .no {
didSet {
textInput.autocorrection = autocorrection
}
}

open var returnKeyType: UIReturnKeyType = .default {
didSet {
textInput.changeReturnKeyType(with: returnKeyType)
Expand Down Expand Up @@ -291,6 +297,7 @@ open class AnimatedTextInput: UIControl {
textInput.view.tintColor = style.activeColor
textInput.textColor = style.textInputFontColor
textInput.font = style.textInputFont
textInput.autocorrection = autocorrection
textInput.view.translatesAutoresizingMaskIntoConstraints = false
addSubview(textInput.view)
invalidateIntrinsicContentSize()
Expand Down Expand Up @@ -559,6 +566,8 @@ public protocol TextInput {
var currentSelectedTextRange: UITextRange? { get set }
var currentBeginningOfDocument: UITextPosition? { get }
var contentInset: UIEdgeInsets { get set }
var autocorrection: UITextAutocorrectionType {get set}


func configureInputView(newInputView: UIView)
func changeReturnKeyType(with newReturnKeyType: UIReturnKeyType)
Expand Down
5 changes: 5 additions & 0 deletions AnimatedTextInput/Classes/AnimatedTextView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ extension AnimatedTextView: TextInput {
return self.beginningOfDocument
}

public var autocorrection: UITextAutocorrectionType {
get { return self.autocorrectionType }
set { self.autocorrectionType = newValue }
}

public func changeReturnKeyType(with newReturnKeyType: UIReturnKeyType) {
returnKeyType = newReturnKeyType
}
Expand Down