Conditionally use VStack in iOS 13 or LazyVStack in iOS 14

WWDC2020 offered a new suite of Views, one interesting one is LazyVStack which allow us to delay the initialization of some content only when needed. Unfortunately it’s only available in iOS 14. What if you still want to offer an app that support iOS 13?

More …

Display multiple Sheet in a SwiftUI View

SwiftUI views has a ViewModifier .sheet that allows us to present a modal view based on a state .isPresented which is a Bool. What happened when we need to present more than one sheet?

More …

Build layout programmatically or visually with SwiftUI

How do you build your layout? Are you using auto layout? Frame calculations? Interface builder? I think we’ve all try different approaches and they all come with tradeoffs. It’s even harder when working within a group of people because sometimes the choice has been made out of common beliefs that became a convention. I believe it’s difficult to satisfy everyone because it’s just a matter of taste and preference.. until SwiftUI?

More …

Show a banner from anywhere in SwiftUI using ViewModifier

Creating view isn’t hard with SwiftUI, we can quickly iterate to build our final struct BannerView: View. But what if we would like to display it on top of our content? What if we have multiple View that needs to show a banner? Aren’t we going to duplicate code in lot of places with also defining how we want to animate in/out the transition?

More …

Fix large title animation on iOS13

On iOS13 you might start to have your app, or have seen other apps having this issue where the large title animation isn’t animating. Instead, it stays on the pushed view controller for a split seconds before disappearing.

More …

Stretchable header in SwiftUI ScrollView

SwiftUI doesn’t provide yet a TableHeaderView or something similar to UIScrollViewDelegate but I tried to experiment with different Views to have something close to a stretchable header.

More …