Тёмный
No video :(

Programmatic Scrolling in SwiftUI using ScrollViewReader 

Flo writes Code
Подписаться 8 тыс.
Просмотров 604
50% 1

Опубликовано:

 

4 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 3   
@surfdado
@surfdado 2 года назад
Hey Flo, thanks for the great video - would you happen to know how I can access the proxy reference if I have structured my view into multiple smaller view extensions? I'd love to have a ScrollViewReader at the top level but then in a module further down I have a DragGesture handler that needs to control the scroll position
@FloWritesCode
@FloWritesCode 2 года назад
Thanks for the nice words! You should be able to pass down the ScrollViewProxy to the "inside" View, e.g. like this: ScrollViewReader{ proxy in ... MyView(proxy: proxy) } I haven't tried this yet, but I know that it works for GeometryReaders, so I would also expect it to work for ScrollViewReader.
@surfdado
@surfdado 2 года назад
​@@FloWritesCode Thanks for the prompt response. I actually don't know how I can pass arguments to a view extension (I only know how to pass them to a different view) but I did solve my issue by using a @State variable and an onChange listener. My view extension sets the @State variable deep down in the extension somewhere, and at the top level my scrollview has a onChange listener that sets the scrollTo based on the @State variable.
Далее
Implementing a ScrollView in SwiftUI | Bootcamp #15
12:18
ScrollViewReader to Automatically Scroll
17:21
Просмотров 2,3 тыс.
Don't use VSCode
35:31
Просмотров 223 тыс.
Add Animations to ScrollView in SwiftUI! (iOS 17)
7:49
Custom Transition Between Screens in SwiftUI - Part 1
13:57
When RESTful architecture isn't enough...
21:02
Просмотров 274 тыс.