BLACK FRIDAY SALE: Save big on all my Swift books and bundles! >>

Hacking with watchOS Tutorial Project 1 -- Thread 1: Fatal error

Forums > watchOS

Hi Paul, I purchased the Hacking with WatchOS tutorials back in March and am finally getting around to learning and I'm encountering a runtime error that I've been unable to correct. In Project 1, I was unable to get the numbered rows to display as shown on page 140; but I continued on.

My current issue is that when I run Project 1 on my Apple Watch, it correctly does the voice-to-text transcription; but then doesn't display the note after I select "done." In Xcode, it says" Thread 1: Fatal error: Unexpectedly found nil while implicilty unwrapping an Optional value."

When I compare this function with what's in the provided source code example, it looks identical; so unclear what I've done wrong here inside InterfaceController.swift. Please help.

func set(row rowIndex: Int, to text: String) {
    guard let row = table.rowController(at: rowIndex) as? NoteSelectRow else { return }
    row.textLabel.setText(text)
}

Thank you.

1      

Hi robert22

I have not done this one I did SwiftUI HW watchOS.

However looks like when it want to use the text is still nil. You might want to look at @IBAction Button where func set(row rowIndex: Int, to text: String) is called to check that it not passing in a nil value.

1      

Hacking with Swift is sponsored by RevenueCat

SPONSORED In-app subscriptions are a pain to implement, hard to test, and full of edge cases. RevenueCat makes it straightforward and reliable so you can get back to building your app. Oh, and it's free if your app makes less than $10k/mo.

Learn more

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.