I have a map pin view that represents an action.
This is the code
VStack {
ActionView(action: place.actions.first!)
.frame(width: 35, height: 35)
Text(self.displayPlaceName ? place.name : "")
}.overlay(
Image(systemName: "arrowtriangle.left.fill")
.rotationEffect(Angle(degrees: 270))
.foregroundColor(place.actions.first!.color())
.offset(y: 10)
)
The pin can represent only one action.
If there are two actions I would like to see half of both pin. something like that.
Thanks, Nicolas



One way to hide half of a view is by applying a gradient mask. If we put two stops in the gradient at the same location with different colors, we get an instant change (a step) in the gradient rather than a smooth transition. Some code:
Result:
We can swap the gradient colors to show the other half of the masked content. So, we can use a
ZStackcontaining two callouts, with opposite halves masked:Result:
The result is a sharp cut between the two callouts. You can fade one into the other by replacing the step in the gradients with an interpolation:
Result:
Here's the source for my
Calloutview in case you want to play with it: