ScrollViewReader to auto scroll in SwiftUI | Continued Learning #5

แชร์
ฝัง
  • เผยแพร่เมื่อ 29 พ.ย. 2024

ความคิดเห็น • 37

  • @mykosen5679
    @mykosen5679 หลายเดือนก่อน

    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.

  • @editavatar6423
    @editavatar6423 9 หลายเดือนก่อน

    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.

  • @Mike_bbbbb
    @Mike_bbbbb 8 หลายเดือนก่อน

    Your explanations are always so much clearer than anyone else's. 👍

  • @evennorthug2585
    @evennorthug2585 ปีที่แล้ว +1

    This is good, really good. Packed, to the point .... This guy is the born Tutor! Keep it up.

  • @BSharing09
    @BSharing09 2 ปีที่แล้ว

    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.

  • @jemmytech5474
    @jemmytech5474 2 ปีที่แล้ว +1

    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?

  • @zbighugh9193
    @zbighugh9193 2 ปีที่แล้ว +1

    On a multiline text in a ScrollView, how would you be able to scroll to where the user last scrolled to?

  • @jdrsims
    @jdrsims 3 ปีที่แล้ว +1

    Thanks for the video. Can you do a video for creating a custom automatic scroll like the TikTok feed?

    • @SwiftfulThinking
      @SwiftfulThinking  3 ปีที่แล้ว +6

      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!

  • @toastarg6577
    @toastarg6577 ปีที่แล้ว

    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.

  • @aybarsacar9375
    @aybarsacar9375 2 ปีที่แล้ว +2

    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!

    • @w0mblemania
      @w0mblemania ปีที่แล้ว

      I thought the same thing.
      I'd go with Apple's code.

  • @gregohb
    @gregohb 3 ปีที่แล้ว +1

    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?

    • @SwiftfulThinking
      @SwiftfulThinking  3 ปีที่แล้ว

      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.

  • @TuanHoang-qj3yq
    @TuanHoang-qj3yq 2 ปีที่แล้ว

    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.

  • @mig12394
    @mig12394 3 ปีที่แล้ว +1

    very interesting !
    the sound is sometime with little noise, I would be perhaps better if you had a microphone.

    • @SwiftfulThinking
      @SwiftfulThinking  3 ปีที่แล้ว

      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.

    • @coffeeCatPeanutDust
      @coffeeCatPeanutDust 3 ปีที่แล้ว +2

      @@SwiftfulThinking Sounded fine to me...

    • @pawelpow
      @pawelpow 3 ปีที่แล้ว +3

      @@SwiftfulThinking Sounded normal to me, don’t worry

  • @mattrowli
    @mattrowli ปีที่แล้ว

    How would you go about adding an animation to this? So that it animated scrolling to bottom instead of just instantly arriving there?

  • @aenemy_ae
    @aenemy_ae 2 ปีที่แล้ว

    you saved me with last example

  • @gregohb
    @gregohb 3 ปีที่แล้ว

    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.

    • @SwiftfulThinking
      @SwiftfulThinking  3 ปีที่แล้ว +3

      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?

  • @raymundoortiz7269
    @raymundoortiz7269 2 ปีที่แล้ว

    how take a screen capture with swiftui?

  • @work5353
    @work5353 2 ปีที่แล้ว

    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!

    • @paulmax9155
      @paulmax9155 ปีที่แล้ว

      Using UIKit you can create custom picker on a base of picker view with added inside it your custom views

  • @eddydon1929
    @eddydon1929 3 ปีที่แล้ว

    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.

    • @SwiftfulThinking
      @SwiftfulThinking  3 ปีที่แล้ว +1

      Hi Eddy! That's a great idea. I'll try to add a timer video in bout a week.

  • @josemanuelortizsanchez4983
    @josemanuelortizsanchez4983 ปีที่แล้ว

    Thanks, Nick!

  • @dddiehard02
    @dddiehard02 2 ปีที่แล้ว

    very nice and helpful tutorial!

  • @nirb16
    @nirb16 11 หลายเดือนก่อน

    Great explenation! thank you

  • @Nunny25
    @Nunny25 3 ปีที่แล้ว +1

    Super

  • @도레미파솔-g4r
    @도레미파솔-g4r ปีที่แล้ว

    this helps me q lot 😮

  • @sheldonbrathwaite2149
    @sheldonbrathwaite2149 ปีที่แล้ว

    Thanks dude

  • @DaikiKaneda
    @DaikiKaneda ปีที่แล้ว

    you are god

  • @mmendes6780
    @mmendes6780 3 ปีที่แล้ว

    Cute 😈