cauli
cauli copied to clipboard
Where should it be possible to enable/disable a floret in code?
Current Scenario
The Floret protocol defines a var enabled: BOOL { get set }
.
Pro
- The
xyzFloret.enabled = true
is a very simple and clear way to enable / disable a floret
Con
- Every implementation of Floret has to define this property itself.
- The initial value of
enabled
is undefined. Every Floret can define that for itself and thus it is going to be inconsistent. - The Cauli instance itself isn't informed about changes. If we somewhen want to act upon that a floret was enabled / disabled, we would have to observe the
enabled
property.
Alternate Scenario
A Cauli
instance is initialized with all florets, which are disabled. To enable a floret a user can use the CauliViewController and a developer can use a cauli.enable(floret)
function.
Pro
- Consistent state of every floret.
Con
- Florets can currently be either structs or objects. So comparing them by identity is not given.