Hotwire Native iOS v1.3.0 BETA
Lazy tabs, animated replace actions, custom error views, and more.
I just released a new version of Hotwire Native iOS, 1.3.0-beta.
This is the first time we’ve released a beta for Hotwire Native. We had a lot of approved pull requests waiting on Android feature parity.
So I proposed publishing what we have and the other maintainers agreed. Now you get to try the new iOS features before they are officially released!
Here’s what’s included:
Tabs are now loaded lazily
This is easily the biggest feature request we’ve received since launching first party tabs earlier this year. Before, when your app launched it would load each tab at the same time. 5 tabs meant 5 simultaneous network connections to your server.
Now, each tab is only loaded when switched to. This means less load on your server and more predictable flows around authentication and modals.
Full changes in PR #157.
The tab bar can now hide screens on push
When a new screen is pushed onto the stack you can now have the tab bar slide away with it. Here’s a before (left) and after (right) demoing how it looks:
Opt-in to this behavior by setting:
Hotwire.config.hidesTabBarWhenPushed = true
Full changes in PR #159.
Replace actions can now be animated
Previously, when performing a data-turbo-action=”replace”
visit the new screen would flash white before loading. You can now animate the transition with a nice fade.
Opt-in to this behavior by setting:
Hotwire.config.animateReplaceActions = true
Full changes in PR #166.
Error views can now be customized
You can now customize your native error views by providing a custom SwiftUI View
:
struct MyErrorView: View {
let error: Error
let onRetry: ErrorPresenter.Handler?
var body: some View {
VStack {
Text(”Uh oh…”)
Text(error.localizedDescription)
if let onRetry {
Button(”Try again”, action: onRetry)
}
}
}
}
Then pass it along to the configuration:
Hotwire.config.makeCustomErrorView = { error, handler in
AnyView(MyErrorView(error: error, onRetry: handler))
}
Full changes in PRs #158 and #163.
Other fixes and improvements
Give it a try!
Please give the beta a spin and let us know what you find. We’d love to fix any outstanding issues before the official release.
When adding the Swift package, set the Exact Version to 1.3.0-beta
in Xcode: