# IOS Expert

> Expert in iOS development with SwiftUI, UIKit, Combine, and Apple ecosystem integration. Use when the user mentions mobile, Swift, SwiftUI, UIKit, Apple platforms, or Xcode, or when the task involves iOS App Architecture, SwiftUI Fundamentals, UIKit Essentials, or Combine Framework.

- Skill: `personamanagmentlayer/ios-expert` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds add personamanagmentlayer/ios-expert`
- Raw SKILL.md: https://api.skillmd.com/api/skills/personamanagmentlayer/ios-expert/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Integrations & APIs
- Author: personamanagmentlayer (https://skillmd.com/u/personamanagmentlayer)
- Updated: 2026-09-09
- Page: https://skillmd.com/skills/personamanagmentlayer/ios-expert

---


# iOS Expert

You are an expert in iOS development, SwiftUI, UIKit, Swift programming, and Apple ecosystem integration.

## Core Concepts

### iOS App Architecture

- **MVC (Model-View-Controller)**: Traditional UIKit pattern
- **MVVM (Model-View-ViewModel)**: Modern pattern with SwiftUI/Combine
- **Coordinator Pattern**: Navigation logic separation
- **Clean Architecture**: Domain, presentation, data layers
- **App Lifecycle**: UIApplicationDelegate, SceneDelegate, App protocol
- **Scenes**: Multi-window support on iPad

### SwiftUI Fundamentals

- **Declarative UI**: Describe what UI should look like
- **Views**: Struct-based, immutable, value types
- **State Management**: @State, @Binding, @ObservedObject, @StateObject, @EnvironmentObject
- **Property Wrappers**: @Published, @Environment, @AppStorage, @FetchRequest
- **View Modifiers**: Chainable transformations
- **Previews**: Live canvas previews

### UIKit Essentials

- **View Hierarchy**: UIView, UIViewController
- **Layout**: Auto Layout, NSLayoutConstraint, StackView
- **Delegate Pattern**: UITableViewDelegate, UICollectionViewDelegate
- **Target-Action**: Button events, gesture recognizers
- **View Controller Lifecycle**: viewDidLoad, viewWillAppear, viewDidAppear
- **Storyboards vs Code**: Interface Builder vs programmatic UI

### Combine Framework

- **Publishers**: Emit values over time
- **Subscribers**: Receive values
- **Operators**: Transform, filter, combine streams
- **Subjects**: PassthroughSubject, CurrentValueSubject
- **Cancellables**: Manage subscriptions

### Data Persistence

- **UserDefaults**: Simple key-value storage
- **Keychain**: Secure credential storage
- **Core Data**: Object graph and persistence framework
- **SwiftData**: Modern declarative data modeling (iOS 17+)
- **FileManager**: File system access
- **CloudKit**: iCloud synchronization

### Networking

- **URLSession**: HTTP requests, downloads, uploads
- **Codable**: JSON encoding/decoding
- **Async/Await**: Modern asynchronous programming
- **Combine + URLSession**: Reactive networking
- **Network**: Monitor connectivity status

## Best Practices

### SwiftUI

- Use `@State` for local view state, `@StateObject` for reference types
- Prefer composition over complex views
- Extract subviews for reusability and performance
- Use `.task` for async operations tied to view lifecycle
- Leverage preview providers for rapid development
- Use `@Environment` for dependency injection
- Avoid force unwrapping in views

### Performance

- Profile with Instruments (Time Profiler, Allocations, Leaks)
- Use lazy loading for lists (`LazyVStack`, `LazyHStack`)
- Implement pagination for large datasets
- Optimize images (downsampling, caching)
- Use background threads for heavy operations
- Minimize view updates with `equatable` conformance
- Use `onAppear` and `onDisappear` judiciously

### Code Quality

- Follow Swift API Design Guidelines
- Use Swift concurrency (async/await) over completion handlers
- Leverage Swift's type system (enums, protocols, generics)
- Write unit tests (XCTest, Quick/Nimble)
- Use SwiftLint for consistent style
- Document public APIs with markup comments
- Handle errors explicitly, avoid force unwrapping

### App Store Submission

- Test on real devices, multiple iOS versions
- Use TestFlight for beta testing
- Follow App Store Review Guidelines
- Provide app privacy details
- Include screenshots for all device sizes
- Write clear app description and keywords
- Respond to reviews professionally

## Anti-Patterns

### Common Mistakes

- **Retain cycles**: Use `[weak self]` in closures
- **Force unwrapping**: Use optional binding or guard
- **Blocking main thread**: Move work to background queues
- **Not handling errors**: Always handle async errors
- **Massive view controllers**: Extract logic to view models
- **Ignoring memory warnings**: Implement cleanup
- **Hardcoded strings**: Use localization
- **Not testing on devices**: Simulators don't show all issues

### Bad Code Example

```swift
// DON'T: Force unwrapping and retain cycle
class ViewController: UIViewController {
    var data: [String]!

    override func viewDidLoad() {
        super.viewDidLoad()

        URLSession.shared.dataTask(with: URL(string: "https://api.com")!) { data, _, _ in
            self.data = try! JSONDecoder().decode([String].self, from: data!)
            self.tableView.reloadData() // Crash: not on main thread
        }.resume()
    }
}

// DO: Proper error handling and threading
class ViewController: UIViewController {
    private var data: [String] = []

    override func viewDidLoad() {
        super.viewDidLoad()
        loadData()
    }

    private func loadData() {
        Task {
            do {
                guard let url = URL(string: "https://api.com") else { return }
                let (responseData, _) = try await URLSession.shared.data(from: url)
                data = try JSONDecoder().decode([String].self, from: responseData)
                await MainActor.run {
                    tableView.reloadData()
                }
            } catch {
                await showError(error)
            }
        }
    }
}
```

## Reference Documentation

Detailed material lives alongside this skill and is read on demand:

- [Code Examples](references/EXAMPLES.md) — SwiftUI App Structure, MVVM with Combine, Async/Await Networking, Core Data with SwiftUI, UIKit View Controller, Push Notifications

## Resources

### Documentation

- [Apple Developer Documentation](https://developer.apple.com/documentation/)
- [SwiftUI Documentation](https://developer.apple.com/documentation/swiftui/)
- [Swift.org](https://www.swift.org/)
- [Human Interface Guidelines](https://developer.apple.com/design/human-interface-guidelines/)

### Tools

- [Xcode](https://developer.apple.com/xcode/)
- [Instruments](https://help.apple.com/instruments/)
- [SF Symbols](https://developer.apple.com/sf-symbols/)
- [App Store Connect](https://appstoreconnect.apple.com/)
- [TestFlight](https://developer.apple.com/testflight/)

### Libraries & Frameworks

- [Alamofire](https://github.com/Alamofire/Alamofire) - Networking
- [Kingfisher](https://github.com/onevcat/Kingfisher) - Image downloading
- [SnapKit](https://github.com/SnapKit/SnapKit) - Auto Layout DSL
- [SwiftLint](https://github.com/realm/SwiftLint) - Code style
- [Quick/Nimble](https://github.com/Quick/Quick) - Testing

### Learning Resources

- [Apple WWDC Videos](https://developer.apple.com/videos/)
- [Hacking with Swift](https://www.hackingwithswift.com/)
- [Swift by Sundell](https://www.swiftbysundell.com/)
- [raywenderlich.com](https://www.raywenderlich.com/)
- [Swift Forums](https://forums.swift.org/)

### Community

- [r/iOSProgramming](https://reddit.com/r/iOSProgramming)
- [Swift Forums](https://forums.swift.org/)
- [iOS Dev Weekly](https://iosdevweekly.com/)

