Skip to content

NotificationBanner Release v1.1.0

Compare
Choose a tag to compare
@Daltron Daltron released this 29 Apr 18:11
· 324 commits to master since this release

New Features:

Custom Banner Style Colors

You can now override the predefined colors that NotificationBanner uses for any style by conforming to the BannerColorsProtocol:

public protocol BannerColorsProtocol {
    func color(for style: BannerStyle) -> UIColor
}

Its as easy as creating a custom banner colors class:

class CustomBannerColors: BannerColorsProtocol {

    internal override func color(for style: BannerStyle) -> UIColor {
        switch style {
            case .danger:   // Your custom .danger color
            case .info:     // Your custom .info color
            case .none:     // Your custom .none color
            case .success:  // Your custom .success color
            case .warning:  // Your custom .warning color
        }
    }
       
}

And then passing in that class to any notification banner you create:

let banner = NotificationBanner(title: title, style: .success, colors: CustomBannerColors())
banner.show()

Swipe Up Support

Notification banners (by default) will now also be dismissed if the user swipes up on the banner. To detect when a user swipes up on a banner, simply:

banner.onSwipeUp = {
	// Do something regarding the banner
}

Better Documentation

Added more documentation for most functions in most of the classes