Skip to content

rahimkhalid/RONotificationView

Repository files navigation

RONotificationView

CocoaPods CocoaPods

Requirements

  • iOS 11.0+
  • Xcode 9.0

Demo

Message Banner StatusBar Banner
Progress Bar Banner Custom Banner

Installation

Just add the RONotificationView folder to your project.

or use CocoaPods with Podfile:

pod 'RONotificationView'

Usage

  1. To use RONotificationView, you would be needing to create RONotificationConfiguration object. This configuration object is used to customize you banner.
  • Customizations allowed:

    • For StatusBar Banner

      isToAnimateView (Bool) -- For enable/disable hide, show animations
      duration (TimeInterval) -- If need to hide view after some time. [Set 0 if want to hide manually]
      messageTextColor (UIColor) -- To set message text color
      backgroundColor (UIColor) -- To set banner background color
      message (String) -- To set message
      messageFont (UIFont) -- To set message Font

    • For Message Banner

      isToAnimateView (Bool) -- For enable/disable hide, show animations
      messageFont (UIFont) -- To set message Font
      titleFont (UIFont) -- To set title Font
      duration (TimeInterval) -- If need to hide view after some time. [Set 0 if want to hide manually]
      titleTextColor (UIColor) -- To set title text color
      messageTextColor (UIColor) -- To set message text color
      backgroundColor (UIColor) -- To set banner background color
      image (UIImage) -- To show image on left side of banner
      title (String) -- To set title
      message (String) -- To set message
      isToShowLoader (Bool) -- To show loader on right side of banner

    • For ProgressBar Banner

      isToAnimateView (Bool) -- For enable/disable hide, show animations
      backgroundColor (UIColor) -- To set banner background color
      isToShowProgressCount (Bool) -- To show ProgressCount in centre of progressBar
      progressBarColor (UIColor) -- To set progressbar color
      progressCountFont (UIFont) -- To set count font
      progressCountColor (UIColor) -- To set count text color
      progressBarStartPosition (Float) -- To set start value for progressBar (default = 0)
      progressBarCurrentPosition (Float) -- To set current value for progressBar (incase to start from different value other than start position)
      progressBarEndPosition (Float) -- To set end value for progressBar
      isToAnimateProgressBarGradient (Bool) -- Used to animate progressbar

    • For Custom Banner

      isToAnimateView (Bool) -- For enable/disable hide, show animations
      duration (TimeInterval) -- If need to hide view after some time. [Set 0 if want to hide manually]

  • Creating Configuration Object

    • For StatusBar Banner
      let configuration = RONotificationStatusBarBannerConfiguration(message: MESSAGE, isToAnimateView: True)
      
    • For Message Banner
      let configuration = RONotificationMessageConfiguration(title: TITLE, message: MESSAGE, isToAnimateView: true)
      
    • For ProgressBar Banner
      let configuration = RONotificationProgressBarBannerConfiguration(progressBarColor: BAR_COLOR, progressBarStartPosition: 0, progressBarEndPosition: 100, isToAnimateView: true)
      
    • For Custom Banner
      let configuration = RONotificationCustomViewConfiguration(duration: DURATION, isToAnimateView: true)
      
  • To change value after creating Configuration:

    configuration.isToAnimateView = True
    ...
    
  1. After creating configuration for StatusBar Banner, You need to create StatusBar Banner Object.
  • Creating RONotificationView object:

    • For StatusBar Banner
      banner = RONotificationStatusBarBanner(presentOn: configurationView, config: configuration)
      
    • For Message Banner
      banner = RONotificationMessageBanner(presentOn: configurationView, config: configuration)
      
    • For ProgressBar Banner
      banner = RONotificationProgressBarBanner(presentOn: configurationView, config: configuration)
      
    • For Custom Banner
      banner = RONotificationCustomBanner(presentOn: configurationView, config: configuration, customView:customView)
      
    • For Banner on Window
      banner = Notification_View_Type(config: configuration)
      
  • Update Banner Configurations:

    Want to change configuration for same banner ? 🤔
    banner.updateConfiguration(config: configuration)
    
  1. Show your banner
  • Show Banner:

    banner.showBanner(onDismiss: Closure_For_On_Dismiss, onTap: Closure_For_On_Tap, onProgressCompleted: Closure_For_On_Progress_Completed)
    
    Closure are optional.
  1. Hide your banner.
  • Hide Banner:

    banner.hideBanner()
    
    • For Auto-Hide Banner
      banner.showBanner(onDismiss: nil, onTap: nil)
      
      OnDismiss closure will be called.

Licence

RONotificationView is released under the MIT license. See LICENSE for details.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published