episode-code-samples icon indicating copy to clipboard operation
episode-code-samples copied to clipboard

Fix public access modifier episode73

Open TaekH opened this issue 10 months ago • 0 comments

Fix the access modifier in the example code from episode 73 of ComposableArchitecture.

The following function should be declared as public:

func view<LocalValue>(
  _ f: @escaping (Value) -> LocalValue
) -> Store<LocalValue, Action> {
  let localStore = Store<LocalValue, Action>(
    initialValue: f(self.value),
    reducer: { localValue, action in
      self.send(action)
      localValue = f(self.value)
    }
  )
  localStore.cancellable = self.$value.sink { [weak localStore] newValue in
    localStore?.value = f(newValue)
  }
  return localStore
}

I fixed the build error by declaring this function as public.

TaekH avatar Mar 03 '25 14:03 TaekH