Post

Replies

Boosts

Views

Activity

How to make changes of text in search filed to cause animated changes in the view?
Following the examples from the official documentation: https://developer.apple.com/documentation/swiftui/adding-a-search-interface-to-your-app When the user types in the text in the search field, the list is updated with filtered results. How do I cause these changes to be animated? I tired to put .animated() after the .searchable modifier, the result was what I am looking for, however it also broke the animation of the search field getting/releasing focus.
1
0
505
Oct ’24
Phased release of a version while the previous phased release is not finished
I was not able to find info regarding this situation in the official docs. What will happen if a version was not yet released to all, and a new version is phased released? For example if I am phased releasing version 2.0. On day 3, when only 5% of the users have this version, I discovered that this version has a bug. I paused the release of 2.0 and created a hotfix version 2.1. What will happen all the users who did not receive 2.0 when I start phased release of 2.1? Will they get an immediate update to 2.0 or will they skip this version?
0
1
791
May ’23
isPressed is not reliable when Button is inside ScrollView
I opened a feedback ticket (FB16508762) but maybe someone in the community already found a workaround while the feedback reaches the maintainers. When I put a Button inside a ScrollView, the tap animation stops working reliably and works only when the user taps and holds the button for a short time. The reasons, I believe is related to the fact that isPressed of configuration does not change and the default button styles use it to animate the tap. import SwiftUI struct DebuggingButtonStyle: ButtonStyle { func makeBody(configuration: Configuration) -> some View { configuration.label .onChange(of: configuration.isPressed, { oldValue, newValue in print("Is pressed: \(oldValue) -> \(newValue)") }) } } struct ContentView: View { var body: some View { VStack { Text("Buttons inside scroll view respond to taps as expected, however isPessed value of the configuration do not change unless the user press and hold it. Try to press the promiment button quickly or use the debug button and observe the console log.") ScrollView { VStack { Button("Button Inside ScrollView") { print("Button tapped") } .buttonStyle(.borderedProminent) Button("Button Inside ScrollView (printing isPressed)") { print("Button tapped") } .buttonStyle(DebuggingButtonStyle()) } } .border(FillShapeStyle(), width: 2) Spacer() Text("For reference, here is a button outside of a ScrollView. Tap the promiment button to observe how the button is expected to animate in respnse to a press.") VStack { Button("Button Outside ScrollView") { print("Button tapped") } .buttonStyle(.borderedProminent) Button("Button Outside ScrollView (printing isPressed)") { print("Button tapped") } .buttonStyle(DebuggingButtonStyle()) } } .padding() } }
1
4
421
Feb ’25
Why Xcode 12.5 errs when using Class as a key in NSDictionary?
I downloaded Xcode 12.5 Beta and now an existing project does not compile with errors telling I can't use Class as a key in NSDictionary. Cannot initialize a parameter of type 'id<NSCopying>  _Nonnull const __unsafe_unretained' with an rvalue of type 'Class' I have assumes so far that while Class does not conform to NSCopying, it is safe to use as a dictionary key because it implements copy and copyWithZone:. Did anything change with that regard in the compiler/runtime shipped with Xcode 12.5? Is it safe (and endorsed practice) to cast to id<NSCopying> to silence these errors?
6
0
4.3k
Jun ’21