Swift: How to UICollectionView Compositional Layout (List, Grid, Two Column Examples)

Поделиться
HTML-код
  • Опубликовано: 15 сен 2024

Комментарии • 36

  • @peetafunkadelic
    @peetafunkadelic 3 года назад +1

    Oh god, I must admire you for not going for click bait videos related to SwiftUI in 2020/2021. Really appreciate that somebody with understandable English is doing high-quality UIKit videos.
    I just skimmed through some of yours and you got new subscriber! Now something I will definitely use, CollectionViews and Core Data.
    Looking forward for every topic you are about to cover in the future.
    Stay safe Jonathan!

    • @peetafunkadelic
      @peetafunkadelic 3 года назад

      Btw, thanks for being pure code, no Storyboards.
      Thanks no. 2, for your hint for some retro grooves :D

    • @swiftarcade7632
      @swiftarcade7632  3 года назад

      @@peetafunkadelic Awesome Petr. You are very welcome. I will eventually get into SwiftUI. But like you, I still need to know and understand UIKit because... well it is what we need today for the job. Thanks for the comment. All the best.

    • @peetafunkadelic
      @peetafunkadelic 3 года назад +1

      @@swiftarcade7632 Exactly, I work for small company as wannabe iOS dev and we have all of our apps in UIKit and I realised that it is still better to get familiar with such a basic APIs like DiffDataSource for Collection/TableViews.

  • @Eugene.Berezin
    @Eugene.Berezin 4 года назад +2

    THANK YOU! It’s the best explanation I’ve ever seen our there for the compositional layout! Im planning on implementing it here soon. Your video helped a lot to figure out the difference between item, section, group and layout!

    • @swiftarcade7632
      @swiftarcade7632  4 года назад

      Great to hear Eugene. So glad it helped out. Best of luck with your project!

  • @saifcodes
    @saifcodes 4 года назад +1

    Amazing. Enjoying every single video you post. ✅💯👍👏

    • @swiftarcade7632
      @swiftarcade7632  4 года назад +1

      Cheers Saif. Thanks again for the suggestion.

  • @h.t.4846
    @h.t.4846 3 года назад

    love the drawing you got to explain how item, group, section work. Thanks so much!!!

    • @swiftarcade7632
      @swiftarcade7632  3 года назад

      Welcome H.T. Was confusing for me too until I saw it on paper. Cheers.

  • @48kozzy78
    @48kozzy78 4 года назад +1

    perfect explanation, thank you for your time and effort

    • @swiftarcade7632
      @swiftarcade7632  4 года назад

      Very welcome Muhammend. Thanks for the like.

  • @MarkizBoneco
    @MarkizBoneco Год назад

    Thank you very much. Very useful video as usual.

  • @abdouett3676
    @abdouett3676 4 года назад +1

    Thank you for this awesome tutorial.

  • @user-zp9gd6cc7q
    @user-zp9gd6cc7q 7 месяцев назад

    thanks, great tutorial 💖

  • @rasheshbosamiya1482
    @rasheshbosamiya1482 5 месяцев назад

    Excellent thank you for sharing

  • @edwincreator2855
    @edwincreator2855 4 года назад +1

    Thank you!

  • @sunnyjunne9765
    @sunnyjunne9765 3 года назад

    it was extremely useful for me! Thanks a lot!

    • @swiftarcade7632
      @swiftarcade7632  3 года назад

      You are most welcome Sunny. Thanks for dropping by!

  • @romancebula1263
    @romancebula1263 2 года назад

    Hi Jonathan - as always, brilliant explanation - there is only one thing that could make this tutorial 100% complete ;p could explain how to update layout (and change number of items) while rotating an iPad ? It'd help a lot of devs ;)

    • @swiftarcade7632
      @swiftarcade7632  2 года назад +1

      Hi Roman. Thank you for the comment. So it sounds like there are two things that occur - and each can happen independently of the other. The number of items could change (via network call or any other event). And then the layout needs an update. What you could do is hook into whatever changes the number of items, and then when a change occurs, for an auto layout update (i.e. setNeedsLayout()). That might do what you are looking for. Thanks for the comment. Let me know how it goes. Will try to do something like this in an upcoming video. Cheers - Jonathan.

    • @romancebula1263
      @romancebula1263 2 года назад

      @@swiftarcade7632 Thanks for swift :) response. Unfortunately in my case setNeedsLayout() doesn't help as items gets resized properly after second rotation on iPad - first rotation changes number of items in a row however width of items stays unchanged until second rotation (last item in the row gets cropped by the right bound of the screen)
      Thanks again !

    • @swiftarcade7632
      @swiftarcade7632  2 года назад +1

      @@romancebula1263 Hmmm. Very interesting. Another thing you could try is to hook into the iPad rotation events, and see if you are able to trigger another layout after that. Not sure if that would help, but may be work experimenting and trying. That's a tricky one!

  • @manuelalvarez394
    @manuelalvarez394 3 года назад

    This Video It´s so great, but... how do you implement the delegate to didSelect items?
    Thank you!!

    • @swiftarcade7632
      @swiftarcade7632  3 года назад

      Hi Manuel, It's been a while since I looked at this, but wouldn't it be some kind of protocol delegate? Similar to UITableViewController?

  • @JustAlexV
    @JustAlexV 4 года назад

    Yeah, AMAZING explanation between all of them! But how could I fetch second item from a section using Snapshot?

    • @swiftarcade7632
      @swiftarcade7632  3 года назад +1

      Great question. I will have to try this and get back to you.

  • @alexeyshimanovich6548
    @alexeyshimanovich6548 3 года назад

    Layout starts from 18:06

  • @jasondhindsa6774
    @jasondhindsa6774 3 года назад

    What software are you using to make those images you have in your markdown files?

  • @Waasys
    @Waasys 4 года назад +1

    Goof studd

  • @rajanmaheshwari
    @rajanmaheshwari Год назад

    Hi,
    With flow layout I would use the UIScrollViewDelegate to get the desired behavior:
    func scrollViewDidScroll(_ scrollView: UIScrollView) {
    guard self.scrollView == scrollView else {
    return
    }
    collectionView.contentOffset.y = scrollView.contentOffset.y
    }
    How can I use the same with the compositional layout? contentOffset is zero always and setting that to anything is not making changes in the collection view