SpaceShroomies
SpaceShroomies

Reputation: 1635

Disable autocorrect UITextView Swift

How can I turn off auto correct and spell check in Swift? I found the following for objective-c, but nothing so simple for swift.

myTextView.autocorrectionType = UITextAutocorrectionTypeNo; 

Upvotes: 27

Views: 16664

Answers (6)

deepak
deepak

Reputation: 78

With swift 4.2: TextView and TextField

textView.autocorrectionType = .no
textField.autocorrectionType = .no

Upvotes: 3

SpaceShroomies
SpaceShroomies

Reputation: 1635

I'm answering all my own questions today... This seems to work.

textView.autocorrectionType = .no

Upvotes: 55

Irfan
Irfan

Reputation: 432

With Swift 3:

textView.autocorrectionType = .no

Upvotes: 15

xcodedeveloper
xcodedeveloper

Reputation: 276

enter image description here

choice connection -> set Default to No

Upvotes: 12

Amiru Homushi
Amiru Homushi

Reputation: 139

With regards to the line of code that you posted, simply swap out the myTextField with the name of the field you wish to disable autocorrect functionality for, then after the = sign, just add .No

Upvotes: 0

Chackle
Chackle

Reputation: 2269

To make more sense of this when coming from Obj-C to Swift and why you can do .No instead of UITextAutocorrectionTypeNo, you can also do this:

myTextView.autocorrectionType = UITextAutocorrectionType.No

Upvotes: 1

Related Questions