Group Group Group Group Group Group Group Group Group

raywenderlich.com Forums

Video Tutorial: Table Views in iOS Part 1: Getting Started

Learn about the various parts of a table view and how each of those parts work with one another.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/3300-table-views-in-ios/lessons/2

First of all thanks a lot for the great tutorial, it’s great but I’m still curious one thing, why did you use extension when you were implementing the TableViewDataSource? What are the advantages?

This is a common question we get asked a lot. Putting code in our extensions is part of our style guide. Here’s what the guide has to say:

This keeps the related methods grouped together with the protocol and can simplify instructions to add a protocol to a class with its associated methods.

Also, don’t forget the // MARK: - comment to keep things well-organized!

Basically, it enforces grouping of your protocol methods instead of having them scattered throughout the file. I hope that helps!

It did help! Thank you, I appreciate it.

The demo starter lacks the Models folder.

Hello, sorry for the stupid question, but why check it
“if let imageView = cell.imageView, bugImage = bug.image { imageView.image = bugImage
}”
if i can write the
“cell.imageView?.image = bug.image”.
Thx

1 Like

I have the same question, where you able to find an answer?

See this:

1 Like

I finished the challenge. What is the attribution.txt used for?

As I mentioned in another post, both approaches are valid. In teaching 101 courses, I aim to be explicit with my intent versus being concise. Thanks for the question!

This just lets you know where we got the artwork for the project.

Profiling the PrettyIcons project using the Leak Instrument I get a memory leak when the static IconSets array is created.

Any suggestions on how to deal with this issue?

The Models folder mentioned in the second video of the tables tutorial does seem to exist in any of the download materials. I try to use these lessons for my daughter to use on her own, but she runs up against a wall if the referenced materials in the videos don’t exist in the locations the video says they do (which has happened on numerous occasions, unfortunately). I see that the two files in the Model folder exist under the Icons folder instead. Can you please take care to make the videos and the provided materials sync up please? Thanks.

Hi ancientmariner … I appreciate the note you wrote. We’ll definitely make sure things are consistent when we next update this series. Thanks again for letting us know.

Hi
My images aren’t shown…
I think there maybe a compatibility issue with Xcode 8.2 (8C38) ??
Please advise connect coding for
if let iconImage = icon.image {
cell.imageView?.image = iconImage
}
Thanks

I really like how you add a row its similar to how the Apple’s music app dose it. I’m using Swift 3 and have been trying to figure how to modify your program so I get ‘add a row button’ at the top of the table like Apple Music App not the bottom. Can you help me out with the modification? Thanks you in advance!!!

Why course doesn’t exist anymore https://videos.raywenderlich.com/courses/table-views-in-ios/lessons/1

I created a model folder and dragged the 2 Swift files there.

Then select the icon swift class, and in the File inspector on the right, look at the Target Membership. The app target (not the Test target) should be checked. Do the same for the IconSet class. If they are not checked, check it! And now all will be well.

For all who are having the issue where the app loads, but the images are not being displayed.

Go through all the images in the ‘Icons’ and ‘Images’ folders, and in the File inspector on the right, look at the Target Membership. The app target should be checked. Do the this for all files where it is not checked. And now all should be well.