[Swift] Two-way communication between iOS Webview and React

Scenario:

  • React application will be rendered using Webview on iOS
  • Clicking the ‘Click me’ button will send data to iOS and native alert will pop up (Javascript to iOS)
  • Closing the native pop up will send a newly generated UUID from iOS to React application and it will be rendered (iOS to Javascript)

Preview:

Implementation:

React

Swift

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store