Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Yalir/BezelNotification
A Swift package for displaying bezel notifications in macOS
https://github.com/Yalir/BezelNotification
Last synced: 3 months ago
JSON representation
A Swift package for displaying bezel notifications in macOS
- Host: GitHub
- URL: https://github.com/Yalir/BezelNotification
- Owner: Yalir
- License: mit
- Created: 2020-01-04T14:18:39.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-11-07T17:05:16.000Z (about 4 years ago)
- Last Synced: 2024-03-26T02:56:06.527Z (8 months ago)
- Language: Swift
- Homepage:
- Size: 3.66 MB
- Stars: 11
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-macos-libraries - BezelNotification - A Swift package for displaying bezel notifications in macOS. Language: Swift. (Toast-and-Popup)
README
# 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](demo.gif)
### Integration (SPM)
Just add this repo in your dependencies.
### Usage
```swift
let bezel = BezelNotification(text: "This is a sample message.")
bezel.runModal()
// or
bezel.show()
```
or
```swift
let bezel = BezelNotification(dismissInterval: 3.0)
bezel.text = "Hello!"
bezel.show()
```
or
```swift
let bezel = BezelNotification(dismissInterval: nil)
bezel.text = "Hello!"
bezel.show()
// do your work// Explicitly dismiss now:
bezel.dismiss()
```