Overview
These functions are helper functions that help generate content, calculate values, and/or verify something.
Helper Functions
String Split
stringSplit("string", "separator")
This function splits one string into an array of strings, separated when the separator string is found. The separator is removed.
For example:
stringSplit("Montana", "n")
Returns the array [mo, ta, a].
Conditional
conditional(#booleanVariable, value1, value2)
This function returns value 1 if the boolean variable is true or value 2 if the boolean variable is false.
Toggle
toggle(#variable or property)
This function returns the inverse of the boolean variable or boolean property.
String Contains
stringContains("string", "contains", caseSensitive)
This function returns true if the target string includes the contains string. Enter a boolean for case sensitive.
Value Between
valueBetween(number1, number2, percent, overshoot)
The function returns a number between the two values based on a given percentage.
Distance (Between Points)
distance(X1, Y1, X2, Y2)
This function returns the distance between two points, defined by their X & Y locations.
Distance (Between Values)
distance(number, number)
This function returns the distance between two values.
Unsplash
unsplash(keyword)
This function returns a random image from Unsplash based on a keyword.
Note: this function should be used to target images
Image Shuffle
imageShuffle()
This function returns a random image from the project’s assets.
Placeholder
placeholder(category)
This function returns a random string based on a category:
CTA
Name
Date
Address
City
Short Headline
Long Headline
Paragraph
Multi-Paragraph
Text Shuffle
textShuffle()
This function returns a random string based on the category.
Number
number(String)
This function converts a number to a string.
Note: it does not write the number, use a Format Number action for that.
Snapshot
snapshot(number)
Takes a snapshot of the target view.
Child at Index
childAtIndex(parent, index)
Target a specific child by its index number.
Get Subviews
getSubviews(object)
Returns an array of the object's children.
Get All Descendent Views
getAllDescendentViews
Returns an array of the object's children and all nested children.
Dictionary
dictionary()
Returns new empty dictionary.
Is Emoji
isEmoji(string)
Returns whether the provided string is an emoji.
Contains Emoji
containsEmoji(string)
Returns whether the provided string contains at least 1 emoji.
Base 64 String
base64String(string)
Converts a string to a base64 encoded string.
Set User Default
setUserDefault(key, value)
Stores a value in UserDefaults for the provided key.
Get User Default
getUserDefault(key)
Returns a stored value in UserDefaults for the provided key.
Remove User Default
removeUserDefault(key)
Removes a stored value in UserDefaults for the provided key.
JSON String
jsonString(dictionary)
Converts a dictionary to JSON string.
Decode JSON
decodeJson(string)
Converts a JSON string to a usable data structure, like a dictionary.