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

CupcakeCorner Challenge Trailing Closure Errors

Forums > 100 Days of SwiftUI


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?





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

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


Hacking with Swift is sponsored by Guardsquare

SPONSORED AppSweep by Guardsquare helps developers automate the mobile app security testing process with fast, free scans. By using AppSweep’s actionable recommendations, developers can improve the security posture of their apps in accordance with security standards like OWASP.

Learn more

Sponsor Hacking with Swift and reach the world's largest Swift community!

Reply to this topic…

You need to create an account or log in to reply.

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.