GO FURTHER, FASTER: Try the Swift Career Accelerator today! >>

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      

Hacking with Swift is sponsored by Essential Developer.

SPONSORED Transform your career with the iOS Lead Essentials. Unlock over 40 hours of expert training, mentorship, and community support to secure your place among the best devs. Click for early access to this limited offer and a FREE crash course.

Click to save your free spot now

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

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.