Sample Code - 0244

동시성 경고를 최대치 설정

Project > Build Setting

SWIFT_STRICT_CONCURRENCY = complete

assumeIsolated

현재 실행 컨텍스트가 전달된 actor에 속한다고 동기적으로 가정하는 안전한 방법

#Preview {
  MainActor.assumeIsolated {
    NavigationStack {
      StandupsListView(
        store: Store(
          initialState: StandupsListFeature.State(
            standups: [.mock]
          )
        ) {
          StandupsListFeature()
        }
      )
    }
  }
}

이전 코드에 StandupsListFeature Reducer를 추가

struct StandupsListFeature: Reducer {
  struct State {
  }
  enum Action {
  }
  var body: some ReducerOf<Self> {
    Reduce { state, action in 
      switch action {
      }
    }
  }
}

→ Reducer의 기본 뼈대

State 구성 - IdentifiedArrayOf<T> 활용

struct State {
  var standups: [Standup] = []
}

🔥 일반 Array

→ 이렇게 구성하면 인덱스로 요소를 참조

→ 비동기로 작업 처리를 하게 되면 문제가 생길 수 있음

struct State {
  var standups: IdentifiedArrayOf<Standup> = []
}

⚒️ IdentifiedArrayOf

public typealias IdentifiedArrayOf<Element> = IdentifiedArray<Element.ID, Element>
where Element: Identifiable

→ UUID로 생성한 stable Identifier로 식별할 수 있도록 함