How to change the cursor to a hand when hovering over a Link View in SwiftUI?

1 · Ram · Oct. 13, 2023, 8:39 p.m.
import SwiftUI extension Link { func pointingHandCursor() -> some View { self.onHover { inside in if inside { NSCursor.pointingHand.set() } else { NSCursor.arrow.set() } } } } In this code, we’ve created an extension for Link called pointingHandCursor() that sets the cursor behavior. You can use this extension to apply the cursor change to any Link in your SwiftUI views, making it more convenient to use...