# How to serve different view for native app with hotwire?

**URL:** <https://discuss.hotwired.dev/t/how-to-serve-different-view-for-native-app-with-hotwire/2273>\
**Category:** General\
**Created:** [February 11, 2021, 6:28am UTC](https://discuss.hotwired.dev/t/how-to-serve-different-view-for-native-app-with-hotwire/2273 "2021-02-11T06:28:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![SimonBo](https://yyz1.discourse-cdn.com/flex027/user_avatar/discuss.hotwired.dev/simonbo/32/1420_2.png) [@SimonBo](https://discuss.hotwired.dev/u/SimonBo)\
**Post date:** [February 11, 2021, 6:28am UTC](https://discuss.hotwired.dev/t/how-to-serve-different-view-for-native-app-with-hotwire/2273/1 "2021-02-11T06:28:23Z")

</div>

I have an android/ios app built with hotwire adapter (based on the [demo](https://github.com/hotwired/turbo-android/tree/main/demo) app). How can I serve different views for it from my web app? I want to make sure that the views for the browser on mobile browser is different to the views served to my mobile app.

---

<div class="post-metadata">

**Author:** ![danott](https://yyz1.discourse-cdn.com/flex027/user_avatar/discuss.hotwired.dev/danott/32/2089_2.png) [@danott](https://discuss.hotwired.dev/u/danott)\
**Post date:** [February 11, 2021, 1:59pm UTC](https://discuss.hotwired.dev/t/how-to-serve-different-view-for-native-app-with-hotwire/2273/2 "2021-02-11T13:59:25Z")

</div>

If you’re using Rails, you could use [variants](https://guides.rubyonrails.org/layouts_and_rendering.html#the-variants-option) that are based on the request’s user agent. It looks like the demo app will send requests with the user agent ` "Turbo Native iOS"`. ([Defined here.](https://github.com/hotwired/turbo-ios/blob/ca008e8215c66c2a276862375709b5c819b8b8b8/Demo/SceneController.swift#L118))

Some pseudo-code for this idea might look like:

```ruby
class ApplicationController < ActionController::Base
  before_action :determine_variant

  private

  def determine_variant
    request.variant = :ios if request.user_agent.includes?("Turbo Native iOS")
  end
end

```

If you’re not on Rails, the same idea of switching on the user agent string would still be possible.
