SuperAPI AI Directory

ios-expert

Coding & development

View repository

Updated 10-16 03:39

About this skill

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

// 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 — SwiftUI App Structure, MVVM with Combine, Async/Await Networking, Core Data with SwiftUI, UIKit View Controller, Push Notifications

Resources

Documentation

Tools

Libraries & Frameworks

Learning Resources

Community