'How to hide suggested email id from keyboard in swift

I want to hide email suggestion which is displaying while i choose email textField in my application.

I have tried different options like below but none of them works for me.

txtEmail.autocorrectionType = .no
txtEmail.accessibilityLabel = .none
txtEmail.textContentType = .none

Is there anything else a part from this which i missed out ?

enter image description here



Solution 1:[1]

You can set UITextField text content type to an empty string:

txtEmail.textContentType = .init(rawValue: "")

Solution 2:[2]

I don't know how, but @Leo Dabus answer doesn't work in my case, however, an approach below does

        textView.autocorrectionType = .no
        textView.keyboardType = .emailAddress

I had to set keyboardType not to .default.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Leo Dabus
Solution 2 Aleksey Timoshchenko