SBB Design System Mobile and ML frameworks are now OpenSource

  • SBB Design System Mobile: A SwiftUI framework allowing for an easy integration of SBB theming to your app. All elements are optimized for dynamic TextSizes, VoiceOver, light & dark mode as well as for different SizeClasses.
  • SBB ML: A Swift framework simplifying the integration of CoreML (ObjectDetection) models into iOS Apps using Combine and SwiftUI.

Why OpenSource?

As the in-house agency at Swiss Federal Railways for everything Mobile-related, we started creating libraries a long time ago for our internal and external mobile apps. This allowed us to avoid code-duplication, ensure quality standards across all apps and most importantly to develop apps faster.

SBB Design System Mobile (SwiftUI)

Since the introduction of SwiftUI (and Combine) we were huge fans of its declarative syntax, its improvements for accessibility and that it embraced a clearer separation of concerns on the architecture side (see SwiftUI App Architecture). At the same time our existing internal Design System Mobile was due for an update. So we started working on a newer version together with our friends from the UX team.

SBB Design System Mobile with custom theming.

SBB ML (SwiftUI & Combine)

Our journey into Machine Learning started quite a few years ago with our first Image Classification models. Since then, we’ve come a long way. Currently, our dataset contains over 70'000 labelled images with bounding boxes for over 150 SBB-specific objects.

Demo of our current ObjectDetection model.
Architecture overview of the SBB ML framework.

Quality standards for OpenSource frameworks

The day we started working on our mobile libraries, we defined some quality standards, that we wanted to meet. In fact we think that all libraries should embrace them:

  • Testing: Reasonable code coverage.
  • Demo App showcasing the framework’s functionality.
  • Clean documentation of all public interfaces.
  • Automated CI pipeline which executes all tests on every branch and pushes to the stores automatically.

Testing

This one seems quite straightforward for the case of the SBB ML framework: We wrote unit tests for all classes and additionally test the object detection part by feeding in reference images (instead of using the camera livestream as a source).

Demo App

SBB Design System Mobile and SBB ML framework demo app.

Clean Documentation

A few years ago we typically had a huge ReadMe file explaining how to use a framework. With the introduction of the DocC compiler in XCode 13 we luckily were able to simplify our ReadMe file and to move the documentation of the framework’s interfaces to the place were it belongs. Directly into the code and then auto-generate the documentation. Right now, user’s can generate the documentation directly in XCode (under Product → Build Documentation). However we are planning to host all of our documentations online in the future.

Raw Markdown-documentation (left) and it’s auto-generated DocC counterpart (right).

Automated CI Pipeline

Our internal projects are pushed to an internal BitBucket server setup with hooks to a Jenkins instance which then builds, tests, archives and pushes new versions to the stores using Fastlane. This ensures, that all tests need to be green before merging a pull request and that our projects are permanently buildable. However this internal BitBucket server is only reachable by a secure VPN connection.

XCode Cloud integration in GitHub.

Next steps

The SBB Design System Mobile and SBB ML frameworks for iOS are the first in a series of libraries we intend to publish as OpenSource. In the coming months we’d like to collect first experiences.

  • Will they be used and forked by a large user-base?
  • Will people start contributing to them?

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
AppBakery

AppBakery

In-house agency for Mobile Apps & Web at Swiss Federal Railways #sbbcffffs