This is a library you can include in your Swift projects. It contains a Swift version of the GTFS binding.
This project started as a way to modularize a different project I was working on. MIT license.
In your Package.swift
put something like this:
let package = Package(
name: "MyPackage",
dependencies: [
.Package(url: "https://github.com/danramteke/SwiftGtfsSupport", Version(0,0,1)),
]
)
And in code, once you have the GTFS data as binary,
let feed = try TransitRealtime_FeedMessage(serializedData: gtfsData)
- Install
protoc
viabrew install protobuf
or from https://github.com/google/protobuf - clone https://github.com/apple/swift-protobuf
cd swift-protobuf && swift build
protoc --swift_opt=Visibility=Public --swift_out=./Sources/ --plugin=../swift-protobuf/.build/debug/protoc-gen-swift gtfs-realtime.proto
Plus, it means this code is in a separate package, keeping your project clean and organized 💅🏽