Hi all,
I’m working on a custom action sheet in SwiftUI that slides in and out from the bottom using .transition(.move(edge: .bottom)). However, I’ve encountered an issue where the transition doesn’t respect my specified animation duration.
Here’s the basic structure of my action sheet:
ZStack {
Color.black
.opacity(0.5)
VStack {
SomeActionSheetContent()
}
.transition(.move(edge: .bottom))
.zIndex(1)
}
Each button inside the action sheet triggers a dismissal using this code:
Button {
withAnimation(onDismissAnimation) { isPresented = false }
}
onDismissAnimation can be any Animation, but for demonstration, I’m using .linear(duration: 5).
The problem is that when dismissing the action sheet, the animation is significantly faster than expected, around 5 times faster. For example, a 0.35-second animation finishes in just a fraction of that time.
To investigate further, I tested with .transition(.move(edge: .top)), and in that case, the transition respects the specified animation duration perfectly.
Does anyone know why the transition behaves differently when dismissing to the bottom versus the top?
Post
Replies
Boosts
Views
Activity
Hi guys,
I am trying to use the new @Observable macro. According to the documentation, this new macro will automatically generate observable properties, but I am having issues using my properties when Bindings are necessary.
Previously I had a setup like this:
class Example: ObservableObject {
@Published public var myArray = [CustomType]()
}
I initialised one instance of the Example-class in @main
@StateObject private var exampleClass = Example()
And added as an .environmentObject onto the root view
ContentView()
.environmentObject(exampleClass)
In child views I was able to access the @Published property as a binding via
@EnvironmentObject private var example: Example
$example.myArray
What I am trying now
This is the setup that I am trying with now:
@Observable class Example {
public var myArray = [CustomType]()
}
State instead of StateObject in @main
@State private var exampleClass = Example()
.environment instead of .environmentObject
ContentView()
.environmentObject(exampleClass)
@Environment instead of @EnvironmentObject
@Environment(Example.self) private var example
This new setup is not letting me access $example.myArray. Is this intended? Could someone explain why?
Hi guys,
I am trying to get webcredentials for associated domains to work on a standalone watchOS-app that I am working on.
The AASA-file is hosted correctly, and the keychain autofill works fine on the iOS-app within the same workspace using the same associated domain.
The setup on the watchOS-app is close to identical to the iOS-app. The textContentType-modifiers are correctly added onto the textfields. Within the watchOS-app, the textfields allow me to browse my keychain but it doesn't filter the credentials linked to my associated domain.
The developer docs say:
For watchOS apps, you must add the Associated Domains capability to the WatchKit Extension target.
I assume that this doesn't apply to standalone watchOS-apps that do not have the WatchKit Extension.
Has anyone encountered this issue? Appreciate any ideas.