Selected Text
Inserts the selected text and applies a transformation to it.
iOS Compatibility
On iOS, it's not always reliable to get the selected text.
When you expand snippets using Snippety Keyboard, the selected text is used by default. However, in keyboard settings, you can enable the option to use the Clipboard content instead to ensure more reliable behavior.
When you expand snippets in the Snippety app, the Clipboard content is used instead.
Parameters
1️⃣ Transformation (default: None)
The transformation to be applied to the selected text.
See Text Transformations.
Syntax
{@selected-text@}
or
{@selected-text|Upper Case@}
Use Cases
This placeholder is useful when you want to insert the selected text into your template. It might be helpful when you want to wrap the selected text with some additional content, and optionally apply a transformation.
Example 1
You want to select a link and wrap it with a Markdown hyperlink:
[Read more]({@selected-text@})
Example 2
You want to select a text and wrap it with a HTML tag:
<p style="color: red;">{@selected-text@}</p>
Example 3
You want to reuse the same name in different parts of your template, which requires the name to be in different formats.
Dear Supplier,
Could you please send us the most recent price list for {@selected-text@}?
{@selected-text|Start Upper Case@} are in high demand and we need
to update our prices.
Best regards,
Purchasing Department
Example 4
You want to create a snippet that generates a template to test a class with the selected name. In this case, usually you need to reuse the class name in different formats.
final class {@selected-text|Pascal Case@}Tests: XCTestCase {
private var {@selected-text|Camel Case@}: {@selected-text|Pascal Case@}!
override func setUp() {
super.setUp()
{@selected-text|Camel Case@} = {@selected-text|Pascal Case@}()
}
}