Swiftpack.co - ryanslikesocool/CursorKit as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
Cursor control for SwiftUI on macOS
.package(url: "https://github.com/ryanslikesocool/CursorKit.git", from: "v1.0.0")


Cursor control for SwiftUI on macOS.

CursorKit acts as a wrapper around NSCursor for SwiftUI, and supports all default cursor types.


Install via the Swift Package Manager (File/Add Packages...)




On a SwiftUI view, add the .cursor(_ :) modifier and pass in the desired cursor type from the Cursor enum. The cursor will change to match the desired type when hovering over the view, and will reset to the standard arrow when not hovering.

import SwiftUI
import CursorKit

struct ContentView: View {
	var body: some View {
		RoundedRectangle(cornerRadius: 16)
			.frame(width: 64, height: 64)
			.cursor(.pointingHand) // <- Here! 

This modifier does not work well with moving content. If you'd like to change the cursor for something like a slider, see Advanced usage below.


More advanced cases can be achieved with the static methods in the Cursor enum
Cursor.set(cursor:) - Sets the cursor
Cursor.push(cursor:) - Pushes the cursor onto the stack and makes it active
Cursor.pop(cursor:) - Pops the desired cursor off the stack (not recommended)
Cursor.pop() - Pops the top cursor off the stack
Cursor.clear() - Resets the cursor to the standard arrow\


Stars: 0
Last commit: 1 week ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Submit a free job ad (while I'm testing this). The analytics numbers for this website are here.

Release Notes

3 weeks ago
  • First release!
  • Added basic functionality

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics