iOS Dev 41: UICollectionView Compositional Layout Explained | Swift 5, XCode 13

Поділитися
Вставка
  • Опубліковано 2 сер 2024
  • Today, we learn how to build a staggered/complex layout using UICollectionViewCompositionalLayout.
    Resources:
    Image Assets: drive.google.com/file/d/1DllS...
    Complete Project: github.com/EMacco/ios-tutoria...
    Say Hi on Social Media:
    LinkedIn: / ​​
    Instagram: its_macco?...
    Twitter: / its_macco
    If you feel like buying me a coffee :)
    www.buymeacoffee.com/emmanuel...
    Video Content
    Introduction 00:00
    Project Setup 01: 23
    Basic Compositional Layout 10:09
    Add spacing to cells 21:50
    Create Helper Methods 23:11
    Create Staggered Layout 35:44
    More complex layout 44:15
    Recap 56:26
    Up Next 58:03
  • Наука та технологія

КОМЕНТАРІ • 34

  • @shaash5960
    @shaash5960 Рік тому

    Buddy, thank you so much. This is the best material on Compositional layout !

  • @simrandotdev
    @simrandotdev 2 роки тому +5

    A video on CollectionView Diffable Data Source as well. And then a video with a combination of Compositional Layout and Diffable Data Source in a single collection view

    • @EmmanuelOkwara
      @EmmanuelOkwara  2 роки тому +4

      Diffable data source is actually on my list.
      Video coming soon 😊

  • @isaaciniongun6568
    @isaaciniongun6568 Рік тому

    Excellent tutorial, loved every bit of it.
    Felt like I was back in school, LOL.
    Now I see Compositional Possibilities🚀🚀🚀🚀🚀🚀

    • @EmmanuelOkwara
      @EmmanuelOkwara  Рік тому

      “Compositional Possibilities” that’s a good one 😅

  • @aiinque
    @aiinque Рік тому

    great explanation. thank you!

  • @thientoan0101
    @thientoan0101 Рік тому

    Very easy to understand, thank you so much

  • @movementinaction
    @movementinaction 10 місяців тому

    Great Job! Thanks!

  • @Chandan-xz8cd
    @Chandan-xz8cd Рік тому

    This is first video of your channel, and i fall in love with your channel. such powerfull content and amazing explanation. thanks dude.😃

    • @EmmanuelOkwara
      @EmmanuelOkwara  Рік тому

      Thanks, Chandan
      I appreciate the kind words 😊

  • @valentinalinchuk
    @valentinalinchuk 9 місяців тому

    Thank you so much for your videos! You explain very very well))

  • @zlata96
    @zlata96 Рік тому

    Thank you so much! It was much easier to understand with you explanation 🙏

  • @pickleteach1920
    @pickleteach1920 2 роки тому

    Thank you so much!

  • @Stricken174
    @Stricken174 2 роки тому

    thank you man)

  • @mdtarifkhan1825
    @mdtarifkhan1825 2 роки тому

    sir, I love your teaching ❤
    hope all time you upload new video with new thing for us 😍
    Thank you so much sir for give us your valuable time💕

  • @YogeshPateliOS
    @YogeshPateliOS Рік тому +1

    Hey thanks for the video. Why you create your helper as a struct not a class?

  • @hiba60164
    @hiba60164 2 роки тому +1

    Love from , India . Thanks bro .

  • @thereisnoname5678
    @thereisnoname5678 2 роки тому

    Nice bro, good luck

  • @rajanmaheshwari
    @rajanmaheshwari Рік тому

    Hi Emmanuel,
    Now the function of NSCollectionLayoutGroup:
    open class func horizontal(layoutSize: NSCollectionLayoutSize, subitem: NSCollectionLayoutItem, count: Int) -> Self
    is deprecated.
    And the new function
    open class func horizontal(layoutSize: NSCollectionLayoutSize, repeatingSubitem subitem: NSCollectionLayoutItem, count: Int) -> Self
    Doesn't yield the output as shown in the video. Can you replace your func and see the behaviour. Its totally different now.
    I think as per new func its our responsibility to adjust the layout size of item and feed the item in group. In your case to have count = 2 horizontally, we need to set the layout size width with fraction as 0.5 in NSCollectionLayoutItem.

  • @user-ik3es6gz4q
    @user-ik3es6gz4q Рік тому

    why the change of alignment doesn't change scroll

  • @tehilataub
    @tehilataub Рік тому +1

    Great tutorial, thanks for that !
    Question - If I fetch more images (like infinite scrolling) - do I need to call to createLayout again? or layoutIfNeeded?

    • @EmmanuelOkwara
      @EmmanuelOkwara  Рік тому +3

      No. You create the layout one time and as your data changes, the list will be updated to follow the layout.

  • @raychen4458
    @raychen4458 2 роки тому

    Sir how do you know what item is selected when creating multiple items wrapped in different groups ?

    • @EmmanuelOkwara
      @EmmanuelOkwara  2 роки тому

      You’ll use the collectionview’s didSelectItemAt delegate method which will give you the index of the selected item.

  • @RiadSultanov
    @RiadSultanov 6 місяців тому

    it would be nice if you put the result of the work you're going to do before the work itself (when editing video) instead of showing it with fingers. It's just about what you can do better, anyway nice video, thanks very much!

  • @thereisnoname5678
    @thereisnoname5678 2 роки тому

    It would be good, if you did a video about what a junior iOS devs should know)

    • @EmmanuelOkwara
      @EmmanuelOkwara  2 роки тому +1

      That’s a good one. I’ll add to my list

  • @Stricken174
    @Stricken174 2 роки тому +1

    magic is forbidden outside Hogwarts!

    • @EmmanuelOkwara
      @EmmanuelOkwara  2 роки тому

      Is this a reference to Harry Potter? 😅

    • @Stricken174
      @Stricken174 2 роки тому +1

      @@EmmanuelOkwara Yes) This looks awesome, probably illegal)))