Aria 2.0.0
C++23 MVVM framework (C++20 minimum) — reactive, coroutine-first, ABI-layered
Loading...
Searching...
No Matches
aria::adapters::uikit::UIKitAdapter Class Reference

#include <UIKitAdapter.hpp>

Inheritance diagram for aria::adapters::uikit::UIKitAdapter:
[legend]

Instance Methods

() - UIKitAdapter
() - ~UIKitAdapter
() - UIKitAdapter
(UIKitAdapter &) - operator=
(std::string_view) - platform_name
(UIKitView &) - view_for
 Wrap a native UIView* as an IView owned by this adapter.
(void) - release_view
 Drop the cached UIKitView for view, if any.
(void) - set_text
(std::string) - get_text
(::aria::Subscription- on_text_changed
(void) - set_bool
(bool) - get_bool
(::aria::Subscription- on_bool_changed
(void) - set_int
(int) - get_int
(::aria::Subscription- on_int_changed
(void) - set_int64
(std::int64_t) - get_int64
(::aria::Subscription- on_int64_changed
(void) - set_uint64
(std::uint64_t) - get_uint64
(::aria::Subscription- on_uint64_changed
(void) - set_float
(float) - get_float
(::aria::Subscription- on_float_changed
(void) - set_double
(double) - get_double
(::aria::Subscription- on_double_changed
(void) - set_visible
(void) - set_enabled
(::aria::Subscription- on_click
Instance Methods inherited from aria::binding::IViewAdapter
virtual ~IViewAdapter ()

Constructor & Destructor Documentation

◆ UIKitAdapter [1/2]

- adapters:

◆ ~UIKitAdapter

- adapters:

◆ UIKitAdapter [2/2]

- adapters: (const UIKitAdapter &)

Method Documentation

◆ operator=

- (UIKitAdapter &) adapters: (const UIKitAdapter &)

◆ platform_name

- (string_view) aria: const

◆ view_for

- (UIKitView &) adapters: (UIView *) view

Wrap a native UIView* as an IView owned by this adapter.

Every host used to hand-roll this: allocate a UIKitView, then park it in a keepalive container because BindingEngine takes IView& and does not own its views. (The common workaround — a process-global std::vector<UIKitView> — never releases anything, so it leaks by construction.) The adapter already keeps a per-view registry for its ObjC control targets, so it is the natural owner.

engine.bind_text(vm.name, adapter->view_for(nameField));

Calling - view_for twice for the same UIView* returns the same UIKitView, so multiple bindings on one control share a single per-view subscription bucket in BindingEngine.

Lifetime — matches the AppKit adapter, and differs from Qt's on purpose: UIKitView retains its UIView* via ARC, so a cached view keeps the control alive and there is no "native handle died first" event to evict on. Entries live until the adapter is destroyed (which fires each IView's destroy signal and releases the bindings), or until - release_view is called for a control the host discards early — a popped view controller, a recycled cell.

Passing nil is a programming error and throws std::invalid_argument.

◆ release_view

- (void) adapters: (UIView *) view

Drop the cached UIKitView for view, if any.

Fires that view's destroy signal, so BindingEngine releases every binding wired to it, and releases the adapter's ARC reference to the control. Calling it for an unknown view is a harmless no-op.

◆ set_text

- (void) adapters: (::aria::binding::IView &) v
(std::string_view) text 

◆ get_text

- (string) aria: (::aria::binding::IView &) v

◆ on_text_changed

- aria: (::aria::binding::IView &) v
(std::function< void(std::string_view)>) cb 

◆ set_bool

- (void) adapters: (::aria::binding::IView &) v
(bool) value 

◆ get_bool

- (bool) adapters: (::aria::binding::IView &) v

◆ on_bool_changed

- aria: (::aria::binding::IView &) v
(std::function< void(bool)>) cb 

◆ set_int

- (void) adapters: (::aria::binding::IView &) v
(int) value 

◆ get_int

- (int) adapters: (::aria::binding::IView &) v

◆ on_int_changed

- aria: (::aria::binding::IView &) v
(std::function< void(int)>) cb 

◆ set_int64

- (void) adapters: (::aria::binding::IView &) v
(std::int64_t) value 

◆ get_int64

- (int64_t) aria: (::aria::binding::IView &) v

◆ on_int64_changed

- aria: (::aria::binding::IView &) v
(std::function< void(std::int64_t)>) cb 

◆ set_uint64

- (void) adapters: (::aria::binding::IView &) v
(std::uint64_t) value 

◆ get_uint64

- (uint64_t) aria: (::aria::binding::IView &) v

◆ on_uint64_changed

- aria: (::aria::binding::IView &) v
(std::function< void(std::uint64_t)>) cb 

◆ set_float

- (void) adapters: (::aria::binding::IView &) v
(float) value 

◆ get_float

- (float) adapters: (::aria::binding::IView &) v

◆ on_float_changed

- aria: (::aria::binding::IView &) v
(std::function< void(float)>) cb 

◆ set_double

- (void) adapters: (::aria::binding::IView &) v
(double) value 

◆ get_double

- (double) adapters: (::aria::binding::IView &) v

◆ on_double_changed

- aria: (::aria::binding::IView &) v
(std::function< void(double)>) cb 

◆ set_visible

- (void) adapters: (::aria::binding::IView &) v
(bool) visible 

◆ set_enabled

- (void) adapters: (::aria::binding::IView &) v
(bool) enabled 

◆ on_click

- aria: (::aria::binding::IView &) v
(std::function< void()>) cb 

The documentation for this class was generated from the following file: