Skip to content

Architecture

Chris Meyer edited this page Jul 28, 2021 · 5 revisions

Model, Updates, Changes

The model within Swift is comprised of numerous objects such as data items, display items, and computations.

The model objects can be read and modified at any time from the main thread, including during async methods. The model objects can also be read from secondary threads, although care must be taken to ensure the objects are in a consistent state.

In order to support undo, modifications to the model objects should be performed through undoable commands.

TODO: How does the API allow modifications?

To support the highly dynamic nature of various UI elements and computations, changes to model objects trigger change events: property change events and item inserted/removed events. Other model objects and UI may be listeners for those change events and act accordingly.

Unfortunately, this system of change events and listeners is showing its limitations and we are searching for a better system. The difficulties are with threading, consistency of state, intermediate properties and objects, and ease of implementation.

One possible approach is using something similar to ReactiveX. Unfortunately ReactiveX does not address the issue of dynamic lists or consistency of state and only marginally addresses threading.

Clone this wiki locally