NEW: Learn SwiftData for free with my all-new book! >>

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 }

Thank you.


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.


Hacking with Swift is sponsored by Judo

SPONSORED Let’s face it, SwiftUI previews are limited, slow, and painful. Judo takes a different approach to building visually—think Interface Builder for SwiftUI. Build your interface in a completely visual canvas, then drag and drop into your Xcode project and wire up button clicks to custom code. Download the Mac App and start your free trial today!

Try now

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.