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

Commit

Permalink
Merge pull request #97 from Tantalum73/master
Browse files Browse the repository at this point in the history
Added property for autocorrection
  • Loading branch information
victorBaro authored Apr 30, 2018
2 parents f9b155c + 07aae0d commit c3209e9
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
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 @@ -292,6 +298,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 @@ -561,6 +568,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

0 comments on commit c3209e9

Please sign in to comment.