Currently there is no suggestion input for TextField.
I found an extension to use TextField with suggestions on WatchOS but this one is not working on a view which navigated with NavigationLink
Here is the wrapper code;
import Foundation
import SwiftUI
extension View {
typealias StringCompletion = (String) -> Void
func presentInputController(withSuggestions suggestions: [String], completion: @escaping StringCompletion) {
WKExtension.shared()
.visibleInterfaceController?
.presentTextInputController(withSuggestions: suggestions,
allowedInputMode: .allowEmoji) { result in
guard let result = result as? [String], let firstElement = result.first else {
completion("")
return
}
completion(firstElement)
}
}
}
I'm looking forward to your suggestions too :))