Reading time: 3 min

This recipe shows how to implement drag / swipe selection in SwiftUI using Apple's new Charts Framework. It allows you to read data for a range of values from the chart. The end result looks like this:

preview

Charts framework is available starting in SwiftUI 4 (iOS 16, macOS 12.4).

If y...

Continue Reading...

Reading time: 1 min

This recipe shows how to request app review in SwiftUI on any version. This is the SwiftUI equivalent of requestReview(in:) method and is supported natively on SwiftUI 4, but can also work on earlier versions. The end result looks like this:

preview

SwiftUI 1-3 (iOS 13-15)

On any SwiftUI ver...

Continue Reading...

Reading time: 1 min

This recipe shows how to style SwiftUI Gauge views. You'll implement a needle gauge views that mimics speedometers in cars using a custom GaugeStyle. The end result will look like this:

preview

Gauge is available starting in SwiftUI 4 (iOS 16, macOS 12.4).

As other SwiftUI styles, GaugeSty...

Continue Reading...

Reading time: 1 min

This recipe is a cheatsheet on all the possible SwiftUI Gauge styles, as well as how to set tint and all the labels. You can see the cheatsheet below and the takeaways here:

preview

Gauge is available starting in SwiftUI 4 (iOS 16, macOS 12.4).

Here's the code used to produce the view sho...

Continue Reading...

Reading time: 1 min

This recipe shows how to implement responsive, adaptive SwiftUI layouts using ViewThatFits. This view adapts to the available space by providing the first child view that fits. The end result looks like this:

preview

ViewThatFits is available starting in SwiftUI 4 (iOS 16, macOS 12.4).

Respo...

Continue Reading...