Calling Swift function from JavaScript and JS function from Swift

When we develop a web app for iOS devices, we need to know how to call JavaScript function from Swift and also how to call Swift function from JavaScript.

Here let me bring you full codes for ViewController.swift and the html file that I loaded it locally.



And here is the html file

URL Schemes

Another thing that you must configure is URL Schemes. Look what I’ve set here:

Published by


Habibie is an Indonesian freelance programmer familiar with PHP, MySQL, HTML5, CSS3, JavaScript, Java, Swift, Python and C#. He makes Android and iOS games and apps. He's also good at graphics design, video editing, visual effect and animation.

Leave a Reply

Your email address will not be published. Required fields are marked *