ios

MVVM architecture pattern for iOS

MVVM (Model-View-ViewModel) separates concerns cleanly in iOS apps. Models hold data, Views display UI, and ViewModels mediate between them with business logic and state. Views bind to ViewModel properties using Combine or SwiftUI's property wrappers.

Keychain wrapper for secure credential storage

The Keychain securely stores sensitive data like passwords and tokens, encrypting them at the OS level. Direct Keychain APIs are verbose, so I create a wrapper class that simplifies common operations. The wrapper uses Security framework's SecItemAdd,

Instruments and performance profiling

Instruments profiles iOS apps to identify performance bottlenecks, memory leaks, and energy issues. The Time Profiler instrument samples the call stack to show which functions consume CPU time. Allocations tracks memory usage and finds leaks by identi

Core Data for local persistence

Core Data is Apple's object graph and persistence framework, essential for complex data models and offline support. I define entities and relationships in the .xcdatamodeld file, then generate NSManagedObject subclasses. The NSPersistentContainer enca

Combine framework for reactive programming

Combine provides a declarative Swift API for processing values over time, perfect for handling async events like network requests, user input, and timers. Publishers emit sequences of values, and subscribers receive them. Operators transform, filter,

UserDefaults and app preferences

UserDefaults provides simple key-value storage for app preferences and settings. It persists basic types like strings, numbers, bools, dates, and data automatically. I use UserDefaults for user preferences, app state, and feature flags—never for sensi

JSON encoding and decoding with Codable

Codable protocol combines Encodable and Decodable for seamless JSON conversion. Swift structs and classes conforming to Codable automatically synthesize encoding/decoding logic when all properties are Codable. JSONEncoder converts Swift types to JSON

Coordinator pattern for navigation flow

The Coordinator pattern separates navigation logic from view controllers, promoting reusability and testability. Coordinators own navigation controllers and decide which screens to show based on user actions. Each flow (onboarding, main, settings) has

SwiftUI List with pull-to-refresh and infinite scroll

Lists are fundamental to iOS apps, displaying scrollable collections efficiently. SwiftUI's List or ScrollView with LazyVStack renders items on-demand. I add pull-to-refresh with the .refreshable modifier, calling async refresh logic. For infinite scr

Unit testing with XCTest and mocks

Unit tests verify code behavior in isolation using XCTest framework. I create test classes inheriting from XCTestCase with test prefixed methods. Each test has arrange-act-assert structure: set up dependencies, execute code, verify results with XCTAss

App lifecycle and scene management

iOS 13 introduced scene-based lifecycle for multi-window support on iPad. The App and Scene delegates handle different lifecycle events. SceneDelegate manages individual scenes—windows on iPad or the single window on iPhone. It responds to state trans

StoreKit for in-app purchases

StoreKit enables selling digital goods and subscriptions within iOS apps. I request product info from App Store Connect with product identifiers, then display prices in the user's currency. Purchase flows use SKPaymentQueue to add transactions, which