Post

Replies

Boosts

Views

Activity

Best way to show a popoverTip only when its anchor view is actually scrolled into view?
I have a section near the bottom of a ScrollView / LazyVStack. I want to show a popoverTip anchored to a button in that section, but only once the user has actually scrolled to it not on view load (otherwise the tip shows floating at the bottom of the screen). I tried to use onAppear but it fires as soon as the view is inserted into the hierarchy which on a LazyVStack can happen slightly before the view is truly in the viewport. I fell back to using onScrollVisibilityChange to write the @Parameter only when the section is actually visible: .onScrollVisibilityChange { isVisible in MyTip.sectionVisible = isVisible } This correctly gates visibility, but on some older devices I noticed that writing/reading @Parameter mid-scroll causes hitches. Is there a recommended TipKit pattern for this use case: showing a popoverTip only when its anchor has been scrolled into view that doesn't require a reactive write during active scroll? thanks
1
0
83
1w
Best way to show a popoverTip only when its anchor view is actually scrolled into view?
I have a section near the bottom of a ScrollView / LazyVStack. I want to show a popoverTip anchored to a button in that section, but only once the user has actually scrolled to it not on view load (otherwise the tip shows floating at the bottom of the screen). I tried to use onAppear but it fires as soon as the view is inserted into the hierarchy which on a LazyVStack can happen slightly before the view is truly in the viewport. I fell back to using onScrollVisibilityChange to write the @Parameter only when the section is actually visible: .onScrollVisibilityChange { isVisible in MyTip.sectionVisible = isVisible } This correctly gates visibility, but on some older devices I noticed that writing/reading @Parameter mid-scroll causes hitches. Is there a recommended TipKit pattern for this use case: showing a popoverTip only when its anchor has been scrolled into view that doesn't require a reactive write during active scroll? thanks
Replies
1
Boosts
0
Views
83
Activity
1w