Intermediate SwiftUI
At the end of each article, press the "Mark this article as read" button to have the site remember you've read it.
Creating a custom property wrapper using DynamicProperty
It’s not hard to make a basic property wrapper, but if you want one that automatically updates the body
property like @State
you need to do some extra work. In this article I’ll show you exactly how it’s done, as we build a property wrapper capable of reading and writing documents from our app’s container.
Basic button customization using ButtonStyle
SwiftUI’s humble Button
view is actually capable of doing remarkable things if you take the time to customize it. In this video I’ll be walking you through the ButtonStyle
protocol, showing you how we can use it to make great-looking and reusable button effects.
Advanced button customization using ButtonStyle
Previously we looked at how to create basic button styles that unify your app’s styling efficiently. In this follow-on article we’re going to explore three completely different button styles that show off just what SwiftUI is capable of: glossy marble buttons, classic fantasy buttons, and sci-fi buttons.
Animating buttons using ButtonStyle
SwiftUI’s ButtonStyle
protocol is a great way to reuse designs across your app, to get a consistent look and feel everywhere. But they have one significant problem with animations, and in this article I’ll show you that problem in action, then walk you through how to fix it in a flexible way.
Creating completely custom buttons using PrimitiveButtonStyle
SwiftUI’s ButtonStyle
lets us focus on how our buttons look, but not how they work, which in many situations is valuable. In this article we’ll look at a more advanced protocol, PrimitiveButtonStyle
, and see how that gives us complete control over button functionality.
Customizing Toggle using ToggleStyle
Most of the time the built-in iOS controls are great, but sometimes you want something just a little different. In this article I’m going to walk you through how you can take complete control over the way toggle switches work in SwiftUI, providing custom rendering and interactions.
Customizing ProgressView using ProgressViewStyle
SwiftUI’s ProgressView
gives us control over showing determinate or indeterminate progress, but it’s a bit dull – just a thin line and an activity spinner. Fortunately, we also get the ProgressViewStyle
protocol so we can build entirely custom progress views, and in this article I’ll show you how it’s done.
Customizing Label using LabelStyle
Labels are one of the simplest views in SwiftUI, but that doesn’t mean there isn’t a lot to explore. In this video I’ll walk you through how to build custom label styles, including adding animation effects triggered by hovering with the iOS trackpad.
Creating a TabbedSidebar that handles both tab view and sidebar
If you want your app to work well on larger devices, you need to support both a sidebar and a tab bar for your primary navigation. In this video I’ll show you how to build one simple SwiftUI component that transitions between both smoothly.