FR: Expand animation support for SF Symbols
Describe the solution you'd like
I am building out a workflow with the gear.badge SF Symbol and would like to be able to utilize the .rotate.byLayer animation style when items are being addressed. For example, the following could be leveraged for a spinning gear:
sf=gear.badge,color=auto,weight=regular,animation=rotate.byLater
https://developer.apple.com/design/human-interface-guidelines/sf-symbols#Animations shows the following additional animation types which would be useful to include support for:
- .appear
- .disappear
- .breathe
- .breathe.pulses
- .breathe.byLayer
- .breathe.byLayer.pulses
- .rotate (uses default direction)
- .rotate.clockwise
- .rotate.counterclockwise
- .rotate.byLayer (uses default direction)
- .rotate.byLayer.clockwise
- .rotate.byLayer.counterclockwise
.appear would be useful when kicking up notifications that include SF Symbols and .replace would be useful when echoing out updates to the Dialog command file. I can see something where the following could be passed in to handle my workflow:
- To start, I would use
--icon sf=gear.badge,color=auto,weight=regular,animation=appearwith my initial call to launch a swiftDialog notification. This would pop up the notification and fade ingear.badge - To animate, I would expect to use
echo "icon: sf=gear.badge,color=auto,weight=regular,animation=rotate.byLayer" >> $dialogCommandFile - Once items are done processing and I no longer need the animation, I would plan to use the following commands to provide a clean transition:
- Stop animation
echo "icon: sf=gear.badge,color=auto,weight=regular" >> $dialogCommandFile - Transition to Success/Fail:
echo "icon: sf=gear.badge.xmark,color=auto,weight=regular" >> $dialogCommandFileorecho "icon: sf=gear.badge.checkmark,color=auto,weight=regular" >> $dialogCommandFile - I would expect that we would not need to worry about users needing to use the
.replaceanimation style but I would expect that whenever I pass a new SF Symbol icon into an existing swiftDialog menu, it would use.replaceand use Magic Replace if supported. If I wanted to omit that, maybe an extra flag could be passed in but I am not sure I can think of use cases where I would not want to use that since it looks very clean.
- Stop animation
Describe alternatives you've considered Use other SF Symbol icons match the use case and have supported animation types in the project
This will have to wait for v3
While I could put in a conditional if #available(macOS 15, *) That requires Xcode 16 which swiftDialog currently does not compile satisfactorily under so I'm stuck on Xcode 15 for the time being. The v3 branch will be able to add support for updated symbol animations
I'm not sure if this would be possible, but would it be a better option to directly pass the Swift code for animations (i.e., .symbolEffect(.rotate.clockwise.byLayer, options: .nonRepeating)), instead of using swiftDialog to parse it?
This way swiftDialog wouldn't need to be updated for every change like this that Apple makes to SF Symbols.
yeah that's not really how it works. I can certainly make it more generic and support a wider range of modifiers but any solution is still going to require a case statement to manage the conversion of a text string to type SymbolEffect which means when new effects are added in, they won't be available until a re-compile.
Also any effects will need to be available in the macOS 14 sdk which, for reasons mentioned above, I am currently limited to.