listless

A simple list app for Apple platforms
Log | Files | Refs | README | LICENSE

HoverCursorModifier.swift (399B)


      1 import AppKit
      2 import SwiftUI
      3 
      4 struct TextHoverModifier: ViewModifier {
      5     let isCompleted: Bool
      6 
      7     func body(content: Content) -> some View {
      8         content.onHover { isHovering in
      9             if !isCompleted {
     10                 if isHovering {
     11                     NSCursor.iBeam.push()
     12                 } else {
     13                     NSCursor.pop()
     14                 }
     15             }
     16         }
     17     }
     18 }