When should we use WithViewStore vs an @ObservedObject viewStore? #856
-
The documentation says there is an issue with GeometryReader but it doesn't mention what are the performance implications and if there are special considerations for each situation. I keep discovering new little things... In isowords, I see : self.viewStore = ViewStore(self.store, removeDuplicates: ==) When does it make sense to use removeDuplicates? Has anyone benchmarked using WithViewStore vs @ObservedObject ? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
That
Whenever you want to perform a custom equatable check, or whenever you're dealing with types that aren't equatable (like tuples).
|
Beta Was this translation helpful? Give feedback.
That
removeDuplicates: ==
can probably go! The initializer that doesn't take that parameter is constrained toEquatable
and calls==
under the hood:swift-composable-architecture/Sources/ComposableArchitecture/SwiftUI/WithViewStore.swift
Lines 125 to 140 in 1437951