Issues with Custom Wrapped Views #710
-
Hey all, I am currently trying to understand TCA better, and in this process have encountered an issue that doesn't look like I can solve it. Basically the issue is as follows. I try to change the position of an element on screen by using a SwiftUI gesture. Everything works perfectly fine until I have to start embedding viewStore content into a custom wrapped view. I think the issue might be connected to the scoping or the events not being passed to the custom wrapper view. If I move the WithViewStore inside the closure of the custom wrapper view (Canvas) everything works fine, but I need it outside, because the other pieces will access it as well. Any Idea how to solve this? Is this a bug or intended behaviour? Below you'll find some sample code that reproduces the issue. Any pointers will be highly appreciated!
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
@bobmosh This is most likely the same bug we see with The workaround there is to hold onto the view store in your view directly as an |
Beta Was this translation helpful? Give feedback.
@bobmosh This is most likely the same bug we see with
GeometryReader
, seen here:swift-composable-architecture/Examples/CaseStudies/SwiftUICaseStudies/04-HigherOrderReducers-ElmLikeSubscriptions.swift
Lines 80 to 85 in 6f1bc25
The workaround there is to hold onto the view store in your view directl…