Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

35 Commits

Repository files navigation

Transit

Transit strives to be the Swiftiest way to interact with a GTFS static dataset feed.

Introduction

The General Transit Feed Specification, or GTFS, is a dataset specification that enables a transit agency to describe a transit system to developers. More formally, GTFS is actually comprised of two data specifications: the GTFS Static Specification and the GTFS Real-Time Specification. The GTFS Static Specification describes those features of a transit system that remain reasonably static (i.e., transit routes, stops, schedules, etc.). The GTFS Real-Time Specification, on the other hand, describes the moment-to-moment state of a transit system (i.e., where specific vehicles are located, estimated arrival times, etc.). The Transit package currently supports the GTFS Static Specification (the GTFS Real-Time specification may be supported in the future). Within this document, GTFS should always be interpreted as referring to the GTFS Static Specification.

Installing Transit

Transit is distributed as a Swift package. There are many online tutorials which describe how packages can be installed in an Xcode project.

Usage Example

To use Transit, simply instantiate a Feed with the contents of a folder containing GTFS datasets. You can then ask the feed for agency, route, and stop data.

// Create a feed
letfeedURL=URL(fileURLWithPath:"path-to-folder-containing-GTFS-datasets"!)letfeed=Feed(contentsOfURL: feedURL)
// Get the agency name from the feed
iflet agencyName = feed.agency?.name {print(agencyName)}
// Print info for every route in the feed
iflet routes = feed.routes {forroutein routes {print(route)}}
// Print info for every stop in the feed
iflet stops = feed.stops {forstopin stops {print(stop)}}

Documentation

Transit has embraced Apple’s DocC documentation compiler. DocC makes it simple to add documentation for a project. Please refer to the documentation included within the Transit package for details on Transit’s use or for help.

About

The Swiftiest way to work with GTFS data feeds.

Topics

Resources

Stars

38 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages