Sticky List Header in SwiftUI
Reading time: 1 min
This recipe shows how to add a sticky header to a List in SwiftUI. It also allows for a scrolling part of the header, as well as multiple sticky headers. The end result looks like this:
The recipe goes as follows:
- Use
Section(header:)
to define the sticky header and the content beneath...
SwiftUI Image Tint
Reading time: 1 min
This recipe shows how to tint SwiftUI images in two ways - by setting the template tint or color multiply. The end result looks like this:
Let's start by saying that foregroundColor has no effect here. With that out of the way, the recipe depends on what you want to do with the image, since...
SwiftUI Image from Assets
Reading time: 1 min
This quick recipe shows how to display an image from Assets catalog in SwiftUI.
Say that you've added your image to the Assets catalog:
All you have to do to render it on the screen is to pass its name to Image:
Image("logo_small")
Using Image(decorative:)
does the same thing.
Pause and Resume Animation in SwiftUI
Reading time: 4 min
This recipe shows how to pause and resume animations in SwiftUI. The end result looks like this:
This component is available as a Swift Package in this repo.
Pausing and stopping animations
Stopping an animation in SwiftUI, while not available out of the box, is fairly easy. What y...
SwiftUI Marquee
Reading time: 2 min
This recipe shows how to implement a marquee - self-scrolling content that goes across the screen - in SwiftUI. You'll be able to control the speed and direction of the animation, as well as if it reverses or resets once it ends. The end result looks like this:
Recipe
This recipe relie...