Reading time: 8 min

This recipe shows how to format content of a SwiftUI Text with HTML via NSAttributedString on any SwiftUI version. The end result looks like this:

Screenshot%202021-05-26%20at%2014.24.29

There are two solutions in this recipe:

  1. SwiftUI 3 (iOS 15, macOS 12) brings in a new AttributedString wrapper around NSAttributedString...

Continue Reading...

Reading time: 2 min

This tutorial shows how to style a navigation bar in SwiftUI - changing its background color, text color, as well as styling the status bar. The end result looks like this:

This component is available as a Swift Package in this repo.

The gist of the work is in using a ViewModifier...

Continue Reading...

Reading time: 1 min

This recipe shows how to implement a Pager View using a TabView in SwiftUI. This is an awesome addition in iOS 14.0, allowing you to trivially create a swipeable pager.

The end result looks like this:

ezgif-2-74be83381405

We already have a recipe for Pager / Swiper view in SwiftUI that also works on iOS 1...

Continue Reading...

Reading time: 2 min

This recipe shows how to send mail from SwiftUI. You'll build a MailView by wrapping MessageUI's MFMailComposeViewController in a UIViewControllerRepresentable. You'll be able to:

  • Determine if you can send mail or not.
  • Pass subject, message and recipients to the view via a binding.
  • A...

Continue Reading...

Reading time: 2 min

A Flow Layout is a container that orders its views sequentially, breaking into a new "line" according to the available width of the screen. You can compare it to a left-aligned block of text, where every word is a View. A common use for this layout is to create a tag cloud. The end result look...

Continue Reading...