- Install Scriptable for iOS
- Copy/Paste the code into a new file
- Adjust colors/font
- Add the script to a widget (medium)
- It should appear similar to the screenshots
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const url = `https://projects.fivethirtyeight.com/2020-election-forecast/us_simulations.json`; | |
const req = new Request(url); | |
const res = await req.loadJSON(); | |
if (config.runsInWidget) { | |
const biden = res[0].simulations.filter((x) => x.winner === 'Biden').length; | |
const trump = res[0].simulations.filter((x) => x.winner === 'Trump').length; | |
let widget = new ListWidget(); | |
widget.backgroundColor = new Color('#000'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const url = "https://xkcd.com/info.0.json" | |
const req = new Request(url) | |
const { img: imgUrl } = await req.loadJSON() | |
const imgReq = await new Request(imgUrl) | |
const img = await imgReq.loadImage() | |
// for development, displays the widget if run | |
const debug = false; |