Hotwire Native Rails generator
Power pack to make your Rails app Hotwire Native
Installation
Install the gem:
bundle add hotwire_native_railsRun the generator:
rails g hotwire_nativeUsage
Recommended to use with my fork of iOS Hotwire Native starter app.
Helpers
-
viewport_meta_tag- forbid zooming on mobile/native - use
data: { turbo_action: replace_if_native }to submit authentication forms & forms in modals -
:mobilerequest variant.index.html+mobile.erb - override
link_toto not open internal links in in-app browser on native app - conditionally override page
<title>for native apps
CSS
-
hotwire-native:css variant (works with CSS and Tailwind)
Bridge Components
- install Hotwire Native Bridge (works with Importmaps and Node)
- add default bridge components (
Form,Menu,Button) - add
Nav(UIMenu) component - add
Review Promptcomponent -
bridge_form_with- easily apply BridgeFormcomponent
Path Configuration
-
path_configuration_controllerforiosandandroid - Tabs controller - re-route native tabs
Development
Run the local version of the gem:
gem 'hotwire_native_rails', path: '/Users/myusername/Documents/GitHub.nosync/hotwire_native_rails'Make a release to rubygems:
# 1. update version in version.rb
# 2. zip the gem
gem build hotwire_native_rails.gemspec
# 3. push the zip to rubygems
gem push hotwire_native_rails-0.4.0.gem