Post

Replies

Boosts

Views

Activity

Reply to Dynamic Presentation Sheet Heights
My issue has been solved on Stack Overflow by Benzy Neez. struct ContentView: View { let detents: Set<PresentationDetent> = [.height(150), .height(300)] @State private var selectedDetent: PresentationDetent = .height(150) @State private var actualHeight: CGFloat? var body: some View { Text("Parent View") .sheet(isPresented: .constant(true)) { NavigationStack { Form { NavigationLink("Button") { GeometryReader { proxy in RoundedRectangle(cornerRadius: 20) .fill(.blue) .navigationTitle("Child") .frame(maxHeight: actualHeight) .animation(.default, value: actualHeight) .onChange(of: proxy.size.height) { _, newVal in actualHeight = newVal } } .onAppear { selectedDetent = .height(300) } } } .navigationTitle("Parent") .navigationBarTitleDisplayMode(.inline) .presentationDetents(detents, selection: $selectedDetent) .onAppear { selectedDetent = .height(150) } } } } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jul ’25
Reply to Dynamic Presentation Sheet Heights
[quote='847221022, DTS Engineer, /thread/791111?answerId=847221022#847221022'] Changes to the presentationDetents are animated by default on iOS and custom animations are not yet supported. If you'd like us to consider adding the necessary functionality, please file an enhancement request using Feedback Assistant. [/quote] I'm not attempting to create custom animations. My issue is that presentationDetents is not animated despite using a built-in API provided by Apple without any workarounds.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jul ’25