/LCNotificationBanner

A lightweight macOS notification banner component that supports sliding in from the top, bottom, left, and right sides. It is suitable for prompt, success, and error notification scenarios of macOS App.

Primary LanguageSwiftMIT LicenseMIT

LCNotificationBanner is a lightweight macOS notification banner component!


Banner display position

  • Using enumerations to define LCNotificationBannerPosition
public enum LCNotificationBannerPosition {
    case top
    case bottom
    case leftCenter
    case rightCenter
}

Preview of Notification Animations

Success Error
Info Warning
Only Text bottom
rightCenter leftCenter

How to use

Provide Success, Info, Warning, Error, and Custom banner type

  • Background color
LCNotificationBanner.shared.bgColor = NSColor.systemBlue.cgColor
  • Position
LCNotificationBanner.shared.position = .top
  • Icon size
LCNotificationBanner.shared.iconSize = 20
  • Title Font size
LCNotificationBanner.shared.titleFontSize = 14
  • Success type
LCNotificationBanner.showSuccessWithStatus("This is a banner title", style: .dark, to: view.window)
  • Error type
LCNotificationBanner.showErrorWithStatus("This is a banner title", style: .dark, to: view.window)
  • Info type
LCNotificationBanner.showInfoWithStatus("This is a banner title", style: .dark, to: view.window)
  • Warning type
LCNotificationBanner.showWarningWithStatus("This is a banner title", style: .dark, to: view.window)
  • Text type only
LCNotificationBanner.showTextWithStatus("This is a banner title", to: view.window)

Installation

CocoaPods

LCNotificationBanner is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'LCNotificationBanner'

License

MIT License

Copyright (c) 2024 Marvin

Author

DevLiuSir

Software Engineer