I wrote this script because I take the Bart to work every day
I needed to know when the next few trains would arrive at my stops.
With a glance I can see if I should hustle, or, wait for the next one.
This widget runs on iOS via the Scriptable (App Store) app.
You'll also need a Google Maps API key.
Sorry 😖
I really struggled to make this as plug-and-play as possible for you.
I even wrote two blogs and recorded a Youtube video to demonstrate how to install this.
Ultimately, the whole tutorial became less about the code and more about Google Cloud Console.
That said, I had lots of practice and can now condense all the setup into a few short steps:
Step 1. Create a new project in Google Cloud Console and title it Transit Widget
- This ensures the project
id
istransit-widget
which will make all links below work. - https://console.cloud.google.com/projectcreate
Step 2. Visit the below link and click Enable
to add the Directions API
to your project
Step 3. Visit the below link page and click + Create Credentials
at the top
You now have your API key! Save this somewhere
Step 4. Click on the link to your API, which should take you to the API key dashboard.
Step 5. Under API restrictions
select only the Directions API. Click Save.
Step 6. Visit the below link to enable billing for your project
I think the dark mode version looks better in all cases, but I created a light mode variant as well.
It will swap automatically to light mode depending on your iOS configuration.
Special thanks to a few people:
Romo, who asked me to share the setup for my transit widget multiple times. Here you go 😄
Lillian, who dutifully trudged through all the videos and blogs, twice 🙏
Josh W. Comeau, who inspires me as a web engineer 🎆
Simon B. Støvring, the creator of Scriptable 💡