you need to pair your Mac. see:
https://learn.microsoft.com/en-us/dotnet/maui/ios/pair-to-mac?view=net-maui-9.0
basically VS2022 uses SSH to execute shell commands on the Mac. The pairing is basically configuring the VS2022 SSH component (ip, username and password). Once the connection is working, VS will check for an Xcode install. to build it copies files to Mac and runs Xcode.