Max Max - 1 year ago 340
Swift Question

Translucent HUD effect in Swift, like Apple Music

I am developing an iPhone app using Swift.

I would like to display a HUD much like the large tick animation and "Added to Music" popup that is displayed to users in Apple Music on iOS 9 when they add a song to their Music (see screenshot below).

How can I achieve this effect?

Apple Music tick alert

Answer Source

There is a CocoaPods that can to that: DoneHUD.

I didn't test it (first one found on CocoaControls), but it seems to do the job for your needs.

The main idea behind it:
Create a UIView that you will display on (full) screen.
You can add a UIVisualEffectView effect to it if available (iOS8+), or just use a color with some transparency (opacity < 1).
You can use UIBezierPath to draw the path of the checkmark and use then CABasicAnimation to animate the drawing effect on the layers.
Add a UILabel as it subview at the bottom if you want to add text.

There are others results on CocoaControls if you want some inspiration on how to do an HUD (Head-up display).

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download