One addition you could make is to make the scrollToIndex optional and then after the scrollTo method, set the index back to nil. That way if you press the scroll now button, then scroll manually, you can press the scroll now button again. Previously it wouldn't scroll because the scroll is only called when the value changes.
You are the bestest tutor that there is. I love you man, Keep up the great work. Students like me get motivated by your videos, when you explain this stuff with such ease and simplicity. Stay blessed buddy.
Why Does SwiftUI ScrollView Return To Top but not to the point from where I started/clicked? can I control this with the prefernceKey or geometry reader?
Hey Jordan! Welcome to my channel! Unfortunately there is no "easy" way to do the TikTok feed in SwiftUI (at least not yet haha) so I can't cover it in a quick video like this. I will, however, be doing a few mini-playlists soon where I remake popular apps and I'll be sure to include TikTok for you. Thanks for the idea!
my scroll viewer just jumps to random points. I have messages and when a new message appears off the screen, it will just jump to a random point in the messages. I don't know what it could be, I am pretty sure that I have everything right.
Great content mate! The example on the Apple documentation ScrollViewReader wraps around the ScrollView but the code works exactly the same. Would there be some unexpected ui bugs if we wrap the ScrollViewReader with the ScrollView instead?? Cheers!
How can you do the opposite ... click on a card, and then it records the index you clicked on? Or alternatively, if you have 50 cards, and are showing cards 13,14,15,,,, how can the program know what is showig?
The scrollview reader understands how many items are in the scrollview based on each item's ID. That is the magic of it haha. And for the index, you can just add a tapGesture when you click on an item and find where that item is in the data array.
Please help. I have a question. I have a data set, which is an array of photoModel:[PhotoModel]. I want to use ScrollViewReader to scroll to the specific spot, saying the last item of the array [PhotoModel] on appear. I use ForEach(_data: _, content: …) but I am stuck with finding the index of each item iterated through this ForEach. Nick mention at minute 14:40 but I STILL DO NOT KNOW HOW TO GET THE INDEX, which is going to be used with proxy.scrollTo(id:_). Thank you very much.
Hi Michel, sorry about that! I just started this channel and I wanted to try it out before investing in better equipment. I'm hoping to have a new microphone before I start the next playlist! I hope it's not too much of a deterrent for the time being.
I added a "scroll to top" and "scroll to bottom" buttons, but the latter won't compile. Any idea what the problem is? The scroll to index 0 works fine.
Does anyone know a way to implement haptic feedback on scroll like you get in a picker wheel? I tried by using a preference key but i dont really understand what its doing and the values dont increment with respect to some index on the scrollview, it just gives feedback for every pixel scrolled so its a constant buzz. Thanks!
One addition you could make is to make the scrollToIndex optional and then after the scrollTo method, set the index back to nil. That way if you press the scroll now button, then scroll manually, you can press the scroll now button again. Previously it wouldn't scroll because the scroll is only called when the value changes.
You are the bestest tutor that there is. I love you man, Keep up the great work. Students like me get motivated by your videos, when you explain this stuff with such ease and simplicity. Stay blessed buddy.
Your explanations are always so much clearer than anyone else's. 👍
This is good, really good. Packed, to the point .... This guy is the born Tutor! Keep it up.
Thank you! 🚀
I spend a lot of time to looking solution for Text in Chat App in the past. Today, I saw a perfect solution in here. Thank you so much @Nick.
Why Does SwiftUI ScrollView Return To Top but not to the point from where I started/clicked? can I control this with the prefernceKey or geometry reader?
On a multiline text in a ScrollView, how would you be able to scroll to where the user last scrolled to?
Thanks for the video. Can you do a video for creating a custom automatic scroll like the TikTok feed?
Hey Jordan! Welcome to my channel! Unfortunately there is no "easy" way to do the TikTok feed in SwiftUI (at least not yet haha) so I can't cover it in a quick video like this. I will, however, be doing a few mini-playlists soon where I remake popular apps and I'll be sure to include TikTok for you. Thanks for the idea!
my scroll viewer just jumps to random points. I have messages and when a new message appears off the screen, it will just jump to a random point in the messages. I don't know what it could be, I am pretty sure that I have everything right.
Great content mate!
The example on the Apple documentation ScrollViewReader wraps around the ScrollView but the code works exactly the same. Would there be some unexpected ui bugs if we wrap the ScrollViewReader with the ScrollView instead??
Cheers!
I thought the same thing.
I'd go with Apple's code.
How can you do the opposite ... click on a card, and then it records the index you clicked on? Or alternatively, if you have 50 cards, and are showing cards 13,14,15,,,, how can the program know what is showig?
The scrollview reader understands how many items are in the scrollview based on each item's ID. That is the magic of it haha. And for the index, you can just add a tapGesture when you click on an item and find where that item is in the data array.
Please help. I have a question. I have a data set, which is an array of photoModel:[PhotoModel]. I want to use ScrollViewReader to scroll to the specific spot, saying the last item of the array [PhotoModel] on appear. I use ForEach(_data: _, content: …) but I am stuck with finding the index of each item iterated through this ForEach. Nick mention at minute 14:40 but I STILL DO NOT KNOW HOW TO GET THE INDEX, which is going to be used with proxy.scrollTo(id:_). Thank you very much.
very interesting !
the sound is sometime with little noise, I would be perhaps better if you had a microphone.
Hi Michel, sorry about that! I just started this channel and I wanted to try it out before investing in better equipment. I'm hoping to have a new microphone before I start the next playlist! I hope it's not too much of a deterrent for the time being.
@@SwiftfulThinking Sounded fine to me...
@@SwiftfulThinking Sounded normal to me, don’t worry
How would you go about adding an animation to this? So that it animated scrolling to bottom instead of just instantly arriving there?
you saved me with last example
I added a "scroll to top" and "scroll to bottom" buttons, but the latter won't compile. Any idea what the problem is? The scroll to index 0 works fine.
For the last item, guessing you're using the array .count, but indexes actually start at 0. So you should use count - 1. Could this be it?
how take a screen capture with swiftui?
Does anyone know a way to implement haptic feedback on scroll like you get in a picker wheel? I tried by using a preference key but i dont really understand what its doing and the values dont increment with respect to some index on the scrollview, it just gives feedback for every pixel scrolled so its a constant buzz. Thanks!
Using UIKit you can create custom picker on a base of picker view with added inside it your custom views
Can you do a video on Timers. Im trying to add a timer to the pagetabviewstyle. so when it get to the last tab it reset and start over again.
Hi Eddy! That's a great idea. I'll try to add a timer video in bout a week.
Thanks, Nick!
very nice and helpful tutorial!
Great explenation! thank you
Super
this helps me q lot 😮
Thanks dude
you are god
Cute 😈