Skip to content

Latest commit

 

History

History
38 lines (30 loc) · 1.06 KB

README.md

File metadata and controls

38 lines (30 loc) · 1.06 KB

BezelNotification

A utility class for displaying Xcode-like notifications, aka bezel notifications. It currently supports displaying a given text that will be centered on screen, will remain on screen for the specified amount of time, then fade out. Alternatively, you can explicitly decide when fade out should happen. You also have the ability to use formatted text through NSAttributedString.

It is based on Core Animation and NSVisualEffectView, all written in Swift 5. It requires macOS 10.14 or later. UI is written in code only to be able to distribute this as a Swift package.

Bezel notification demo

Integration (SPM)

Just add this repo in your dependencies.

Usage

let bezel = BezelNotification(text: "This is a sample message.")
bezel.runModal()
// or
bezel.show()

or

let bezel = BezelNotification(dismissInterval: 3.0)
bezel.text = "Hello!"
bezel.show()

or

let bezel = BezelNotification(dismissInterval: nil)
bezel.text = "Hello!"
bezel.show()
// do your work

// Explicitly dismiss now:
bezel.dismiss()