|
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 - Flashlight1. CollectionView Cells Wrong SizeThe 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 News1. Focus Zoom ClippedA minor change is that the 2. Can't Control-Drag to Collection View CellA 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 ColumnIt 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 LostWhen 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.KeyYou'll get this error when trying to parse the HTML sttring in
The problem is in this code:
Remove the
Project 5 - Language Pairs1. CollectionView Cells Wrong SizeThe 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 - Wikimaps1. MKMapView Throws Fatal ErrorWhen 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 - Blastazap1. PlayScene Not CentredSmall typo here in the book. When setting the anchor point to fix the mis-centred drawing of the
|
|
Damn.. I did the book some time ago with older version of Xcode 11 and stuff mostly worked. However I had some inexplainable issue with Table View where I could not create cells so I opened Xcode 10 and did the layout in this version. Feels like tvOS is kind of ignored by Apple. |
|
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! |
|
Hello! Yes, this book is scheduled for a full rewrite for SwiftUI, and is next in line – November, all being well! |
SPONSORED Take the pain out of configuring and testing your paywalls. RevenueCat's Paywalls allow you to remotely configure your entire paywall view without any code changes or app updates.
Sponsor Hacking with Swift and reach the world's largest Swift community!
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.
Link copied to your pasteboard.