Post

Replies

Boosts

Views

Activity

hapticpatternlibrary.plist error with Text entry fields in Simulator only
When I have a TextField or TextEditor, tapping into it produces these two console entries about 18 times each: CHHapticPattern.mm:487 +[CHHapticPattern patternForKey:error:]: Failed to read pattern library data: Error Domain=NSCocoaErrorDomain Code=260 "The file “hapticpatternlibrary.plist” couldn’t be opened because there is no such file." UserInfo={NSFilePath=/Library/Audio/Tunings/Generic/Haptics/Library/hapticpatternlibrary.plist, NSURL=file:///Library/Audio/Tunings/Generic/Haptics/Library/hapticpatternlibrary.plist, NSUnderlyingError=0x600000ca1b30 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}} <_UIKBFeedbackGenerator: 0x600003505290>: Error creating CHHapticPattern: Error Domain=NSCocoaErrorDomain Code=260 "The file “hapticpatternlibrary.plist” couldn’t be opened because there is no such file." UserInfo={NSFilePath=/Library/Audio/Tunings/Generic/Haptics/Library/hapticpatternlibrary.plist, NSURL=file:///Library/Audio/Tunings/Generic/Haptics/Library/hapticpatternlibrary.plist, NSUnderlyingError=0x600000ca1b30 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}} My app does not use haptics. This doesn't appear to cause any issues, although entering text can feel a bit sluggish (even on device), but I am unable to determine relatedness. None-the-less, it definitely is a lot of log noise. Code to reproduce in simulator (xcode 26.2; ios 26 or 18, with iPhone 16 Pro or iPhone 17 Pro): import SwiftUI struct ContentView: View { @State private var textEntered: String = "" @State private var textEntered2: String = "" @State private var textEntered3: String = "" var body: some View { VStack { Spacer() TextField("Tap Here", text: $textEntered) TextField("Tap Here Too", text: $textEntered2) TextEditor(text: $textEntered3) .overlay(RoundedRectangle(cornerRadius: 8).strokeBorder(.primary, lineWidth: 1)) .frame(height: 100) Spacer() } } } #Preview { ContentView() } Tapping back and forth in these fields generates the errors each time. Thanks, Steve
2
0
285
3w
SwiftUI Rerun animation when property changes.
I have a background view that shows a status indicator behind the main content. I have it set to animate and I would like it to animate when the status changes, I'm passing the status to the background view. However, it's only animating the first time it appears rather than when the status is changing. I'm using onAppear to turn the animation on, but it seems onAppear is only called the first time the view is rendered rather than when the content changes. I've tried without success: Using onChange(of) with the status. Bringing the animation logic into the primary view. I do have a workaround in my repro code (commented), but there must be a better approach. xcode 12.4/iOS 14.4 &amp; xcode 12.5/iOS 14.5 struct ContentView: View { @State private var status: String = "1" var body: some View { VStack(spacing: 0) { Spacer() BackgroundView(status: status) // This is my current workaround, but looking for a better way // if status != "1" &amp;&amp; status != "3" { // BackgroundView(status: status) // } else if status == "3" { // BackgroundView(status: status) // } else { // BackgroundView(status: status) // } Spacer() Button(action: { if status == "1" { status = "2" } else if status == "2" { status = "3" } else { status = "1" } }, label: { Text("next status") }) Spacer() } } } struct ContentView_Previews: PreviewProvider { static var previews: some View { ContentView() } } struct BackgroundView: View { var status: String = "1" @State private var isAnimating: Bool = false var body: some View { ZStack { Group { Image(systemName: "\(status).circle.fill") .resizable() .scaledToFit() .frame(width: 220) .foregroundColor(.red) } .scaleEffect(isAnimating ? 1.0 : 0, anchor: .top) } .animation(Animation.easeOut(duration: 0.4), value: isAnimating) .onAppear(perform: { print("appear: \(status)") isAnimating = true }) // .onDisappear(perform: { // print("disappear: \(status)") // isAnimating = false // doesn't help // } ) } }
2
0
5.3k
Apr ’21