To provide more information, it seems that .gesture() is not recognized on the current view but on the previous view in the navigation stack on an iOS 18 device.
I happened to support two different customized zoom gestures in my two views in the navigation stack, both are implemented based on .MagnifyGesture().
When I zoom on the second page, nothing happens; but when I navigated back to the previous page, I saw the zoom gesture had been triggered.