Skip to content

Conversation

TaekH
Copy link

@TaekH TaekH commented Mar 3, 2025

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 TaekH changed the title fix/public-access-modifier-episode73 Fix public access modifier episode73 Mar 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant