Skip to content

openTdataCH/oev-icons-swift

Repository files navigation

OeV Icons Swift

oev-icons-preview

This project exposes the official swiss OeV Icons as a Swift Package to be used on Apple platform applications.

Background

SBB publishes these icon sets on GitHub under an Apache License. SBB Icons and Timetable Icons are published on sbb-design-systems/sbb-icons. The Pictograms are published on sbb-design-systems/sbb-pictograms.

This project adds those two repositories as submodules and imports the Timetable Icons and Pictograms to an importable Swift Package.

⚠️ Due to usage restrictions on SBB Icons, those assets are excluded from the package.

For more details about icon sets visit

Usage

Add the Swift Package to your project

Add OEVIconsto your project using Swift Package Manger:

dependencies: [
    .package(url: "https://github.com/openTdataCH/oev-icons-swift.git", branch: "main"),
]

Display the icons

import SwiftUI
import OEVIcons

struct SampleView: View {
    var body: some View {
        // Directly reference assets
        Pictograms.train_right_framed
        OEVIcons.tgv


        // Display asset using image name
        Image("electric-bike-charging-station-left", bundle: Pictograms.bundle)
        Image("ev-77", bundle: OEVIcons.bundle)
    }
}

TODO

  • check if project can be added to opentransportdata
  • transform icon names in generated enum to pascal-case
  • maybe add helper functions from OJP Sample App
  • decide about a kotlin/android version

Import icons and update this project

In order to import the latest icons you have to update the submodules and run ./copy-svgs-to-assets.swift. Commit the changes on a new branch and create a pull request.

When the pull request is approved and merged, a new version tag will be set.

License

The original icons and this project are published under an Apache License. Make sure you comply with the right of use.

About

The official Swiss OeV Icons in Swift! 🚞

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages