0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Learning the basics of app development with Hotwire Native

Posted at

I’ve been learning Hotwire Native recently through Joe Masilotti’s Hotwire Native for Rails Developers book, while also continuing to learn Rails. The code examples in this post are from the book. It’s been really interesting to see how both come together. The biggest benefit with Hotwire Native is that all the business logic stays on the Rails server. That means you don’t have to rebuild the same logic separately for iOS and Android apps and everything runs through the same backend, which feels clean and efficient.

Even things like modal (a screen or window that pops up on top of the current view) presentation can be configured through Rails. After adding a route in routes.rb, you can set up a controller that returns JSON for the app to read. For example:

carbon.png
This tells the app that any URL path ending in /new or /edit should open as a modal. The nice part is that you can change this behavior from the server side later without having to release a new version of the mobile app.

For some reason, I was expecting the Rails code to be more complicated if it needs to handle both the mobile and the web apps, but luckily it wasn't so difficult, at least for the basic tasks. For example:
carbon-2.png
It is pretty easy to understand just from the code what this does and you might already guess that the example project in the book is to create an app for hikers.

Another neat thing I found was enabling the pull to refresh was really easy and made the app feel a lot more native. It is something I personally use every day on my phone so actually creating something like that myself feels really motivating.
carbon-3.png
Of course, it shouldn't be used everywhere, so it is good to know how (and when) to disable it too, like in the context of modals.
carbon-4.png
This was just a brief write-up about my first impressions of Hotwire Native, but I'm really enjoying it and excited to learn more! I’ll be making more small posts about my learning journey soon(ish).

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?