class UI::SwipeAction

Overview

A single swipe action attached to a SwipeActionRow.

On iOS / mobile-web: revealed by swiping the row horizontally. On macOS / desktop-web: rendered inline as a visible trailing button.

#role accepts :default, :destructive, :cancel. The renderer maps destructive to the platform-native danger tint (red on iOS / macOS / web via --ap-color-danger-text).

#icon is the SF Symbol name on iOS / macOS, ignored elsewhere.

#on_tap is the callback fired when the user activates the action. On iOS / macOS it's registered through the existing Phase 3 CallbackRegistry so the Crystal Proc isn't GC'd while native code holds a function pointer to it.

Defined in:

ui/views/swipe_action_row.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(label : String, on_tap : Proc(Nil) | Nil = nil, role : Symbol = :default, icon : String | Nil = nil, on_tap_route : String | Nil = nil) #

[View source]

Instance Method Detail

def icon : String | Nil #

[View source]
def icon=(icon : String | Nil) #

[View source]
def label : String #

[View source]
def label=(label : String) #

[View source]
def on_tap : Proc(Nil) | Nil #

[View source]
def on_tap=(on_tap : Proc(Nil) | Nil) #

[View source]
def on_tap_route : String | Nil #

Optional route id the web renderer wires to a client-side UIRouteHost.push() invocation. The static-site web target cannot invoke Crystal Procs client-side, so demos that need runtime swipe-button interactivity supply this string.


[View source]
def on_tap_route=(on_tap_route : String | Nil) #

Optional route id the web renderer wires to a client-side UIRouteHost.push() invocation. The static-site web target cannot invoke Crystal Procs client-side, so demos that need runtime swipe-button interactivity supply this string.


[View source]
def role : Symbol #

[View source]
def role=(role : Symbol) #

[View source]