|
Hello everyone! I'm almost finished with BucketList's challenge but I found this error: This is my code:
|
|
Try to retype |
|
Thanks for replying! I did that but now it appears a new error in the In the ContentView, the ViewModel was created like this --> I'm working in the challenge and I created the ViewModel for the EditView. This is it:
|
BUILD THE ULTIMATE PORTFOLIO APP Most Swift tutorials help you solve one specific problem, but in my Ultimate Portfolio App series I show you how to get all the best practices into a single app: architecture, testing, performance, accessibility, localization, project organization, and so much more, all while building a SwiftUI app that works on iOS, macOS and watchOS. Sponsor Hacking with Swift and reach the world's largest Swift community! |
|
That is correct Just remove the $ at the switch:
That is what I have... |
|
Thanks @VulcanCCIT ! That helped but now I'm getting this error: |
|
|
|
The error message "The compiler is unable to type-check this expression in reasonable time" is common in Swift. It means the compiler is confused, either because of a syntax error in your code or a bug in the compiler. Usually, refactoring your view into smaller views either will solve the problem or will result in a more informative error message. In this case, try refactoring |
|
I do not think the suggestin that @bobstern has is it as I just checked the HackingWithSwift+ solution and your code is almost identical with the exception of the .toolbar { } code, the solution has a slightly different save function but other than that your code is spot on. Just to be sure comment out the code in between the brackets after your Button("Save") { //comment out this code} but I would suggest first to clean your build folder and or start xcode over...both have solved your issue for me in other code. Hope that helps! |
|
Actually it does not look like you are passing information correctly to your save function...try this:
|
|
Thanks @VulcanCCIT and @bobstern ! I forgot to remove the |
|
@KeyBarreto glad I could help! I didnt catch the $ at the ForEach that has tripped me up before as well! |
BUILD THE ULTIMATE PORTFOLIO APP Most Swift tutorials help you solve one specific problem, but in my Ultimate Portfolio App series I show you how to get all the best practices into a single app: architecture, testing, performance, accessibility, localization, project organization, and so much more, all while building a SwiftUI app that works on iOS, macOS and watchOS.
Sponsor Hacking with Swift and reach the world's largest Swift community!
You need to create an account or log in to reply.
All interactions here are governed by our code of conduct.
Link copied to your pasteboard.