This is the code for an iOS widget showing weather information for your current location. As of iOS 14, you can also put widgets on your home screen! This widget can be installed through Scriptable, a platform for iOS automation via JavaScript. It uses an API from the National Weather Service of the United States, so it only works in the US.
The widget shows the name the National Weather Service assigns to your current location. Below this location name are plots of various weather measures. The next 28 hours of data are visualized. To the left of the plot are the max and min values the plot takes. Here’s a legend for the symbols used:
For more info, see the API documentation.
weather-widget.js
to the directory for your Scriptable.
~/Library/Mobile Documents/iCloud~dk~simonbs~Scriptable
.+
in the upper right. Scroll down to (or type to filter for) Scriptable. Add a small widget.weather-widget.js
.