Skip to content

A foreground notification banner library, easy to use and customizable.

Notifications You must be signed in to change notification settings

joehour/NotificationBanner

Repository files navigation

NotificationBanner

A foreground notification banner library, easy to use and customizable.

Features

  • Provide Success, Info, Warning, Error, and Custom banner type.
  • Adapt itself to the device orientation.
  • Handle click event.

Requirements

  • iOS 8.0+
  • Xcode 8.0+ Swift 3

Installation

CocoaPods

Check out Get Started tab on cocoapods.org.

To use NotificationBanner in your project add the following 'Podfile' to your project

pod 'NotificationBanner', '~> 1.0.4’

Then run:

pod install

Source Code

Copy the NotificationBanner Directory to your project. Go ahead and import NotificationBanner to your file.

Example

Please check out the Example project included.

Usage

  • Sample:
import NotificationBanner

class ViewController: UIViewController, NotificationBannerDelegate {
    
    override func viewDidLoad() {
        super.viewDidLoad()

        //Show NotificationBanner
        showNotificationBanner(bannerStyle: .successMessage, bannerLocation: .Top,
                               messageTitle: "Success", messageContent: "This is a Success notification")
        
    }

    
    //NotificationBanner click event(required)
    func notificationBannerClick(_ view: NotificationBannerView) {
        
        //Dissmiss NotificationBanner
        dissmissBanner(completion: { Sucess in _ = Bool()
            if(Sucess){
              
            }
        }
        )
   
    }
}

Customization

You can configure NotificationBanner properties.

  • NotificationBanner style(Success, Info, Warning, Error, and Custom banner type)*
bannerStyle: .successMessage   //Success style
bannerStyle: .infoMessage     //Info style
bannerStyle: .warningMessage  //Warning style
bannerStyle: .errorMessage    //Error style
bannerStyle: .customView      //Custom style
  • NotificationBanner location on the view
bannerLocation: .Top     //Top
bannerLocation: .Bottom  //Bottom
  • NotificationBanner title message
messageTitle: String     //title message
  • NotificationBanner content message
messageContent: String     //content message
  • NotificationBanner title string font
messageTitleFont: CGFloat     //title string font, default is 25
  • NotificationBanner content string font
messageContentFont: CGFloat     //content string font, default is 15
  • NotificationBanner Height
bannerHeight: Int     //banner height, default is 80
  • NotificationBanner hold time(second)
bannerHoldTime: Int     //banner hold time, default is 5 sec
  • If your bannerStyle is .customView(Custom style), you can configure bannerBackgroundColor and bannerImage properties
bannerBackgroundColor: UIColor     //banner background color
bannerImage: UIImage               //banner icon image

License

NotificationBanner is available under the MIT License.

Copyright © 2016 Joe.

About

A foreground notification banner library, easy to use and customizable.

Resources

Stars

Watchers

Forks

Packages

No packages published