You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When conditionally showing and hiding Form sections, I’d expect to be able to use any transition I want, but the transitions are limited to just opacity.
Revealing sections with a combined slide/opacity transition is a common pattern and one I would expect to be possible in SwiftUI, but alas.
Files
//// SampleForm.swift// //// Created by Sam Henri Gold on 2024-10-16.//
import SwiftUI
structSampleForm:View{@StateprivatevarshowMoreFields= false
@StateprivatevartextFieldValue="World"@FocusStateprivatevarisFocusedvarbody:someView{Form{Toggle("Show more fields", isOn: $showMoreFields.animation()).onChange(of: showMoreFields){
isFocused = false
}
if showMoreFields {Section{Text("Hello")TextField("Hello what?", text: $textFieldValue).focused($isFocused)} footer:{
if isFocused {Text("Some footer text with even more information").transition(.scale)}}.transition(.slide)}}.animation(.easeInOut, value: showMoreFields).animation(.easeInOut, value: isFocused)}}
#Preview {SampleForm()}
The text was updated successfully, but these errors were encountered:
Description
When conditionally showing and hiding
Form
sections, I’d expect to be able to use any transition I want, but the transitions are limited to just opacity.Revealing sections with a combined slide/opacity transition is a common pattern and one I would expect to be possible in SwiftUI, but alas.
Files
The text was updated successfully, but these errors were encountered: