|
In the "Layout and Identity" chapter there is an "Inside TupleView" section with this at the end...
I'm just really confused about what I'm supposed to be seeing here. For one thing, it says "we can use Swift's partial block results builders" but then it tells us to add this extension where we add our own For another thing, it says that "Just having those two partial block builders will cause SwiftUI to nest many TupleView instances" but I don't understand how just adding this extension would cause that. Are we supposed to be writing some additional code to actually use these functions and see that they are actually doing something? |
|
If you look at the Swift proposal SE-0348 One example they use is
These allow up to 10 With
Partial block builders exist as of Swift 5.7 but I don't think they've been adopted in SwiftUI yet.
Nope, you don't need to write any extra code to use those methods. They would get called by the system internals. Per SE-0348, if |
|
I see now. Thank you. So, I can write code like this...
Then, I can see that the extension is working because if I remove the extension I get an error from having more than 10 Views in my VStack. And if I use ModifiedContent<VStack<TupleView<(TupleView<(TupleView<(TupleView<(TupleView<(TupleView<(TupleView<(TupleView<(TupleView<(TupleView<(TupleView<(TupleView<(TupleView<(TupleView<(Text, Text)>, Text)>, Text)>, Text)>, Text)>, Text)>, Text)>, Text)>, Text)>, Text)>, Text)>, Text)>, Text)>, Text)>>, AddGestureModifier<_EndedGesture<TapGesture>>> But without the extension (and removing the extra 5 Views) the type looks like this ModifiedContent<VStack<TupleView<(Text, Text, Text, Text, Text, Text, Text, Text, Text, Text)>>, AddGestureModifier<_EndedGesture<TapGesture>>> |
SPONSORED Take the pain out of configuring and testing your paywalls. RevenueCat's Paywalls allow you to remotely configure your entire paywall view without any code changes or app updates.
Sponsor Hacking with Swift and reach the world's largest Swift community!
This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.
All interactions here are governed by our code of conduct.
Link copied to your pasteboard.