Sunday, October 15, 2023
HomeiOS DevelopmentiOS 16 SwiftUI search in record keyboard will get dismissed

iOS 16 SwiftUI search in record keyboard will get dismissed


If run this code on iOS16 keyboard will get dismissed randomly when character is typed (please see gif), whereas on iOS15 the whole lot is okay.

struct ContentView: View {
    
    let names = ["Holly", "Josh", "Rhonda", "Ted"]
    @State var textual content = ""

    var physique: some View {
        Listing {
            Part {
                ForEach(searchResults, id: .self) { title in
                    Textual content(title)
                }
            } header: {
                TextField("Seek for title", textual content: $textual content)
            }
        }
        .searchable(textual content: $textual content)
    }
    
    var searchResults: [String] {
        if textual content.isEmpty {
            return names
        } else {
            return names.filter { $0.accommodates(textual content) }
        }
    }
}

It occurs when content material is in a bit with a header. Is it bug from apple launched in iOS16 or am I doing one thing fallacious? Has anybody had the identical concern?

enter image description here



Supply hyperlink

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments