Making a custom iOS shortcut

Coding your own iOS shortcut is a great gateway to beginning coding. The process is intuitive and clean, and it exposes you to concepts used throughout programming. In this tutorial, we'll make a shortcut that returns customizable weather information; doing so will teach

If you want to learn about any of those concepts, specific to shortcuts or in general, keep reading!

End product

By following this article, you'll make a shortcut that displays weather information. Furthermore, you'll be able to customize the information it displays as well as the length of the forecast.

My motivation for making it was simple: as of spring 2020, there are no (free) iOS widgets that display a 15 hour temperature forecast with hourly rain predictions. You'll be able to change the length and contents (maybe you want 24 hours with temperature, wind, and rain), but I wanted to know at breakfast if I was going to get rained on biking to or from campus that day.

Here's what that looks like for me TODO

How do I store values in shortcuts?

We'll use location and forecast information throughout the shortcut; storing that data in variables makes our program clean and flexible. First, let's store text in a variable. We're using the OpenWeather API to retreive forcast information and need to provide an access key.

image Here

Now, instead of typing that gross alphabet soup everytime we need it, we can just type OWAPIKey (make monospace?). Also, if our alphabet soup were to change in the future, we would just need to update the above command instead of hunting for every instance of the key throughout our program.

How do I call an external API from a shortcut?