Skip to content
tezvyn:

Swiftui

36 bites tagged Swiftui — interview questions with model answers, and 60-second explainers.

iOS & Swift2 min read

NavigationStack: Programmatic Navigation in SwiftUI

Think of NavigationStack as a pile of views. You push new views onto the stack programmatically by appending to a path array. This is SwiftUI's modern, data-driven way to handle deep navigation, replacing the older, buggier `NavigationView`.

iOS & Swift2 min read

TabView: SwiftUI's Built-in Tab Bar

TabView lets you show different views in the same space, switched by a tab bar. It's the standard for top-level app navigation, like switching between "Home," "Search," and "Profile." The footgun is nesting them; they are for main sections only.

iOS & Swift2 min read

MVVM: Separate SwiftUI Logic from Layout

MVVM separates logic from layout by moving state and business logic out of your SwiftUI View into a dedicated ViewModel class. This makes your code cleaner, more organized, and easier to test.

iOS & Swift2 min read

UIViewRepresentable: Bridging UIKit and SwiftUI

UIViewRepresentable is an adapter that lets you use battle-tested UIKit views inside your modern SwiftUI code. Use it for components like WKWebView that lack a native SwiftUI equivalent.

iOS & Swift2 min read

ObservableObject: Making Data Drive SwiftUI Views

ObservableObject lets your custom data classes signal SwiftUI views to refresh when data changes. Use it for reference types like a user profile or settings manager. Changes are ignored unless you mark properties with `@Published`, leaving your UI stale.

iOS & Swift1 min read

UIHostingController: Bridge SwiftUI into UIKit Apps

UIHostingController is an adapter that lets you use modern SwiftUI views inside a UIKit app by wrapping them in a UIViewController. This is key for migrating apps to SwiftUI or embedding new components.

iOS & Swift2 min read

SwiftUI List: More Than Just a Table View

A SwiftUI List is a declarative container for scrollable rows of data, like a modern UITableView. Use it for settings, feeds, or contact lists. The footgun: never nest a List inside a ScrollView, as it breaks scrolling behavior.

iOS & Swift2 min read

SwiftUI Modifiers: Stacking Changes on Views

Think of SwiftUI modifiers as non-destructive filters you apply to a view, creating a new, wrapped version with the change applied. You use them to add padding, set fonts, or handle taps. The footgun: modifier order matters immensely.

iOS & Swift2 min read

SwiftUI State and Binding: Owning vs. Sharing Data

In SwiftUI, `@State` is owning the data, while `@Binding` is borrowing a key. A view uses `@State` for its private source of truth, like a toggle's status, and passes a `@Binding` to child views so they can modify the original source.

iOS & Swift2 min read

SwiftUI Stacks: Arrange Views Vertically, Horizontally, and in Layers

SwiftUI stacks are your core layout tools for arranging views. Use VStack for vertical columns, HStack for horizontal rows, and ZStack for layering. They're essential for any UI, from simple rows to complex overlays.

iOS & Swift2 min read

SwiftUI's View: A Blueprint, Not a Building

A SwiftUI View is a lightweight blueprint for a piece of your UI, not the UI element itself. It's used to compose everything from a single button to an entire screen. The common mistake is treating it like a heavy `UIView` class; it's a cheap.

Design Systems2 min read

SwiftUI Theming with the Environment

Treat SwiftUI's Environment as a cascading style sheet for your app. You define design tokens like colors and fonts once at the top, and all child views automatically inherit them. This is key for building design systems or multi-brand apps.

Get Swiftui bites daily.

Five a day, five minutes, offline. With quizzes so it sticks.

Open testing — you’ll join as an early tester.