PS:
That is how I use this solution in my app...
.onHover { isHovered in
self.imageHovered = isHovered
DispatchQueue.main.async {
if self.imageHovered {
// Looks like ugly hack, but otherwise cursor gets reset to standard arrow.
// See https://stackoverflow.com/a/62984079/7964697 for details.
NSApp.windows.forEach { $0.disableCursorRects() }
// swiftlint:disable:next force_unwrapping
NSCursor(image: NSImage(named: "ZoomPlus")!, hotSpot: NSPoint(x: 9, y: 9)).push() // Cannot be nil.
} else {
NSCursor.pop()
NSApp.windows.forEach { $0.enableCursorRects() }
}
}
}
Post
Replies
Boosts
Views
Activity
Maybe, this reply will help you: https://stackoverflow.com/a/67851290/7964697