为什么我在调用实例方法"scaleEffect"时收到此错误 没有完全匹配?



您好,因为我是swiftUI的初学者,我目前正在udemy平台上进行培训,但我遇到了一个我无法解决的问题。由于我是初学者,我仍然难以理解一些错误,如果您能在我的学习中启发我,那将是很好的,我有以下错误"没有精确匹配调用实例方法'scaleEffect'">

提前感谢您

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()
}
}

being a beginner in swift I did not try to do anything in particular 

您在声明中拼错了变量名。改成imageScale

最新更新