-
When I use the new WithViewStore, I get the following warning when I use SwiftLint.
Although I can change the SwiftList settings to avoid the warning, but I would like to solve the warnings by changing the way WithViewStore is written if possible. Is there any way to do this? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
To that very use case, you could define func identity<T>(_ value: T) -> T { value } and replace (Curiously, |
Beta Was this translation helpful? Give feedback.
-
Another alternative is to use multiple trailing closures: WithViewStore(self.store) {
$0
} content: { viewStore in
…
} But it does seem like a kinda silly SwiftLint rule. |
Beta Was this translation helpful? Give feedback.
To that very use case, you could define
and replace
observe: { $0 }
withobserve: identity
. But it won't scale if you need to do anything else that can't be a simple key path expression.(Curiously,
observe: \.self
also doesn't work because of a limitation in the Swift compiler.)