Accessibility: Part 2 | raywenderlich.com


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/4001741-swiftui/lessons/27

This might be a dumb question, but since we’re manually including these accessibility labels, is it common to localize these labels for different languages? So in theory, would it be the more common practice to create a collection of these labels (accessibility or otherwise), translate that collection, and then refer to those elements in an itemized fashion based on the language of the user?

That sounds like a really good idea in reality. To keep the course more concise I didn’t get round to including something like this here. SwiftUI was so fresh at the time and there’s a lot to take in already haha! In the future we will cover Accessibility in a lot more detail and might include doing this as you’ve raised a really good point. Laurie.

I open the PO3E07-Starter, ContentView, build the preview and then switch from Preview to Live-Preview. As soon as I click the “+” button I get Preview Crashed with a red X in red circle.
Same thing happens if I do AlarmOverviewView.

Same failure if I use P03E07-Complete.
Same failure for iPod touch and iPhone 11.

Catalina 10.15.7; Xcode 12.1;

This is happening on my end as well. Same specs.

I had the same crash on Xcode 12.1. It doesn’t crash on Xcode 11.7.

Update: I stumbled on a workaround that seems to work with Xcode 12.1 / iOS 14. In AlarmOverviewView, I added this print statement:

var body: some View {
  // HACK: Why does this fix the crash?
  print("\(alarmList)")

  return NavigationView {
  ...

And the crash was gone. I can add new alarms, and any details I enter are reflected in the overview.

Hey guys - my apologies I was away for a week. I don’t know why the crash is happening on live previews - this is such a common issue that in this course you can see me stop using live previews many times and simply using the simulator with a build and run. I just run the completed code and it works with a build on the sim - hopefully we’ll get more stability soon for the previews. Thanks! Laurie.