Home / IOS Development / ios – Section transition in SwiftUI form

ios – Section transition in SwiftUI form



The Section transition into Form is always left-right, I would like to change it to right-left in some cases, I tried .transition with .move changes, but it has no effect.

struct ContentView: View {
    
    @State var visible = true

    var body: some View {
        
        Form {
            Button("visible") {
                self.visible.toggle()
            }
            visible ? Section {
                Text("Section 1
") Text("Section 1") }.transition(.move(edge: .leading)) : nil !visible ? Section { Text("Section 2") Text("Section 2") }.transition(.move(edge: .trailing)) : nil }.animation(.linear(duration: 0.5)) } }


Source link