class
UI::LiveActivity
- UI::LiveActivity
- Reference
- Object
Overview
Export-only ActivityKit-style state for one live activity.
The state is deliberately plain data: an attributes type, the exported attributes payload, the content-state payload, and an optional update intent.
Defined in:
ui/live_activities.crConstructors
Instance Method Summary
- #add_attribute(key : String, value : String) : String
- #add_content_state_field(key : String, value : String) : String
- #attach_update_intent(intent : LiveActivityUpdateIntent) : LiveActivityUpdateIntent
- #attributes : Hash(String, String)
- #attributes=(attributes : Hash(String, String))
- #attributes_type : String
- #attributes_type=(attributes_type : String)
- #build_update_intent(identifier : String, title : String | Nil = nil, subtitle : String | Nil = nil, system_image : String | Nil = nil, user_info : Hash(String, String) = {} of String => String, is_enabled : Bool = true) : LiveActivityUpdateIntent
- #content_state : Hash(String, String)
- #content_state=(content_state : Hash(String, String))
- #identifier : String
- #identifier=(identifier : String)
- #is_active : Bool
- #is_active=(is_active : Bool)
-
#to_activitykit_scaffold(indent : Int32 = 4) : String
Export a deterministic Swift/ActivityKit scaffold for this activity.
- #to_payload(json : JSON::Builder) : Nil
- #update_intent : LiveActivityUpdateIntent | Nil
- #update_intent=(update_intent : LiveActivityUpdateIntent | Nil)
Constructor Detail
def self.new(attributes_type : String, identifier : String | Nil = nil, attributes : Hash(String, String) = {} of String => String, content_state : Hash(String, String) = {} of String => String, update_intent : LiveActivityUpdateIntent | Nil = nil, is_active : Bool = true)
#
Instance Method Detail
def build_update_intent(identifier : String, title : String | Nil = nil, subtitle : String | Nil = nil, system_image : String | Nil = nil, user_info : Hash(String, String) = {} of String => String, is_enabled : Bool = true) : LiveActivityUpdateIntent
#
def to_activitykit_scaffold(indent : Int32 = 4) : String
#
Export a deterministic Swift/ActivityKit scaffold for this activity.
The scaffold stays conservative: it mirrors the exported keys as typed string properties and records the update intent metadata as static constants so a later build step can fill in the real ActivityKit surface.