# IOS

> Apple's mobile operating system and development platform

- Skill: `neuralblitz/ios-3` (Agent Skill)
- Install (CLI): `npx skillmds@latest add neuralblitz/ios-3`
- Raw SKILL.md: https://api.skillmd.com/api/skills/neuralblitz/ios-3/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: AI & ML
- Author: NeuralBlitz (https://skillmd.com/u/neuralblitz)
- Updated: 2026-09-22
- Page: https://skillmd.com/skills/neuralblitz/ios-3

---


# iOS Development

## What I Do

I am iOS, Apple's mobile operating system powering iPhone, iPad, and iPod Touch devices. I represent the complete ecosystem for building native mobile applications using Swift and SwiftUI or UIKit. I provide a secure, optimized platform with access to device hardware, system services, and Apple frameworks. My development ecosystem includes Xcode IDE, Swift programming language, and comprehensive frameworks for graphics, audio, networking, and machine learning. I emphasize user privacy, smooth animations, and accessibility. My App Store distribution model ensures quality and security for end users. Modern iOS development leverages SwiftUI for declarative UI, Combine for reactive programming, and async/await for concurrency. I support widgets, App Clips, and deep integration with Apple services like iCloud, Apple Pay, and Siri.

## When to Use Me

- Building native iPhone and iPad applications
- Apps requiring tight integration with iOS features
- Projects targeting Apple device users exclusively
- Apps needing App Store distribution
- Secure applications (healthcare, finance)
- High-performance graphics and gaming
- AR/VR experiences with ARKit
- Machine learning with Core ML
- Enterprise business applications

## Core Concepts

**SwiftUI**: Declarative UI framework for building interfaces with less code, supporting all Apple platforms.

**UIKit**: Imperative UI framework with view controllers, storyboards, and programmatic layouts.

**Swift Concurrency**: Modern async/await syntax with actors for thread-safe state management.

**Combine Framework**: Reactive programming framework for handling asynchronous events over time.

**App Lifecycle**: Understanding foreground, background, and suspended states for proper resource management.

**Auto Layout**: Constraint-based layout system for responsive interfaces across device sizes and orientations.

**Core Data & SwiftData**: Object graph and persistence frameworks for local data storage.

**ARKit & RealityKit**: Frameworks for augmented reality experiences on iOS devices.

## Code Examples

### Example 1: SwiftUI View with Async/Await
```swift
import SwiftUI

struct UserListView: View {
    @State private var users: [User] = []
    @State private var isLoading = false
    @State private var error: Error?
    
    var body: some View {
        NavigationStack {
            Group {
                if isLoading {
                    ProgressView("Loading users...")
                } else if let error {
                    ErrorView(error: error, retry: loadUsers)
                } else {
                    userList
                }
            }
            .navigationTitle("Users")
            .toolbar {
                ToolbarItem(placement: .primaryAction) {
                    Button(action: loadUsers) {
                        Image(systemName: "arrow.clockwise")
                    }
                }
            }
            .task {
                await loadUsers()
            }
        }
    }
    
    private var userList: some View {
        List(users) { user in
            NavigationLink(value: user) {
                UserRowView(user: user)
            }
        }
        .navigationDestination(for: User.self) { user in
            UserDetailView(user: user)
        }
    }
    
    private func loadUsers() async {
        isLoading = true
        error = nil
        
        do {
            users = try await UserService.shared.fetchUsers()
        } catch {
            self.error = error
        }
        
        isLoading = false
    }
}

struct UserRowView: View {
    let user: User
    
    var body: some View {
        HStack(spacing: 12) {
            AsyncImage(url: URL(string: user.avatarURL)) { phase in
                switch phase {
                case .success(let image):
                    image.resizable()
                        .aspectRatio(contentMode: .fill)
                case .failure:
                    Image(systemName: "person.circle.fill")
                        .foregroundStyle(.secondary)
                case .empty:
                    ProgressView()
                @unknown default:
                    EmptyView()
                }
            }
            .frame(width: 44, height: 44)
            .clipShape(Circle())
            
            VStack(alignment: .leading, spacing: 2) {
                Text(user.name)
                    .font(.headline)
                Text(user.email)
                    .font(.caption)
                    .foregroundStyle(.secondary)
            }
        }
        .padding(.vertical, 4)
    }
}
```

### Example 2: SwiftUI Navigation and Data Flow
```swift
import SwiftUI

@MainActor
class UserDetailViewModel: ObservableObject {
    @Published var user: User
    @Published var posts: [Post] = []
    @Published var isLoading = false
    
    private let userId: String
    private let api: APIService
    
    init(userId: String, api: APIService = .shared) {
        self.userId = userId
        self.api = api
        Task {
            await loadUserDetails()
        }
    }
    
    func loadUserDetails() async {
        isLoading = true
        do {
            async let userResult = api.fetchUser(id: userId)
            async let postsResult = api.fetchPosts(userId: userId)
            user = try await userResult
            posts = try await postsResult
        } catch {
            print("Error loading user details: \(error)")
        }
        isLoading = false
    }
}

struct UserDetailView: View {
    let user: User
    @StateObject private var viewModel: UserDetailViewModel
    
    init(user: User) {
        self.user = user
        _viewModel = StateObject(wrappedValue: UserDetailViewModel(userId: user.id))
    }
    
    var body: some View {
        ScrollView {
            VStack(spacing: 20) {
                userHeader
                postsSection
            }
            .padding()
        }
        .navigationTitle(user.name)
        .navigationBarTitleDisplayMode(.inline)
    }
    
    private var userHeader: some View {
        VStack(spacing: 12) {
            AsyncImage(url: URL(string: user.avatarURL)) { image in
                image.resizable()
            } placeholder: {
                Circle()
                    .fill(Color.gray.opacity(0.3))
            }
            .frame(width: 120, height: 120)
            .clipShape(Circle())
            
            Text(user.name)
                .font(.title)
                .fontWeight(.bold)
            
            Text(user.bio)
                .font(.subheadline)
                .foregroundStyle(.secondary)
                .multilineTextAlignment(.center)
            
            HStack(spacing: 24) {
                StatView(value: user.followersCount, label: "Followers")
                StatView(value: user.followingCount, label: "Following")
                StatView(value: user.postsCount, label: "Posts")
            }
        }
        .padding()
        .background(Color(.secondarySystemBackground))
        .clipShape(RoundedRectangle(cornerRadius: 16))
    }
    
    private var postsSection: some View {
        VStack(alignment: .leading, spacing: 12) {
            Text("Posts")
                .font(.headline)
            
            ForEach(viewModel.posts) { post in
                PostCardView(post: post)
            }
        }
    }
}

struct StatView: View {
    let value: Int
    let label: String
    
    var body: some View {
        VStack(spacing: 4) {
            Text("\(value)")
                .font(.title2)
                .fontWeight(.bold)
            Text(label)
                .font(.caption)
                .foregroundStyle(.secondary)
        }
    }
}
```

### Example 3: Core Data with SwiftUI
```swift
import SwiftUI
import CoreData

struct PersistenceController {
    static let shared = PersistenceController()
    
    let container: NSPersistentContainer
    
    init(inMemory: Bool = false) {
        container = NSPersistentContainer(name: "DataModel")
        
        if inMemory {
            container.persistentStoreDescriptions.first?.url = URL(fileURLWithPath: "/dev/null")
        }
        
        container.loadPersistentStores { description, error in
            if let error = error as NSError? {
                fatalError("Core Data failed to load: \(error), \(error.userInfo)")
            }
        }
        
        container.viewContext.automaticallyMergesChangesFromParent = true
        container.viewContext.mergePolicy = NSMergeByPropertyObjectTrumpMergePolicy
    }
    
    var viewContext: NSManagedObjectContext {
        container.viewContext
    }
    
    func save() {
        let context = viewContext
        if context.hasChanges {
            do {
                try context.save()
            } catch {
                let nsError = error as NSError
                print("Core Data save error: \(nsError), \(nsError.userInfo)")
            }
        }
    }
}

struct CoreDataExampleView: View {
    @Environment(\.managedObjectContext) private var viewContext
    @FetchRequest(
        sortDescriptors: [NSSortDescriptor(keyPath: \Item.timestamp, ascending: true)],
        animation: .default
    ) private var items: FetchedResults<Item>
    
    @State private var showingAddItem = false
    
    var body: some View {
        NavigationStack {
            List {
                ForEach(items) { item in
                    HStack {
                        Text(item.timestamp ?? Date(), style: .date)
                        Spacer()
                        if item.isComplete {
                            Image(systemName: "checkmark.circle.fill")
                                .foregroundStyle(.green)
                        }
                    }
                }
                .onDelete(perform: deleteItems)
            }
            .toolbar {
                ToolbarItem(placement: .primaryAction) {
                    Button(action: addItem) {
                        Label("Add Item", systemImage: "plus")
                    }
                }
            }
            .sheet(isPresented: $showingAddItem) {
                AddItemView()
            }
        }
    }
    
    private func addItem() {
        withAnimation {
            let newItem = Item(context: viewContext)
            newItem.timestamp = Date()
            newItem.isComplete = false
            PersistenceController.shared.save()
        }
    }
    
    private func deleteItems(offsets: IndexSet) {
        withAnimation {
            offsets.map { items[$0] }.forEach(viewContext.delete)
            PersistenceController.shared.save()
        }
    }
}
```

### Example 4: Combine Framework for Reactive Streams
```swift
import Combine
import SwiftUI

class SearchViewModel: ObservableObject {
    @Published var searchQuery = ""
    @Published var searchResults: [SearchResult] = []
    @Published var isSearching = false
    @Published var error: Error?
    
    private var cancellables = Set<AnyCancellable>()
    private let searchService: SearchService
    private let debounceInterval: TimeInterval = 0.3
    
    init(searchService: SearchService = .shared) {
        self.searchService = searchService
        setupSearchBinding()
    }
    
    private func setupSearchBinding() {
        $searchQuery
            .debounce(for: .seconds(debounceInterval), scheduler: RunLoop.main)
            .removeDuplicates()
            .filter { !$0.isEmpty }
            .flatMap { query in
                self.searchService.search(query: query)
                    .catch { Just([SearchResult]()) }
                    .setFailureType(to: Error.self)
            }
            .receive(on: DispatchQueue.main)
            .sink { [weak self] results in
                self?.searchResults = results
            }
            .store(in: &cancellables)
        
        $searchQuery
            .map { $0.isEmpty ? false : true }
            .assign(to: &$isSearching)
    }
    
    func clearSearch() {
        searchQuery = ""
        searchResults = []
    }
}

struct SearchView: View {
    @StateObject private var viewModel = SearchViewModel()
    @FocusState private var isSearchFocused: Bool
    
    var body: some View {
        NavigationStack {
            VStack {
                HStack {
                    Image(systemName: "magnifyingglass")
                        .foregroundStyle(.secondary)
                    TextField("Search...", text: $viewModel.searchQuery)
                        .textFieldStyle(.plain)
                        .focused($isSearchFocused)
                        .submitLabel(.search)
                        .onSubmit {
                            viewModel.searchQuery = ""
                            isSearchFocused = false
                        }
                    
                    if !viewModel.searchQuery.isEmpty {
                        Button(action: viewModel.clearSearch) {
                            Image(systemName: "xmark.circle.fill")
                                .foregroundStyle(.secondary)
                        }
                    }
                }
                .padding(10)
                .background(Color(.systemGray6))
                .clipShape(RoundedRectangle(cornerRadius: 10))
                
                if viewModel.isSearching {
                    ProgressView("Searching...")
                } else if viewModel.searchResults.isEmpty && !viewModel.searchQuery.isEmpty {
                    ContentUnavailableView(
                        "No Results",
                        systemImage: "magnifyingglass",
                        description: Text("Try a different search term")
                    )
                } else {
                    List(viewModel.searchResults) { result in
                        SearchResultRow(result: result)
                    }
                    .listStyle(.plain)
                }
            }
            .padding()
            .navigationTitle("Search")
        }
    }
}
```

### Example 5: Networking and JSON Decoding
```swift
import Foundation

enum APIError: LocalizedError {
    case invalidURL
    case invalidResponse
    case httpError(statusCode: Int)
    case decodingError(Error)
    case networkError(Error)
    
    var errorDescription: String? {
        switch self {
        case .invalidURL:
            return "Invalid URL"
        case .invalidResponse:
            return "Invalid server response"
        case .httpError(let statusCode):
            return "HTTP error: \(statusCode)"
        case .decodingError(let error):
            return "Decoding error: \(error.localizedDescription)"
        case .networkError(let error):
            return "Network error: \(error.localizedDescription)"
        }
    }
}

struct User: Codable, Identifiable {
    let id: String
    let name: String
    let email: String
    let avatarURL: String
    let createdAt: Date
    
    enum CodingKeys: String, CodingKey {
        case id
        case name
        case email
        case avatarUrl = "avatar_url"
        case createdAt = "created_at"
    }
}

final class APIService {
    static let shared = APIService()
    private let session: URLSession
    private let decoder: JSONDecoder
    
    private init() {
        let config = URLSessionConfiguration.default
        config.timeoutIntervalForRequest = 30
        config.timeoutIntervalForResource = 60
        config.waitsForConnectivity = true
        
        self.session = URLSession(configuration: config)
        
        self.decoder = JSONDecoder()
        self.decoder.dateDecodingStrategy = .iso8601
        self.decoder.keyDecodingStrategy = .convertFromSnakeCase
    }
    
    func fetchUsers() async throws -> [User] {
        let url = try makeURL(endpoint: "/users")
        return try await fetch(from: url)
    }
    
    func fetchUser(id: String) async throws -> User {
        let url = try makeURL(endpoint: "/users/\(id)")
        return try await fetch(from: url)
    }
    
    private func fetch<T: Decodable>(from url: URL) async throws -> T {
        do {
            let (data, response) = try await session.data(from: url)
            
            guard let httpResponse = response as? HTTPURLResponse else {
                throw APIError.invalidResponse
            }
            
            guard (200...299).contains(httpResponse.statusCode) else {
                throw APIError.httpError(statusCode: httpResponse.statusCode)
            }
            
            do {
                return try decoder.decode(T.self, from: data)
            } catch {
                throw APIError.decodingError(error)
            }
        } catch let error as APIError {
            throw error
        } catch {
            throw APIError.networkError(error)
        }
    }
    
    private func makeURL(endpoint: String) throws -> URL {
        guard var components = URLComponents(string: "https://api.example.com\(endpoint)") else {
            throw APIError.invalidURL
        }
        return components.url!
    }
}
```

## Best Practices

- Use SwiftUI with iOS 16+ for new projects; maintain UIKit for iOS 15 and below
- Implement proper async/await patterns for concurrency
- Use @MainActor for UI updates and thread safety
- Leverage Combine for reactive UI bindings
- Implement proper error handling with LocalizedError
- Use Codable for JSON serialization
- Follow Apple's Human Interface Guidelines
- Optimize for battery life and memory usage
- Test on real devices before App Store submission
- Use Xcode Cloud or Fastlane for CI/CD

## Core Competencies

- SwiftUI declarative UI development
- UIKit imperative UI development
- Swift concurrency with async/await and actors
- Combine reactive programming framework
- Core Data and SwiftData persistence
- URLSession networking and Codable
- Core Animation and Core Graphics
- ARKit augmented reality
- Core ML machine learning
- In-App Purchase and Apple Pay
- WidgetKit and App Intents
- App Store submission and review guidelines
- iOS security and privacy best practices

