Post

Replies

Boosts

Views

Activity

Comment on Multilevel Array Appending
I got two errors. Both on the guard let line. First error was "Cannot convert value of type 'String' to expected argument type 'Plan'". I fixed this by changing the type of plan name from String to Plan. The second error was "Referencing instance method 'firstIndex(of:)' on 'Collection' requires that 'Plan' conform to 'Equatable'". I added Equatable to the Plan Model but wasn't sure what protocol stubs should be.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jun ’23
Comment on Multilevel Array Appending
The function looks good but since I'm using a UUID for the plan id instead of an Int, I am unable to give it a value when I call it in my view. Is it possible to have planIndex take a UUID instead of an Int? I tried switching the plan id to and Int but would just cause different errors.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jun ’23
Comment on Multilevel Array Appending
That worked! Thanks for the help. Was stuck on this for a while!
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jun ’23
Comment on Multilevel Array Appending
I got two errors. Both on the guard let line. First error was "Cannot convert value of type 'String' to expected argument type 'Plan'". I fixed this by changing the type of plan name from String to Plan. The second error was "Referencing instance method 'firstIndex(of:)' on 'Collection' requires that 'Plan' conform to 'Equatable'". I added Equatable to the Plan Model but wasn't sure what protocol stubs should be.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jun ’23
Comment on Multilevel Array Appending
The function looks good but since I'm using a UUID for the plan id instead of an Int, I am unable to give it a value when I call it in my view. Is it possible to have planIndex take a UUID instead of an Int? I tried switching the plan id to and Int but would just cause different errors.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jun ’23
Comment on Multilevel Array Appending
I did try that initially but got an error: "Cannot use mutating member on immutable value: 'forPlan' is a 'let' constant".
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jun ’23
Comment on Multilevel Array Appending
Got the error "Value of type 'Plan' has no member 'insert'". It looks like that will add an element to Plan but I want to add an element to exercise which is an array in Plan
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jun ’23