UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

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.

4      

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.

4      

Hacking with Swift is sponsored by RevenueCat

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.

Learn more here

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.