0

The autocorrection / predictive text feature is generally not desired in the app. I'd like to make a user preference if they would like to disable it for the app but not require them to turn it off across the phone. Is there a way to do this? The documentation doesn't speak to this at all or maybe it does and I just got lost.

Ankit Kapasi
  • 23
  • 1
  • 5
  • Possible duplicate of [Disable UITextField Predictive Text](http://stackoverflow.com/questions/25767522/disable-uitextfield-predictive-text) –  Apr 03 '17 at 00:42
  • That provides you with the solution, this provides you with the actual answer which is NO. http://stackoverflow.com/questions/9670321/turn-off-autocorrect-globally-in-an-app –  Apr 03 '17 at 00:43

1 Answers1

2
  1. You can do it by assigning the property autocorrectionType to false in every textfield that you have.
  2. You can subclass UITextField class and use it in every view controller that you want.
  3. You can use Method Swizzling in order to auto set this property for UITextField class
carlos21
  • 485
  • 4
  • 9
  • Oh interesting with method swizzling - do you know if that would work if its a view that I have a protocol on too? – Ankit Kapasi Apr 03 '17 at 06:38
  • @AnkitKapasi, I don't think so, a view with just UIKeyInput you can't access to autocorrectionType property. Instead would be better to create a category on UITextField and apply method swizzling. If this answers your question could you mark it as correct? :) thank you – carlos21 Apr 03 '17 at 13:18
  • darn. I have a UIViewController that doesnt have a textfield... definitely happy to mark this answer good because I like the Method Swizzle option. Thanks man. – Ankit Kapasi Apr 03 '17 at 19:12