Learn Courses My Dashboard

Apple Watch App?

I was surprised to not see a single topic dedicated to the Apple Watch in all of CWC+! Did I miss it anywhere?

I would like to build a simple Apple Watch app, and open source it. The app would remind people to stand up every 20 minutes for at least eight minutes. It would allow people to customize these timings as well. Also, it would buzz to queue the person to stand up or sit down. By default the watch does this every hour at least once, so I’d like this other app, where you could customize the time.

Chris does not have any watch tutorials, sadly

But please add it to the ideas board he has!! Others can upvote it and it can become more of a priority

Here’s a place to start though, Apple’s docs

1 Like

Awesome, thanks for that confirmation, the link to submit this idea, and for the starting tutorial from Apple’s docs! That seems like a great tutorial. Some of Apple’s other docs can be kind of terse/ dense, but this one seems super-slick and professional. I’ll give a shot, thanks :slight_smile:

Another thing about Chris’s videos I like is that he will take us to the developer documentation. Most of the time, I don’t understand what they’re talking about, but through Chris’s explanations it makes sense. It took me more than a year to be able to read Python’s docs as well, so I hope I learn this much swifter (pun intended :wink: ) with CWC+

1 Like

Looks like someone already beat me to it :slight_smile: I added the 50th up-vote

Also, so glad to see there’s now a tutorial for MacOS apps

1 Like

@mikaelacaron turns out it is not too difficult to add a companion watchOS app to a normal iOS app! It can use the same ViewModel as the main app, plus re-use some of its views/ notifications. Maybe Chris’s Recipe app, or Video app would make for good iOS companion apps as well. One thing, I like about the Apple Watch is as you watch a video, or listen to music it shows you the typical player information, song/ video title, fast-forward/ go-backwards and pause types of interactions.

Some of the things that Apple does differently versus some of the CWC+ videos is to ensure that each View’s preview works. So it was kind of refreshing to see the screen pop-up with a rendering as soon as you type.

Also, I like how the tutorial has you test against the smallest and largest screen sizes. Chris touched on this a few times in the Foundations course, but I’d like to learn how to make Views work on the various screen sizes better. I hope the Design course goes over this.

I also liked how Apple would show previews for two scenarios, depending on whether/ not the Object was nil, through a Group:

static var previews: some View {
    Group {
    NotificationView(title: "Turtle Rock", message: "You are within 5 miles of Turtle Rock.", landmark: ModelData().landmarks[0])

Another interesting modifier is the .lineLimit(0) that’s used to prevent any additional lines. It produces the run-on text above that goes off the screen, because it was place on the VStack.

Although, one thing I didn’t like is that they would have you code elements of the screen that you couldn’t see in the Preview unless, you entered up the live preview mode, then swiped down. Perhaps making these elements into a separate View would have been a better way to visualize them before letting them trail further down in a ScrollView.

It was also interesting to see special code added to the app called a conditional compilation that only uses this code in the build, if the target is for watchOS:

#if os(watchOS)
    controller: NotificationController.self,
    category: "LandmarkNear"

Although, I was dissapointed at the end that my test notification did not display.

1 Like

Created a repo with the finished project/ screens here, if anyone’s curios: GitHub - agholson/Landmarks-Apple-Watch-app