Customizing display frequency
In the previous section, we discussed creating display logic for our tips using rules and tip groups. However, tips can overwhelm users; there’s a fine line between helping the user and disturbing them. Adjusting all the rules to set a reasonable limit on the number of tips the user sees can be challenging. For that problem, we can manage the frequency at which our tips display.
Let’s start with setting the max display count for a tip.
Setting the max display count for a specific tip
The first and essential thing we can do is set the maximum number of a specific tip type that can be displayed.
We do that by adding a new variable to our tip called options
:
struct AddListTip: Tip { var options: [TipOption] { Tips.MaxDisplayCount(2) } }
In this code example, we use the MaxDisplayCount
static function of the Tips
namespace. That definition...