No exact matches in call to instance method 'scaleEffect' ?

Hello as I am a beginner in swiftUI I am currently following a training on the udemy platform but I encounter a problem that I can't solve. As I'm a beginner I still have trouble understanding some errors, if you could please enlighten me in my learning it would be nice I have the following error "No exact matches in call to instance method 'scaleEffect'"

Thanking you in advance

//
//  ContentView.swift
//  Pinch
//  Created by Jules Fakhouri on 23/11/2022.
//

import SwiftUI

struct ContentView: View {
    // MARK: - PROPERTY

    @State private var isAnimating: Bool = false
    @State private var ismageScale: CGFloat = 1

    // MARK: - FUNCTION

    // MARK: - CONTENT

    var body: some View {
        NavigationView {
            ZStack{
               // MARK - PAGE IMAGE
                Image("magazine-front-cover")
                    .resizable()
                    .aspectRatio(contentMode: .fit)
                    .cornerRadius(10)
                    .padding()
                    .shadow(color: .black.opacity(0.2), radius:12, x: 2, y: 2)
                    .opacity(isAnimating ? 1 : 0)
                    .scaleEffect(imageScale)
                    // MARK - 1 TAP Gesture
                    .onTapGesture(count: 2, perform: {
                        if imageScale == 1 {
                            withAnimation(.spring()) {
                            imageScale = 5
                        }
                    } else {
                        withAnimation(.spring()) {
                            imageScale = 1
                        }
                    }
                })

            } // ZSTACK
            .navigationTitle("Pinch & Zoom")
            .navigationBarTitleDisplayMode(.inline)
            .onAppear(perform: {
                withAnimation(.linear(duration: 1)) {
                    isAnimating = true
                }
            })
        }  // NAVIGATION
        .navigationViewStyle(.stack)
    }
}


struct ContentView_Previews: PreviewProvider {
    static var previews: some View {
        ContentView()
    }
}

Answered by BabyJ in 737409022

Your issue seems to be caused by a typo on this line:

@State private var ismageScale: CGFloat = 1
// typo            ^^^^^^^^^^^


I'm assuming it should be imageScale like you have used everywhere else in your program. The error is not as helpful as it could be but it does show you there is something wrong with the call to scaleEffect(_:) – there is no variable named imageScale to use.

Accepted Answer

Your issue seems to be caused by a typo on this line:

@State private var ismageScale: CGFloat = 1
// typo            ^^^^^^^^^^^


I'm assuming it should be imageScale like you have used everywhere else in your program. The error is not as helpful as it could be but it does show you there is something wrong with the call to scaleEffect(_:) – there is no variable named imageScale to use.

No exact matches in call to instance method 'scaleEffect' ?
 
 
Q