I'm working through the Hacking with tvOS (2019-05-27) book (made for UIKit) and it's a bit of a mess right now.
Quite a lot has changed with Xcode and Interface Builder since the book was written. And because UIKit leans on XCode's interface so heavily (quite the opposite of SwiftUI), a lot of the tutorials in the book are broken.
(Honestly, it feels like it's best to jump straight into SwiftUI if you're going to start with tvOS. But since there aren't any SwiftUI tvOS tutorials out there, I'm braving the UIKit version. I'll try to keep this post updated, but if it peters out, you'll know I gave up.)
I'll keep a log of the problems I've encountered and how I overcame them here. The first three projects I was able to translate the minor differences pretty easily. So I didn't write down the issues or fixes (though I've come back and edited with a Project 2 note). That changed in Project 4, where I am now. It took me a while to figure out how to get past some of the blockers. So I'll keep a log for those few brave and foolish enough to follow after me.
Project 2 - Flashlight
1. CollectionView Cells Wrong Size
The game light cells are too narrow, despite the fact we manually set the dimensions. This is due to the fact that by default the
Project 4 - TV News
1. Focus Zoom Clipped
A minor change is that the
2. Can't Control-Drag to Collection View Cell
A major difference you'll notice is that the book refers to the
Pretty simple fix, if something mentioning the
So when the book says to:
You'll actually want to controll-click-drag the
3. Grid Layout Replaced with Single Wide Column
It got a lot more challenging when I got to the part where we add the constraints to the image and label in the cells and the text label was supposed to bump down a bit on focus. After control-dragging to set the contraints, the 4x3 grid layout suddenly changed to a single wide column in the centre. Took me a lot of poking to resolve the problem.
Turns out it was due to the desired width of the
4. Grid Spacing/Padding Lost
When you fix that, you'll encounter a new hiccup where the cells suddenly no longer have the correct height and spacing between. Turns out this is due to a problem when
5. ReaderViewController Error with NSAttributedString.Key
You'll get this error when trying to parse the HTML sttring in
The problem is in this code:
Project 5 - Language Pairs
1. CollectionView Cells Wrong Size
The game card cells are too narrow, despite the fact we manually set the dimensions. This is due to the fact that by default the
Project 7 - Wikimaps
1. MKMapView Throws Fatal Error
When you first add the
The downloaded complete app project opens, the graphics are borked and panning results in the above crash.
I'm going to skip this project.
Project 8 - Blastazap
1. PlayScene Not Centred
Small typo here in the book. When setting the anchor point to fix the mis-centred drawing of the
I just purchased this book and its "Hacking with tvOS 2019-05-20 (PDF)"! When was the last iteration of this book released? Is there any 2020 version?
Edit: Never mind, Paul kindly replied that the next iteration of the book with swiftui for tvos is coming next month!
SPONSORED Building and maintaining in-app subscription infrastructure is hard. Luckily there's a better way. With RevenueCat, you can implement subscriptions for your app in hours, not months, so you can get back to building your app.
You need to create an account or log in to reply.
All interactions here are governed by our code of conduct.
Link copied to your pasteboard.