More in Mobile Dev — page 50

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.

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.

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.

UICollectionView: Grids, Stacks, and Custom Layouts
UICollectionView is a powerful tool for displaying items in customizable layouts, going far beyond a simple vertical list. Use it for photo galleries or App Store-style interfaces.

UITableView: The Backbone of iOS Lists
UITableView is the workhorse for displaying scrolling lists in iOS. It's used everywhere from Settings to Contacts. The footgun is forgetting to reuse cells, which causes massive memory usage and choppy scrolling, so always dequeue a reusable cell.

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.

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.

UIStackView: Layouts Without Manual Constraints
A UIStackView is an invisible container that arranges views in a single column or row, saving you from writing manual layout constraints. It's ideal for toolbars or forms. The main footgun is forgetting it's non-rendering—you can't set its background color.

The UIViewController Lifecycle: From Creation to On-Screen
Think of a UIViewController as an actor with cues to enter, perform, and exit. Its lifecycle methods are your script for setting up data, updating the UI, and cleaning up resources.

UIView: The Building Block of iOS UIs
A UIView is the fundamental building block for iOS UIs. Think of it as a rectangular canvas for drawing content, handling touches, or containing other views. You use it everywhere, from simple buttons to complex layouts.

Hunt Retain Cycles with the Memory Graph Debugger
Xcode's Memory Graph Debugger is a visual map of your app's live objects and their relationships. Use it to hunt down memory leaks, especially retain cycles where objects won't deallocate.

Xcode's Time Profiler: Hunting Down Performance Bottlenecks
Time Profiler is a stopwatch for your code, sampling your app's threads to see which functions are running most often. Use it to diagnose slow UI or high battery drain by finding CPU "hot spots."

iOS Provisioning Profiles: Your App's Passport
A provisioning profile is a passport for your iOS app, bundling who can run it (devices), what it can do (entitlements), and who built it (certificate). It's required for running on physical devices and is a common source of build errors.

Swift Package Manager: Native Dependency Management
Swift Package Manager (SPM) is Apple's built-in librarian for your project's code dependencies. You use it to add, remove, and update third-party libraries directly in Xcode. The main footgun is that version conflicts between dependencies can break your build.

Xcode View Debugger: Uncover Hidden UI Bugs
The View Debugger is like an X-ray for your UI, showing every view and constraint in a 3D stack. Use it to find clipped labels, missing views, or un-tappable buttons. The common footgun is forgetting that invisible views can still block user input.
LLDB: Stop Time with Breakpoints
A breakpoint is a red light for your code, pausing execution at a specific line so you can inspect your program's state. In Xcode, use it to freeze your app when a bug occurs, examine variables, and step through code.

Auto Layout: Describing Relationships, Not Frames
Auto Layout lets you describe a UI by its relationships, not hardcoded coordinates. You declare "this button is centered and 8 points below the logo," and the system calculates its position.

Xcode Schemes vs. Build Configurations
Schemes are *what* you build (the target and action), while Configurations are *how* you build (the settings). Use them to manage environments like Debug vs. Release, each with its own API keys. The footgun is putting environment settings directly in a Scheme.

Asset Catalogs: Your App's Smart Media Library
An Asset Catalog is a smart folder for your app's visuals, automatically serving the right version (like high-res or dark mode) for the user's device. It's the standard way to manage images, icons, and colors in Xcode.

Interface Builder: Visual UI Design for iOS/macOS
Interface Builder is Xcode's visual editor for building UIs. You drag-and-drop components like buttons and screens, which are saved as `.xib` files. It's used to quickly lay out app screens without writing UI code.