I only just discovered that this isn't valid:
var isEditable: Bool = true { #if !os(tvOS) willSet { child.isEditable = newValue } #endif }
Does the compiler optimize out empty didSet/willSet (making it equivalent to say willSet { #if ...), or is this a missing feature?
willSet { #if ...
It should be equivalent, but even if the extra subroutine call is not optimized away, I would not expect it to make any kind of difference in this kind of code. Subroutine calls are very cheap on modern CPUs.
this example suggests the willSet does get optimized out when the conditional is false.
willSet