Gain Strong Immune Support With A2Z Chewables Vitamins

With the start of fall, comes a whole barrage of nasty bugs ready to bombard your immune system. Add the back to school season, and you’ve got a virtual germ war zone to walk through every day. It’s…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




How to make a List or ScrollView in SwiftUI that starts from the bottom

When I figured this out I felt like I’d got a week of my life back.

SwiftUI does not yet support imperatively scrolling a ScrollView to a specific offset. This is not great if you want to make a chat-style UI where it needs to start from the bottom.

You don’t have to wrap everything up in a UIViewRepresentable component or put content in a nested UIHostingController (which I found messes up NavigationLink behaviour). Here’s how I fixed this problem:

There it is. You just rotate the List or ScrollView 180º and flip it horizontally, then flip each row in the same way.

Here’s the view modifier this calls:

And there you have it.

Add a comment

Related posts:

The eight elements of life

Our life is based on freedom, rights, actions and other emotional traits. Without one of these elements, we can not move an inch as is vital for life.

What amenities are available at Countryside Residencia?

Countryside Residencia offers a range of amenities and facilities designed to enhance the quality of life for its residents. Here are some of the key amenities available at Countryside Residencia…

Joke Zine

Here we have the doodles, scribbles and high-contrast skate snaps in the form of JOKE Zine, courtesy of one Thomas Campbell, circa 1987. It’s funny that Thomas refers to the zine also as JOKE HATE…