Native Hook
An escape hatch: calls a function you write yourself at a declared extension point.
About 1 minutes
For programmers. Native Hook calls a function you write yourself in the Wear OS or Apple Watch project, when an event fires. Use it for the rare job WristForge has no action for. Your code lives outside the files WristForge builds, so rebuilding never wipes it.
Last resort, not first
Try an Action Sheet or an On Event first. Native Hook is for when the answer has to be real platform code.
Settings
| Setting | What it does |
|---|---|
| function | The name of the function to call, for example openStore. Use letters, numbers and no spaces. |
| on event | The event that calls it, such as a Tappable's tap event. |
You can also call it from any action list: pick the object and choose Native Hook ▸ Call.
Writing the function
When you build, each screen with a Native Hook gets an empty, named place for your code:
- Wear OS: the screen gets a hooks class with an empty function of that name. Make your own class that extends it, override the function, and pass it to the screen.
- Apple Watch: the screen gets a property of that name that does nothing by default. Set it to your own code.
Good to know
- Nothing happens in Preview, since your code only exists in the watch project.
- Games and apps, not watch faces.