/NiceHoverView

An elegant, customizable NSView subclass for macOS that adds smooth hover effects. Perfect for enhancing UI interactivity in your macOS apps.

Primary LanguageSwift

NiceHoverView

macOS 13.0

NiceHoverView is an elegant, customizable NSView subclass for macOS that adds smooth hover effects to enhance the interactivity of user interfaces in macOS applications.

Introduction

Screen.Recording.2024-04-29.at.16.31.30.mov

Features

  • Customizable Appearance: Easily adjust colors, radii, and more.
  • Smooth Animations: Smooth and responsive hover animations.
  • Easy to Integrate: Minimal setup required to add to your project.

Installation

Use SMP To integrate NiceHoverView into your macOS project

Usage

For NSView

To use NiceHoverView in your application, follow these simple steps:

import NiceHoverView

class YourCustomView: NiceHoverView {
    override func hoverColor() -> NSColor {
        return NSColor(white: 0, alpha: 0.1)
    }
    
    override func xRadius() -> CGFloat {
        return 20
    }
    
    override func yRadius() -> CGFloat {
        return 20
    }
    
    override func hoverRect() -> NSRect {
        return bounds
    }
}

// Initialize your view and add it to your window or view hierarchy
let customView = YourCustomView()
yourParentView.addSubview(customView)

For NSTableRowView

import NiceHoverView

final class CustomTableRowView: NiceHoverTableRowView {
    override func hoverColor() -> NSColor {
        return NSColor(white: 0, alpha: 0.1)
    }
    
    override func xRadius() -> CGFloat {
        return 20
    }
    
    override func yRadius() -> CGFloat {
        return 20
    }
    
    override func hoverRect() -> NSRect {
        return bounds
    }
}

License

This workflow is open-source and available under the MIT License.

Support and Issues

If you encounter any issues or have questions, please open an issues on this GitHub repository, and we'll be happy to assist you.