TEAM LICENSES: Save money and learn new skills through a Hacking with Swift+ team license >>

Is it possible to have a listRowBackground that doesn't move with the swipe action?

Forums > SwiftUI

I have some big cards in a List and I would like to reveal extra information behind them when the user swipes. Something not a million miles away from the way you can swipe cards away to reveal buttons in the News app.

My first thought was to try to put something in the listRowBackground but the background seems to move with the swipe action. Is there a way of stopping the background from moving, or perhaps a different approach?

Thanks in advance.

2      

Have you looked at .swipeActions. It might be what you need.

2      

Thanks @NigelGee, I should have been more specific in the OP. .swipeActions is exactly what I was using. But what I am seeing is that the background of the list row moves with that swipe. So for example if I define a LinearGradient in .listRowBackground I can clearly see that the background swipes with the row rather than remaining in place. What I am looking for is a way to keep the background in place during the swipe. May not be possible, but equally possible that I am missing something.

2      

Hacking with Swift is sponsored by Superwall.

SPONSORED Superwall lets you build & test paywalls without shipping updates. Run experiments, offer sales, segment users, update locked features and more at the click of button. Best part? It's FREE for up to 250 conversions / mo and the Superwall team builds out 100% custom paywalls – free of charge.

Learn More

Sponsor Hacking with Swift and reach the world's largest Swift community!

Reply to this topic…

You need to create an account or log in to reply.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.