FREE TRIAL: Accelerate your app development career with Hacking with Swift+! >>

SOLVED: Data Cells not appearing in Storm Viewer project

Forums > macOS

So I was having a lot of trouble last night with this project, which felt odd since most of the iOS UIKit projects were fairly straightforward and this project came straight from that set. I managed to get it so that the interface (at least as shown in IB) was looking the same, and the print call I placed into SourceViewController.numberOfRows(in:) was firing off, but tableView(viewFor:row:) was never being called.

Compared against the project file in Git and the only changes I was seeing (outside of Main.storyboard having a ton of extra lines on my side) were in comments and whitespace.

Decided to poke around a bit using Debug > Capture View Hierarchy and compared with the version from Git (which was working properly) and it turned out that the NSScrollview was far smaller than it should be, and with a Y position way off the mark (Git version's scroll view was (x: 0, y: 0, width: 250, height: 300), mine was (x: 0, y: 298, width: 17, height: 2)). Great, now we've got something to go off of.

Checked the NSScrollView size inspector in IB, everything in that panel (and the rest of the inspector panels) matched the other project until I got to looking at the constraints and saw that my view only had 2 constraints, while the one from Git had 4. Turns out when hitting "Reset Constraints" on it when the book said to do so ended up only adding the top and leading constraints, but not the bottom and trailing constraints, causing the view to collapse (though admittedly, I'm still not quite sure why).

In either case, just wanted to throw this out there as a note to help anyone else who runs up against the same issue. It also doubles as a friendly reminder of how useful the Capture View Hierarchy debugging tool is.

Looking forward to moving on to the next project!

   

Also, minor feature note for the forum; just noticed I don't seem to be able to flag the original post as the solution...

   

Hacking with Swift is sponsored by Sentry

SPONSORED With Sentry’s error and performance monitoring for iOS you see mobile vitals that actually matter, can solve any latency issues quickly, and learn how each release is performing over time.

Get started

Sponsor Hacking with Swift and reach the world's largest Swift community!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.