UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

Auto correction disable not properly working

Forums > SwiftUI

I've got some UIKit code that I'm bridging to SwiftUI, and I think this is where the complication begins.

The code is below:

func makeUIView(context: Context) -> WordTextField {
        let textField = WordTextField()
        textField.language = language
        textField.text = text
        textField.textAlignment = .center
        textField.font = .systemFont(ofSize: fontSize, weight: .regular)
        textField.placeholder = placeholder
        textField.textColor = .systemBlue
        textField.autocorrectionType = .no
        textField.delegate = context.coordinator
        textField.addTarget(context.coordinator, action: #selector(Coordinator.textFieldDidChange), for: .editingChanged)
        return textField
    }

Auto correction is disabled when I use a Greek keyboard. When I use a German, Swedish or English keyboard the auto correct text doesn't appear. However, the gray part at the top of the keyboard where the text would otherwise be placed, doesn't go away like it does for Greek. It means the text field that's above the keyboard is obstructed by the top of the keyboard.

2      

BUILD THE ULTIMATE PORTFOLIO APP Most Swift tutorials help you solve one specific problem, but in my Ultimate Portfolio App series I show you how to get all the best practices into a single app: architecture, testing, performance, accessibility, localization, project organization, and so much more, all while building a SwiftUI app that works on iOS, macOS and watchOS.

Get it on Hacking with Swift+

Sponsor Hacking with Swift and reach the world's largest Swift community!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.