SwiftUI List Change Row Padding / Insets
Reading time: 1 min
This recipe shows how to change or remove row padding (insets) in SwiftUI List. The end result looks like this:
To make this happen, use the listRowInsets
modifier on the List
content view. Don't place the modifier on the List
itself or its superviews, or else it won't work.
@State p...
SwiftUI List Change Row and Header Height
Reading time: 1 min
This recipe shows how to change row and header height in SwiftUI List. The end result looks like this:
OK, the recipe is quite simple. You use EnvironmentValue
named defaultMinListRowHeight
to set, well, default minimum list row height :D. Similarly, you can dictate the height of section h...
Hyperlinks in SwiftUI Text
Reading time: 3 min
This recipe shows how to display text with tappable hyperlinks in SwiftUI, and, in doing so, fully support attributed strings, HTML and Markdown in text views on any SwiftUI version. The end result looks like this:
The solution depends on which SwiftUI version you have to support:
- SwiftU...
Markdown in SwiftUI Text
Reading time: 1 min
This recipe shows how to use markdown in SwiftUI Text views. The end result looks like this:
This code works starting with SwiftUI 3 (iOS 15, macOS 12). If you're interested in using attributed strings on SwiftUI 1 and 2, check out Text with NSAttributedString recipe or Hyperlinks with Te...
SwiftUI Load Remote Image (Any Version)
Reading time: 3 min
This recipe provides a drop-in replacement for iOS 15 AsyncImage. This allows you to load images from remote sources on any SwiftUI version, with the code being exactly the same (minus the Compat
at the end of name :]). The end result looks like this:
AsyncImage
and AsyncImageCompat
bot...