Value of type 'some View' has no member 'onChange'

I'm new to SwiftUI and when I use the onChange modifier I get the following error.

Value of type 'some View' has no member 'onChange'


Here's the section of my code and if I remove line 9 - 26 my code will compile.

Code Block
           GeometryReader{reader in
            VStack {
              Image("race2")
                .resizable()
                .aspectRatio(contentMode: .fill)
               .frame(width: UIScreen.main.bounds.width, height: reader.frame(in: .global).minY > 0 ? reader.frame(in: .global).minY + (UIScreen.main.bounds.height / 2.2) : UIScreen.main.bounds.height / 2.2)
                .offset(y: reader.frame(in: .global).minY)
                .onChange(of: reader.frame(in: .global).minY){value in
                  let offset = value + ( UIScreen.main.bounds.height / 2.2)
                  if offset < 80 {
                    if offset > 0 {
                      let opactity_value = (80 - opactity) / 80
                      self.opacity = Double(opactity_value)
                      return
                    }
                    self.opacity = 1
                  }
                  else {
                    self.opacity = 0
                  }
              }
            }
          }


Answered by OOPer in 629939022
Are you using Xcode 12? onChange is a new feature available only in new SDKs bundled with Xcode 12.
Accepted Answer
Are you using Xcode 12? onChange is a new feature available only in new SDKs bundled with Xcode 12.
That's the answer! Thank you, I wasn't.
Value of type 'some View' has no member 'onChange'
 
 
Q