DEV Community

donnellycarroll
donnellycarroll

Posted on

Bridges

Native -
Bridge components:
3 building blocks

  1. HTML markup - where your server configures the component
  2. The Stimulus controller subclass - where messages are passed between web and native
  3. The native component - where Swift generates the UI and interacts with native APIs

Build new bridge:

  1. Add the HTML markup use double dashes -- when referencing Stimulus controller --> allows us to namespace our bridge component controllers under the bridge/ directory, keeping them separate from traditional Stimulus controllers.
  2. Create a Stimulus controller
  3. Create a native component

Respond to Button Taps
On the web, we used send() to pass a message to native code. To pass a message _from _ native code to the web we have reply(to:).

Top comments (0)

OSZAR »