Beginning Collection Views - Part 2: Section 1: | Ray Wenderlich

Start building a new Collection View focused app from scratch! Use the UICollectionView Delegate and Data Source protocols to set up your first Collection View.

This is a companion discussion topic for the original entry at

Just curious – why was the choice made to implement the protocols via an extension vs just adding them to the VC directly?

@catie Can you please help with this when you get a chance? Thank you - much appreciated! :]

Yeah … same question as @fhhowdy … can someone please respond?

Also @6:01 in the video, green is - #0B6739

@dev The video team has been hard at work over the past few weeks on the Android and Kotlin launch on the website. They will be back on the forums soon. Thank you for your patience - much appreciated! :]

@catie – any chance on getting a response before the thread expires? I realize the team has been busy, but it discourages comments and questions if there’s no response. These tutorials are great – I’m just curious about the design choice of an extension. I was always discouraged from using them unless it was a change that really needed to be implemented on either a series of classes, or if it cleanly added functionality to built-in class. Thanks.

@fhhowdy @dev

Hi there! I’m so sorry, I didn’t know these threads expired.

In this case, we’re just using an extension as an organizational tool, and not to change a built-in class. This makes it easier to keep related code together as you’re writing it, and to find it later. You’ll see this kind of structure in a lot of sample projects across the site, because it’s part of our Swift style guide!

Now that I’ve look at this video again, I see that we cheated a bit, and should have used an extension for each protocol instead of combining them. I’ll make a note to mention why we do this in the next update. Thanks for asking!

@catie Thanks so much for the response! I wasn’t familiar with the style guide. I’m going to review it now.