WordPress rewrites my link with custom URL scheme to http(s)

I think your problem is that an HTML page is a single point of reference. Swift allows you to define that custom URL in your app ( https://www.hackingwithswift.com/example-code/system/how-to-make-your-app-open-with-a-custom-url-scheme) but WordPress rewrites itself and all sub-pages, api etc. to the URL defined in the database options. So, short answer, you can’t do that. If you were to set the URL of the WordPress site to myapp://whatever.com it would break. Do you have to use myapp:// ?