Post

Replies

Boosts

Views

Activity

Reply to Unable to clear Japanese text in TextField
I believe this issue has been discussed since around iOS 17. Wrapping a UITextField with UIViewRepresentable and using the system's standard clear button might be better from an accessibility perspective. I've thought about several approaches using SwiftUI. I've uploaded a sample project to a repository, so please check it out if you're interested. https://github.com/CH3COOH/SampleClearJapaneseText While it's not my original idea, Solution 4, which removes one character and then replaces the text with an empty string in the next event loop, might be a good approach. Here's the sample code: struct SearchBar4: View { @Binding private var text: String var body: some View { HStack { TextField("", text: $text, prompt: Text("Search")) .textFieldStyle(.plain) .padding() .foregroundStyle(.white) Button { if !text.isEmpty { let _ = text.removeLast() DispatchQueue.main.asyncAfter(deadline: .now()) { self.text = "" } } } label: { Image(systemName: "xmark") .foregroundStyle(.black) } } .padding(.horizontal, 8) .background(RoundedRectangle(cornerRadius: 8).fill(.gray)) .padding(.horizontal, 8) } init(text: Binding<String>) { _text = text } } The video below shows this sample code in action.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Mar ’25
Reply to MKMapView appears red on iOS 18 simulator + Xcode 16
I have created a repository for the project where the issue occurs. https://github.com/CH3COOH/SampleXcode16IOS18MKMapKit/ In my environment, the issue arises with the following minimal code: import SwiftUI import MapKit struct ContentView: View { @State private var region = MKCoordinateRegion( center: CLLocationCoordinate2D(latitude: 35.6844779, longitude: 139.7512224), span: MKCoordinateSpan(latitudeDelta: 0.05, longitudeDelta: 0.05) ) var body: some View { Map(coordinateRegion: $region) } } #Preview { ContentView() } I believe it's not a program bug but rather an issue with the iOS simulator. When the Excluded Architectures setting is enabled, the following problems occur: The app freezes when displaying SFSafariViewController The app freezes when displaying UIImagePickerController The map appears in red when using MapKit
Jan ’25
Reply to SFSafariViewController not loading web pages on Xcode 16 Simulator with iOS 18
I too am struggling with this issue. Xcode 16.0 + iOS 17.0 Simulator => No issue Xcode 16.0 + iOS 18.0 Simulator => SafariViewController freezes Xcode 16.0 + iOS 18.0 Real device => No issue As additional information, this did not occur when I created a minimally configured project with Xcode 16.0. My development environment: MacBook Pro 2023 Apple M2 Pro Xcode 16.0 iOS 18.0 Simulator
Topic: Safari & Web SubTopic: General Tags:
Sep ’24