← Back to Documentation Index ✨ PROFESSIONAL EDITION

📱 Native Mobile Framework

Hotwire Native + Turbo Offline for Cross-Platform Apps

Richard Piacentini

Project Lead: Richard Piacentini

Cheqs Global LTD

AI Research: Claude Sonnet 4.5

Suite Finalized: October 10, 2025

📝 Living Document - Updated until Rails 8.1 stable release

Rails 8.1 Feature

📋 Overview

The Native Mobile Framework combines Hotwire Native and Turbo Offline to enable building web, iOS, and Android applications from a single Rails codebase.

Key Benefits

  • 🚀 Build Once, Deploy Everywhere - Single codebase for web, iOS, and Android
  • 📴 Offline-First - Full app functionality without internet connection
  • 🔧 Native SDK Access - Use platform-specific features when needed
  • ⚡ Rapid Development - 60% faster than separate native development

🎯 What Problem Does It Solve?

Before Rails 8.1

  • Separate codebases for web, iOS, and Android
  • Triple maintenance burden for features
  • Inconsistent UX across platforms
  • Limited offline capabilities
  • High development costs

With Rails 8.1 Native Framework

  • Single Rails app powers all platforms
  • Consistent business logic and UX
  • Built-in offline support
  • Access native features when needed
  • Reduced development and maintenance costs

💡 Key Features

  • Hotwire Native: Wraps Rails web app in native iOS/Android containers
  • Turbo Offline: Enables offline-first capabilities with automatic sync
  • Native Integration: Access device cameras, GPS, notifications
  • Progressive Enhancement: Start as PWA, upgrade to native when needed

🚀 Getting Started

# Gemfile
gem 'hotwire-native-bridge'
gem 'turbo-offline'

bundle install

iOS Setup

# Via CocoaPods
pod 'HotwireNative'

Android Setup

// build.gradle
dependencies {
    implementation 'dev.hotwire:hotwire-native-android:1.0.0'
}

Configure Turbo Offline

# config/initializers/turbo_offline.rb
Rails.application.config.turbo_offline.tap do |config|
  config.enabled = true
  config.cache_pages = ["/", "/posts", "/profile"]
  config.sync_interval = 5.minutes
end

📱 Platform-Specific Features

iOS Native Integration

// iOS/Components/CameraComponent.swift
import HotwireNative

class CameraComponent: BridgeComponent {
    override func onReceive(message: Message) {
        // Use native iOS camera
        let camera = UIImagePickerController()
        present(camera)
    }
}

Android Native Integration

// Android/Components/CameraComponent.kt
class CameraComponent : BridgeComponent() {
    override fun onReceive(message: Message) {
        // Use native Android camera
        val intent = Intent(MediaStore.ACTION_IMAGE_CAPTURE)
        startActivityForResult(intent)
    }
}

📚 Related Features

  • Action Push Native - Send native push notifications to mobile apps
  • Turbo 8 Morphing - Smooth page transitions in native views
  • Active Storage - Handle file uploads from mobile cameras
  • Action Cable - Real-time updates in offline-first apps

🎓 Learn More