SwiftUI Essentials - iOS 16 Edition Errata

SwiftUI Essentials - iOS 16 Edition was published on September 14, 2022. The current revision is 1.0a. The revision of your copy of the book can be found in the copyright page at the start of the book.

Known Issues with Revision 1.0

Section 31.7 Designing the Content View

The code second code block in this section incorrectly reads as follows:

    var body: some View {
        List {
            ForEach (carStore.cars) { car in
                ListCell(car: carStore.cars[i])
        }
      }
    }
}

The above code should be replaced with the following:

    var body: some View {
        List {
            ForEach (0..<carStore.cars.count, id: \.self) { i in
                ListCell(car: carStore.cars[i])
            }
        }
    }
}

Known Issues with Revision 1.0 and 1.0a

24.14 Detached Tasks

The code example in this section should be calling Task.detached() instead of Task() as follows:
let detachedTask = Task.detached(priority: .medium) {
    await doSomething()
}

51.4 Testing the App

There appears to be a problem with the iOS simulators provided with Xcode that prevent CloudKit code from working during app testing. To test the CloudKit demo app created in this chapter, you will need to do so on physical devices.

Section 56.3 Widget Configuration Types

The StaticConfiguration and IntentConfiguration declarations in this section should not include the placeholder parameter and should read as follows:
public var body: some WidgetConfiguration {
    StaticConfiguration(kind: kind, provider: Provider()) { entry in
        SimpleWidgetEntryView(entry: entry)
    }
.
.
public var body: some WidgetConfiguration {
    IntentConfiguration(kind: kind, 
       intent: LocationSelectionIntent.self, provider: Provider()) { entry in
          SimpleWidgetEntryView(entry: entry)
     }

Section 56.7 Widget Provider

The function signatures for getSnapshot() and getTimeline() in this section should read as follows:

.
. 
    func getSnapshot(for configuration: ConfigurationIntent, in context: Context,    
              completion: @escaping (SimpleEntry) -> ()) {
.
.
    }
 
    func getTimeline(for configuration: ConfigurationIntent, in context: Context,    
        completion: @escaping (Timeline) -> ()) {
.
.

Section 56.11 Widget Sizes

The IntentConfiguration declaration in this section should not include the placeholder parameter and should read as follows:

IntentConfiguration(kind: kind, 
     intent: LocationSelectionIntent.self, provider: Provider()) { entry in
        SimpleWidgetEntryView(entry: entry)
}

Section 57.9 Modifying the Widget Provider

The function signatures for getSnapshot() and getTimeline() in this section should read as follows:
.
.
func getSnapshot(for configuration: ConfigurationIntent, in context: Context, 
    completion: @escaping (WeatherEntry) -> ()) {
.
.
func getTimeline(for configuration: ConfigurationIntent, in context: Context, 
    completion: @escaping (Timeline) -> ()) {
.
.

Section 58.1 Supporting Multiple Size Families

The IntentConfiguation declaration in this code example should not include the placeholder parameter and should read as follows:

public var body: some WidgetConfiguration {
    IntentConfiguration(kind: kind, intent: ConfigurationIntent.self, 
                                     provider: Provider()) { entry in
        WeatherWidgetEntryView(entry: entry)
    }
.
.

Section 59.1 Adding Deep Link Support to the Widget

The function signature for getSnapshot() in this section should read as follows:

func getSnapshot(for configuration: ConfigurationIntent, in context: Context, 
    completion: @escaping (WeatherEntry) -> ()) {

Section 60.3 Modifying the Widget

The function signature for getTimeline() in this section should read as follows:

func getTimeline(for configuration: ConfigurationIntent, in context: Context, 
              completion: @escaping (Timeline) -> ()) {

If you have encountered an issue with the book not listed above please contact us as at [email protected] and we will work to resolve the issue for you as quickly as possible.



Featured Titles


$29.99$29.99$29.99$9.99
Tell me more... Tell me more... Tell me more... Tell me more...

$29.99$9.99$9.99$24.99
Tell me more... Tell me more... Tell me more... Tell me more...