episode-code-samples
episode-code-samples copied to clipboard
Fix public access modifier episode73
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.