# 15. Implement iOS state management (Combine/Observer)

meta:
  id: native-business-logic-migration-15
  feature: native-business-logic-migration
  priority: P0
  depends_on: [native-business-logic-migration-12]
  tags: [implementation, ios, state-management]

objective:
- Implement reactive state management using Combine

deliverables:
- FeedRepository.swift
- SubscriptionRepository.swift
- FeedViewModel.swift
- SubscriptionViewModel.swift
- State enumeration
- Error handling types

tests:
- Unit: Test repository methods
- Unit: Test ViewModel state transitions
- Unit: Test Combine publishers
- Integration: Test UI updates

acceptance_criteria:
- Repositories provide Combine publishers
- ViewModels manage state properly
- Error states handled
- Loading states implemented
- Memory efficient (no retain cycles)

validation:
- Run unit tests
- Check with Instruments for memory leaks

notes:
- Use Combine framework
- Follow Repository pattern
- Use @Published for SwiftUI integration
