Makie observable lift functions

With lift you need to be careful that the return type of your first invocation also works for all other possible branches because that’s the type parameter that the observable uses. So if you first return an integer and later a float, the float will fail to convert to an integer.

Sometimes you have a union of types like Union{Nothing, Float64}, in that case I usually create an empty observable first with the correct type parameter like result = Observable{Union{Nothing, Float64}} and then use the map! function on that with the logic you’d otherwise put into lift

2 Likes