[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

--

--

--

https://www.linkedin.com/in/jaesik-kim-706b4a84

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Pagination in SwiftUI

Weather: it is nice outside +

Create Beautiful Text Effects in SwiftUI With SpriteKit

7 AlertView Options in SwiftUI

Evolution of the Medium iOS app architecture

S is for Superb

MVC & MVVM: Implementation of MVVM In RxSwift

Just-in-time mutability

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
J.Kim

J.Kim

https://www.linkedin.com/in/jaesik-kim-706b4a84

More from Medium

Generating JWT for AppStore Connect API with JWTKit in Swift

Handling Concurrency with Async Await in Swift

How to use Tink Link iOS with Expo

Resolve a question about pthread_rwlock_t