Senior mobile ios

From ricardonevesbraga/flowgrammers-skills · View interactive version

Senior mobile ios is an AI agent skill from the GitHub repository ricardonevesbraga/flowgrammers-skills. Engenheiro iOS sênior especializado em Swift 6, SwiftUI, UIKit, Combine, async/await, arquitetura modular (MVVM, TCA, Clean), testes (XCTest, Swift Testing), CI/CD (Fastlane, Xcode Cloud), distribuição (App Store Connect, TestFlight) e integração com HIG da Apple. Use ao desenvolver apps iOS nativos

How to use this skill

Skill file

Engenheiro iOS Sênior

Desenvolvimento iOS nativo de nível mundial com Swift 6, SwiftUI, arquitetura modular, testes rigorosos e entrega contínua.

Palavras-chave

iOS, Swift, Swift 6, SwiftUI, UIKit, Combine, async/await, actor, concurrency, Xcode, XCTest, Swift Testing, Fastlane, Xcode Cloud, App Store Connect, TestFlight, HIG, Human Interface Guidelines, CoreData, SwiftData, MVVM, TCA, Clean Architecture

Fluxos Principais

1. Arquitetura Recomendada (MVVM + Modularização)

// Feature module: Features/Checkout
import SwiftUI
import Observation

@Observable
final class CheckoutViewModel {
    private(set) var state: State = .idle
    private let service: CheckoutService

    enum State: Equatable {
        case idle
        case loading
        case loaded(Order)
        case error(String)
    }

    init(service: CheckoutService) {
        self.service = service
    }

    func load(orderID: String) async {
        state = .loading
        do {
            let order = try await service.fetchOrder(id: orderID)
            state = .loaded(order)
        } catch {
            state = .error(error.localizedDescription)
        }
    }
}

struct CheckoutView: View {
    @State private var viewModel: CheckoutViewModel

    init(viewModel: CheckoutViewModel) {
        _viewModel = State(initialValue: viewModel)
    }

    var body: some View {
        switch viewModel.state {
        case .idle, .loading:
            ProgressView()
        case .loaded(let order):
            OrderDetailsView(order: order)
        case .error(let message):
            ErrorView(message: message) {
                Task { await viewModel.load(orderID: order.id) }
            }
        }
    }
}

Princípios:

2. Concorrência Moderna (Swift Concurrency)

// Evite: DispatchQueue, completion handlers em novo código
// Prefira: async/await + actors

actor ImageCache {
    private var cache: [URL: UIImage] = [:]

    func image(for url: URL) async throws -> UIImage {
        if let cached = cache[url] { return cached }
        let (data, _) = try await URLSession.shared.data(from: url)
        guard let image = UIImage(data: data) else {
            throw ImageError.decodingFailed
        }
        cache[url] = image
        return image
    }
}

@MainActor
final class ProductsViewModel {
    private(set) var products: [Product] = []

    func loadAll() async throws {
        products = try await withThrowingTaskGroup(of: Product.self) { group in
            for id in ["A", "B", "C"] {
                group.addTask { try await self.fetch(id: id) }
            }
            var results: [Product] = []
            for try await product in group { results.append(product) }
            return results
        }
    }
}

Regras:

3. Testes

// Swift Testing (Swift 5.10+) — prefira sobre XCTest em projetos novos
import Testing
@testable import MyApp

@Suite("CheckoutViewModel")
struct CheckoutViewModelTests {
    @Test("Load order with success")
    func loadSuccess() async throws {
        let service = MockCheckoutService(result: .success(.mock))
        let viewModel = CheckoutViewModel(service: service)

        await viewModel.load(orderID: "123")

        #expect(viewModel.state == .loaded(.mock))
    }

    @Test("Load order with error")
    func loadError() async throws {
        let service = MockCheckoutService(result: .failure(NetworkError.timeout))
        let viewModel = CheckoutViewModel(service: service)

        await viewModel.load(orderID: "123")

        #expect(viewModel.state == .error("Timeout"))
    }
}

Pirâmide:

4. Performance de UI

Checklist de SwiftUI performático:

Problemas comuns e fix:

| Sintoma | Causa provável | Fix |

|---------|----------------|-----|

| Jank ao rolar | Image loading síncrono | AsyncImage com placeholder + cache |

| CPU alto em idle | Timer sem invalidate | .task scope correto |

| Memória crescendo | Retain cycle em closures | [weak self] em Combine/Task longas |

| Re-renders excessivos | @State em pai com muitos filhos | Split views, Equatable em modelos |

5. Integração com Capabilities Avançadas

Live Activities & Widgets:

// WidgetBundle
@main
struct AppWidgets: WidgetBundle {
    var body: some Widget {
        OrderStatusWidget()
        OrderLiveActivity()  // iOS 16.1+
    }
}

App Clips: < 10MB, fluxo de 1 tela crítica

Push Notifications: APNs + Notification Service Extension para payloads ricos

CloudKit: sync cross-device sem backend próprio

6. CI/CD e Distribuição

Fastlane (fastlane/Fastfile):

default_platform(:ios)

platform :ios do
  desc "Build e submit para TestFlight"
  lane :beta do
    setup_ci if ENV['CI']
    match(type: "appstore", readonly: true)
    increment_build_number(xcodeproj: "MyApp.xcodeproj")
    build_app(scheme: "MyApp", configuration: "Release")
    upload_to_testflight(skip_waiting_for_build_processing: true)
  end

  desc "Release na App Store"
  lane :release do
    beta
    deliver(
      submit_for_review: true,
      automatic_release: false,
      force: true
    )
  end
end

Xcode Cloud:

7. App Store: Submissão e Review

Checklist pré-submissão:

Motivos comuns de rejeição:

Métricas do Engenheiro iOS

Erros Comuns que o CLO Jr Comete

Veja Também

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.