SwiftUI Firebase Chat 13: ScrollViewReader and Proxy Auto Message Scrolling

  Рет қаралды 8,982

Lets Build That App

Lets Build That App

Күн бұрын

Пікірлер: 13
@fabiano.almeida
@fabiano.almeida 2 жыл бұрын
Thanks for share all your thoughts and experience with us. I loved how you solved the "scroll down" idea. That was awesome!
@johnsorensen4696
@johnsorensen4696 3 жыл бұрын
How are you handling scrolling the messages up when the keyboard is summoned?
@ortbri
@ortbri 3 жыл бұрын
man, you do amazing stuff. I appreciate the vids
@MohammedHussain-uf5uo
@MohammedHussain-uf5uo Жыл бұрын
Thanks for the trick.But i need to scroll up when there is more content to load from server. How can i achieve that efficiently.
@tariqAlmazyad
@tariqAlmazyad 3 жыл бұрын
What a clover solution . What I was thinking for this issue is to make it as the .id(vm.messages.last ?? .init(// whatever an object) ) and then make the scrollViewProxy.scrollTo(to the last message) haven't thought about the DispatchQueue part 😅.
@piyusharmaus
@piyusharmaus 3 жыл бұрын
While keyboard is presented every time we push the chat view controller the chat list doesnt scroll to the end of the last chat above the keyboard. if we put delay for scrolling to the last then it works.
@LetsBuildThatApp
@LetsBuildThatApp 3 жыл бұрын
Thats a good question, I would suggest listening for keyboardWillShow through NotificationCenter. Perhaps I'll make a video on this.
@piyusharmaus
@piyusharmaus 3 жыл бұрын
@@LetsBuildThatApp Thanks Brian. I tried using the same but still it gets stuck randomly if we keep doing hide/unhide. ScrollViewReader { reader in ScrollView(.vertical, showsIndicators: false) { ForEach(chats) { chat in ChatCell(chat: chat) .id(chat.id) } .onReceive(viewModel.$chats) { chats in withAnimation { reader.scrollTo(chats.last?.id) } } .onChange(of: keyboard.height) { height in withAnimation { keyboardOffset = height reader.scrollTo(chats.last?.id) } } } } Here keyboard is the ObservableObject object that listens for hide/show keyboard notifications.
@0xifarouk
@0xifarouk 3 жыл бұрын
@@LetsBuildThatApp Check my comment it has a simpler solution.
@0xifarouk
@0xifarouk 3 жыл бұрын
@@piyusharmaus check my comment.
@piyusharmaus
@piyusharmaus 3 жыл бұрын
@@0xifarouk where ?
SwiftUI Firebase Chat 14: Save and Fetch Recent Messages
41:44
Lets Build That App
Рет қаралды 8 М.
ScrollViewReader to auto scroll in SwiftUI | Continued Learning #5
14:47
Swiftful Thinking
Рет қаралды 22 М.
Une nouvelle voiture pour Noël 🥹
00:28
Nicocapone
Рет қаралды 9 МЛН
SwiftUI Firebase Chat 12: Fetch Messages Documents with Snapshot Listener
29:31
SwiftUI Firebase Chat 11: Send and Save Messages to Firestore
29:31
Lets Build That App
Рет қаралды 9 М.
ScrollViewReader to Automatically Scroll
17:21
azamsharp
Рет қаралды 2,4 М.
SwiftUI Firebase Chat 08: Show All Users for Creating Message
28:53
Lets Build That App
Рет қаралды 9 М.
Every Minute One Person Is Eliminated
34:46
MrBeast
Рет қаралды 46 МЛН
The Samsung A Series Secret They Don't Want You to Know!
12:12
MovilOne Phone Repair
Рет қаралды 58 М.
Enhancements to ScrollView in iOS 17
23:43
Stewart Lynch
Рет қаралды 7 М.
SwiftUI Firebase Chat 10: Chat Log UI Setup
24:03
Lets Build That App
Рет қаралды 7 М.
SwiftUI Firebase Chat 06: Fetch Current User Firestore
32:51
Lets Build That App
Рет қаралды 16 М.