Proof of concepts for idea of handling deep link redirection inside SFSafariViewController.
- Run terminal in project root directory.
- Run
cd server
. - Run
python -m SimpleHTTPServer
. - Open
DeepLinkCheburek.xcodeproj
. - Build & Run app on simulator.
- Add custom url scheme inside
Info -> URL Types
section of target's settings. - Turn on
Allow Arbitrary Loads
flag insideinfo.plist
. - Implement
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool
method insideAppDelegate
.
Implement redirection to custom url scheme using, for example, the next script on redirecting web page:
<script>
var redirectToApp = function() {
document.location = 'my-deep-link://smth';
};
window.onload = redirectToApp;
</script>