Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change transition of .sheet modifier?

I have a Button that shows a View using the sheet modifier. The view comes from below. I would like to change the transition, and drop the view from above.

I tried to use

.rotationEffect(Angle(degrees: 180))

but only the View inside the SheetHostingController is rotated.

This is my code

Button(action: { self.showingModal.toggle() }) {
                 Text("Modal")
            }.sheet(isPresented: $showingModal) {
                ContentView(showingHome: self.$showingModal)
      }
}
like image 261
Lorenzo Fiamingo Avatar asked Aug 27 '19 14:08

Lorenzo Fiamingo


1 Answers

The method to make a view transition from top is

  .transition(.move(edge: .top))

You must add an animation modifier to control this transition

You can combine this transition with other transitions using

   .combined(with:)

While using modals, I don't think you can add transitions to it.

like image 155
arthas Avatar answered Sep 28 '22 09:09

arthas