TEAM LICENSES: Save money and learn new skills through a Hacking with Swift+ team license >>

No exact matches in call to instance method 'appendInterpolation'

Forums > SwiftUI

Error but code looks correct to me? Its probally something stupid I'm missing.

:

import SwiftUI

struct CompletedWorkoutsView: View {
    @ObservedObject var exerciseData: ExerciseData

    var body: some View {
        NavigationView {
            List {
                ForEach(exerciseData.workouts) { workout in
                    Text("\(workout.exercise.name),- Sets: \(workout.sets),Counts per Set: \(workout.countsPerSet),- Weight Amount: \(workout.weightAmount)")

                }
            }
            .navigationTitle("Completed Workouts")
            .font(.caption)
        }
    }
}

2      

I'm not sure, but a lot of times when I get that kind of error, its due to this. Try adding an id parameter to your ForEach

ForEach(exerciseData.workouts, id: \.self) { workout in
    Text("\(workout.exercise.name),- Sets: \(workout.sets),Counts per Set: \(workout.countsPerSet),- Weight Amount: \(workout.weightAmount)")
}

2      

I discovered my mistake I added a var to my struct and failed to add in corresponding data to my class this is why I got the error. No sooner than I sent in this question it finally dawned on me what I forgot to do. duh...

2      

Hacking with Swift is sponsored by RevenueCat.

SPONSORED Take the pain out of configuring and testing your paywalls. RevenueCat's Paywalls allow you to remotely configure your entire paywall view without any code changes or app updates.

Learn more here

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.