All bites
The whole library, newest first. Filter by what you are here for, or pick a topic if you already know.
4247 bites
Page 138

iOS Background Modes: A Hall Pass for Your App
iOS background modes are like hall passes, letting your app perform specific tasks like playing audio or tracking location after the user switches away. They're used for music players or navigation apps.

The Singleton Pattern: One Instance to Rule Them All
A singleton ensures a class has only one instance and provides a global access point to it. It's used for shared resources like a network manager or logger. The main footgun is that overuse creates tight coupling and makes testing difficult.

The Coordinator Pattern: Untangling iOS Navigation
The Coordinator pattern makes a separate object the 'boss' of app navigation, leaving view controllers to just manage their view. This lets you reuse views in different flows without them knowing what comes next.

VIPER: Taming Massive iOS View Controllers
VIPER is a strict architectural pattern that tames "Massive View Controllers" by splitting features into five layers: View, Interactor, Presenter, Entity, and Router. It's used in large iOS apps to make business logic and navigation explicitly testable.

iOS State Preservation: Resume Where You Left Off
Think of it as an automatic bookmark for your app's UI. When iOS terminates your app, state preservation can save the user's place, restoring the view hierarchy on next launch.

UINavigationController: Stack-Based Screen Management
UINavigationController manages screens like a deck of cards: you push new ones on top and pop them off to go back. It's standard for hierarchical navigation. The footgun is manually changing the stack; always use the provided push/pop methods.

UITabBarController: Your App's Main Switchboard
A UITabBarController manages a row of buttons at the bottom of the screen to switch between an app's main sections. Use it for distinct, non-sequential modes like 'Recents,' 'Contacts,' and 'Voicemail'. The footgun is using it for a step-by-step process.

Storyboard Segues: Visual UI Flow in iOS
A Storyboard Segue is a visual arrow connecting two screens in your iOS app, defining a navigation path without writing code. Use them to transition from a list to a detail view. The biggest mistake is forgetting to use prepare(for:sender:) to pass data.

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.

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.

NavigationLink: Pushing Views in SwiftUI
NavigationLink is SwiftUI's declarative way to push a new view onto a navigation stack. You use it inside a NavigationStack to create drill-down UIs, like tapping a list item to see its details. The footgun is forgetting the parent NavigationStack.

NavigationSplitView: Adaptive Layouts for All Screen Sizes
NavigationSplitView is a responsive container for multi-column layouts. It shows a sidebar, content, and detail view on large screens but collapses to a stack on small ones. Use it for master-detail UIs like a mail app.

Deep Linking: Go Beyond the App's Home Screen
A deep link is a URL for a specific screen inside your app, not just its front door. Use it to let users jump directly to content from emails, websites, or other apps, but be sure to handle state changes like login before redirecting.

NavigationPath (SwiftUI)
NavigationPath is a type erased stack of navigation destinations that backs a SwiftUI NavigationStack, letting one path hold a mix of different hashable data types so you can push, pop and control deep, heterogeneous navigation flows programmatically.

Custom UIViewController Transitions: Beyond the Defaults
A custom transition lets you choreograph the handoff between two screens, defining the exact animation. Use it for unique experiences like a card expanding to fill the screen.

UserDefaults: Your App's Junk Drawer for Settings
UserDefaults is a simple key-value store for persisting small bits of data, like a dictionary that saves itself. Use it to remember user preferences like enabling dark mode or a username. The footgun: don't use it for large files or sensitive data.

App Sandbox: A Digital Playpen for Your App
The App Sandbox is a digital playpen for your app, restricting it to its own files and resources. It's a core security feature on iOS and macOS, preventing apps from accessing user data or system files without explicit permission.

FileManager: Your App's Interface to the File System
FileManager is your app's librarian for the file system. Instead of using raw paths, you ask it to find, create, or delete files and directories. Always handle potential errors, as file operations can easily fail.

Swift's Codable: Effortless JSON & Data Parsing
Codable is a compiler magic trick that automatically converts Swift objects to and from formats like JSON. It's used constantly for parsing API responses or saving data to disk. The footgun: decoding fails if JSON keys don't exactly match your property names.

Keychain Services: A Secure Vault for Small Secrets
Think of Keychain as a system-managed safe deposit box for small secrets like passwords or tokens. It's the go-to for storing API keys or user credentials securely. The main footgun is its clunky C-style API, leading most developers to use a wrapper.