I am apptemting to learn SwiftUI, Swift, and Xcode for macOS. The code below works but I’d like to have no warnings. The complete warning is:
‘onChange(of:perform:)’ was deprecated in macOS 14.0: Use
onChange
with a two or zero parameter action closure instead.
but I cannot interpret it. I’m using macOS 15
This works but the warning is generated.
.onChange(of: thisImageIndex) { newValue in
// Update currentDatum when the index changes
if newValue >= 0 && newValue < imageList.count {
currentDatum = imageList[newValue]
imageCaption = currentDatum!.displayName
}
}
2
Answers
I figured it out for my purpose! I guess I'm getting better at this!
To remove warning, you need to update your code to add old value