Native Trail Router app for iPhone/iPad
Back in December 2020, I released a new, fully native Android app for Trail Router. Emboldened by the success of this, I thought I'd try to build an equivalent for iOS. This was no mean feat, as I've never owned an iPhone or a Mac!
I'm pleased to say that the experiment was a success though, and that a fully native iPhone/iPad app is now available. This delivers a vastly improved user experience over the old iOS app, alongside better battery life and an array of new features.
iOS users can download the new app here. Existing users will be upgraded automatically over the coming days.
Read on to discover more about the changes and how they were achieved.
Improvements and changes
- Now fully native (the previous version used a 'web view'). This results in a much smoother user experience.
- Designed for operation with one hand - all navigation and options are at the bottom of the screen.
- Preview cards of proposed routes, including a miniature version of the map and the amount of greenery on the route.
- A new 'Run mode' that places the device into full screen, blocks accidental taps on the screen and follows your location. This is deal when using the app to navigate whilst running.
- Ability to export GPX/KML files directly to other iOS apps.
- Vastly improved battery life when using Trail Router on long runs.
- Saving of your routing preferences between launches.
- Automatic resumption of your route if the app is paused and later resumed.
A first look at the user interface
Left: The landing screen allows you to quickly find a 3 mile or 6 mile round trip route from your current location, or create a custom route. Right: A list of 3 mile round trip routes discovered in my area, including small preview maps of each and elevation indicators.
Left: Clicking on the second suggested 3 mile route loads the route up full screen. I've also expanded the detailed view at the bottom that shows the elevation profile. Right: The settings screen allows users to select different map styles (such as dark mode), map overlays (such as well-lit streets and routes from fastestknowntime.com) and to adjust their greenery and hill preferences.
A quick look under the hood
After the successful release of the native Android app back in December 2020, I thought I'd try to give iOS users the same treatment. This seemed likely to be much more challenging, as I've never owned an iPhone or a Mac. This meant that I didn't know the development ecosystem at all, and - even more importantly - I didn't know what user's expectations were from apps on iOS. This meant I would be learning both as a user and a developer simultaneously! Luckily I was able to borrow an old Mac laptop and an iPhone 6S from a friend to carry out the development. Without this, the app wouldn't have been possible (you can only develop iOS apps on Mac).
The app is written in Swift 5.2, for iOS 13 and above. Development ultimately took about six weeks worth of sporadic weekend and evening work. All-in, I'd estimate I spent a solid 10 days building the app.
The app tries to follow the user experience of Apple Maps, which users seem to appreciate for its simplicity over Google Maps. For example, to get started with Trail Router, some quick links to create 3 mile or 6 mile routes are included on the landing screen.
The app uses quite a few third party libraries that I'd like to acknowledge here:
- Mapbox GL - Mapbox's native mapping library for iOS is fundamental to both the iOS and Android app, and I'm thankful for both their software and their support-in-kind of Trail Router.
- OverlayContainer - A UI library for creating the stacked overlays that swipe up/down.
- Turf - A Swift port of the popular Turf.js geospatial library.
- AlamoFire - A very nice HTTP library for Swift.
- Charts - A Swift port of the very popular MPAndroidChart library (as used in the Trail Router Android app).
I'd also like to thank Dan, Ian and Roxanne for their assistance beta testing the app before release.
Comparing app development platforms
In the near future I'll write a detailed blog post about my experiences of developing modern apps in both Android and iOS in 2021. There's certainly pros and cons to both, and I was quite surprised at just how many rough edges I encountered in both platforms.
Developing on iOS was not as painful as I expected. In fact, I've become quite a fan of the Swift language and the iPhone hardware! XCode on the other hand...
Now that Trail Router has a solid foundation of native apps for Android and iOS, I can build upon this with other native-only features. Two such features I would like to introduce in the coming months are turn-by-turn navigation and offline support. Watch this space!