swift-cross-ui icon indicating copy to clipboard operation
swift-cross-ui copied to clipboard

Update backends to avoid use of dictionaries for auxiliary data storage

Open stackotter opened this issue 1 month ago • 0 comments

At the moment, some backends make heavy use of dictionaries to store information such as button click handlers (such as WinUIBackend and its associated InternalState class). This leads to apps slowly using more and more memory, and is also a bit efficient in terms of compute as well (but probably not as much).

The solution to this, which some backends already employ, is to subclass widgets that we need to store auxiliary data about, and add properties to our subclasses to store said data. This ensures that the data gets freed along with the widgets, and also makes it trivial to access the auxiliary data whenever it is needed.

stackotter avatar Nov 28 '25 07:11 stackotter