I mean the value never changes, so it doesn’t make sense to use here, but nevertheless it is valid Swift code. If Apple ever changes the signature, we don’t know, but I don’t see any reason for this.
Sorry if I didn’t make it clear in the original post. By "it works," I didn’t just mean that it compiles—I meant that onChange is actually triggered when views are rebuilt in such scenarios. My question is whether this behavior is intentional from the framework side (SwiftUI, not Swift as a language). If so, can this be made clearer in the documentation?