WWDC24 SALE: Save 50% on all my Swift books and bundles! >>

CupcakeCorner Challenge Trailing Closure Errors

Forums > 100 Days of SwiftUI

@ian  

I am following the HWS+ video solution for the final challenge of Cupcake Corner and running to some errors I can't figure out.

I am getting two: Trailing closure passed to parameter of type 'FormStyleConfiguration' that does not accept a closure errors. One in addressView.swift and one in ContentView.swift both on the Form { }

I have tried replacing the files with copies from the solution file. Copy and pasting code and using FileMerge to compare each of the files with the functioning GitHub ones to see if there are any obvious errors.

How can I track down what is causing this error?

Thanks!

Screenshots

Source

2      

You are actully missing some code in the SharedOrder which is causing the error. It should be this

@dynamicMemberLookup
class SharedOrder: ObservableObject {
    static let types = ["Vanilla", "Strawberry", "Chocolate", "Rainbow"]

    @Published var data = Order()

    subscript<T>(dynamicMember keyPath: KeyPath<Order, T>) -> T {
        data[keyPath: keyPath]
    }

    subscript<T>(dynamicMember keyPath: WritableKeyPath<Order, T>) -> T {
        get {
            data[keyPath: keyPath]
        }

        set {
            data[keyPath: keyPath] = newValue
        }
    }
}

PS you will get a warning Non-constant range: not an integer range just add , id: \.self in the ForEach

2      

Save 50% in my WWDC sale.

SAVE 50% To celebrate WWDC24, all our books and bundles are half price, so you can take your Swift knowledge further without spending big! Get the Swift Power Pack to build your iOS career faster, get the Swift Platform Pack to builds apps for macOS, watchOS, and beyond, or get the Swift Plus Pack to learn advanced design patterns, testing skills, and more.

Save 50% on all our books and bundles!

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.