🍎 Kuba Suder's blog on Mac & iOS development


SwiftUI Essentials

Categories: SwiftUI 0 comments Watch the video

SwiftUI is designed to take care of the boring but necessary parts of building a UI for you (e.g. handling different color modes, text sizes, languages, accessibility etc.), leaving you more time for working on exciting features that are unique to your app

SwiftUI views are very lightweight (they're structs that only hold the data this specific view needs) and are created and released on the fly every time a view needs to be updated

You can create as many views as you need to create the architecture you want without worrying about performance

Prefer smaller, single-purpose views – it’s really easy to break your code into smaller pieces and refactor it, so do it often

Put conditions inside modifiers when possible (flipped ? 180 : 0) – returning separate objects in if/else may create a separate hierarchy where SwiftUI needs to add/remove views when switching, and then by default it uses a fade animation to switch between those

All controls have adaptive behavior – they describe the role they serve, instead of how they look, and the framework adapts the look to the environment

Same Button() can be a navigation item button, an unstyled iOS button, a macOS push button, or even a context menu item (!)

Modifiers like .disabled() can be applied even to whole screens

Leave a comment


This will only be used to display your Gravatar image.


What's the name of the base class of all AppKit and UIKit classes?