Type Safely

Type Safely

Perform an Action When The Mouse Cursor Enters a View With .onContinuousHover

Daily Coding Tip 144

Millie Sturgeon's avatar
Millie Sturgeon
Aug 02, 2022
∙ Paid
assorted-color pebbles
Photo by Eric Prouzet on Unsplash

In a macOS app, it is possible to catch the event that occurs when the mouse cursor is inside the bounds of a view. Inside this closure there is an enum called HoverPhase. This has the .active case, which has the mouse location as a CGPoint associated type. Then it has an .ended case with no associated type, so we are on…

User's avatar

Continue reading this post for free, courtesy of Type Safely.

Or purchase a paid subscription.
© 2026 Type Safely · Privacy ∙ Terms ∙ Collection notice
Start your SubstackGet the app
Substack is the home for great culture