← All Guides
Getting Started with Flows
Flows are the bridge from a data source to your widget. You can think of flows as a chain reaction from top to bottom, inputs to outputs. Let’s try creating a simple flow to get a random inspirational quote.
Be sure to add the data source “Quotable”, as shown in Building a Dynamic Widget
Making the Flow
- On the flows tab, tap the plus icon in the upper-right corner. For the name, enter “Random Quote”, and tap “Add Flow”.
- Tap “Add Action” to bring up the action sheet. Here we can see a categorized list of every action available to us. Any data source you add will be available in this list. We want a random inspirational quote, so we can use the "Quotable" data source we added earlier. Search for “random quote” and tap on the entry that appears to add the action.
- Next, fill in each input of the action. To see more information about any input from a data source, navigate to the source in the Data Sources tab (Learn More). For maxLength enter “50”, for minLength enter “0”, and for tags enter “wisdom”.
maxLength and minLength allow us to specify how long of a quote we want. Since our widget is fairly small, we can limit the quote to be a maximum of 50 letters so we can be sure it will fit. The tag specifies the kind of quote we want. The inputs available will change depending on the data source and action you use. You can learn more about any of these inputs from the Data Sources tab.
4. Tap the play icon in the upper-right corner to run the flow. A box will appear with the output. You should see a quote appear in the box.Making the Widget
The flow is now ready to be used in a widget:
- On the “My Widgets” tab, tap the plus icon in the upper-right corner. Choose “Text” from the list of templates.
- For the name, enter “Random Quote”.
- Tap “Choose Icon” and search for “quote”. Tap on an icon to select it.
- Under “Connected Flows”, choose the “Random Quote” flow you created earlier. A blue check will appear on the left.
- Tap in the “Title” text field. A list of variables will appear above your keyboard. We want the author and content of the quote to be the title and content respectively. Tap Quote. A sheet will appear asking you to select the information you want from the quote. Choose Author. Now the author will be used for the title.
- Tap in the “Content” text field. Tap Quote again, but this time choose Content. Now the quote's content will be used for the content.
- Tap “Add Widget”. You should now see your widget in the gallery, with the Author of the quote, and the Content of their quote below it:
🎉 You just made your first dynamic widget! Try experimenting with other data sources and flow actions. The next guide will show how chaining flow actions together can give powerful results.
Previous
‹ Building a Dynamic Widget
Next
Chaining Flow Actions ›