All Projects → gokulgovind → Glnotificationbar

gokulgovind / Glnotificationbar

Licence: mit
GLNotificationBar is a ios10 style notification bar, can be used to handle push notification in active state.

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Glnotificationbar

Ftindicator
A light wight UI package contains local notification, progress HUD, toast, with blur effect, elegant API and themes support.
Stars: ✭ 292 (-4.58%)
Mutual labels:  notifications, cocoapods
Swiftoverlays
SwiftOverlays is a Swift GUI library for displaying various popups and notifications
Stars: ✭ 621 (+102.94%)
Mutual labels:  notifications, cocoapods
Tsmessages
💌 Easy to use and customizable messages/notifications for iOS à la Tweetbot
Stars: ✭ 4,927 (+1510.13%)
Mutual labels:  notifications, cocoapods
Ehplainalert
Plain style IOS alert
Stars: ✭ 44 (-85.62%)
Mutual labels:  notifications, cocoapods
Badgehub
A way to quickly add a notification badge icon to any view. Make any view of a full-fledged animated notification center.
Stars: ✭ 592 (+93.46%)
Mutual labels:  notifications, cocoapods
Ismessages
This is simple extension for presenting system-wide notifications from top/bottom of device screen.
Stars: ✭ 299 (-2.29%)
Mutual labels:  notifications, cocoapods
Kyshutterbutton
KYShutterButton is a custom button that is similar to the shutter button of the camera app
Stars: ✭ 293 (-4.25%)
Mutual labels:  cocoapods
Callbackurlkit
Implementation of x-callback-url (Inter app communication) in swift
Stars: ✭ 299 (-2.29%)
Mutual labels:  cocoapods
Vulcan
Multi image downloader with priority in Swift
Stars: ✭ 291 (-4.9%)
Mutual labels:  cocoapods
Swiftprogresshud
📦 SwiftProgressHUD is a user-friendly pure swift HUD. 支持Cocoapods 及 Carthage
Stars: ✭ 290 (-5.23%)
Mutual labels:  cocoapods
Xlactioncontroller
Fully customizable and extensible action sheet controller written in Swift
Stars: ✭ 3,228 (+954.9%)
Mutual labels:  cocoapods
Wordpress Ios
WordPress for iOS - Official repository
Stars: ✭ 3,239 (+958.5%)
Mutual labels:  cocoapods
Luminous
Luminous provides you a lot of information about the system and a lot of handy methods to quickly get useful data on the iOS platform.
Stars: ✭ 298 (-2.61%)
Mutual labels:  cocoapods
Mixpanel Swift
Official iOS (Swift) Tracking Library for Mixpanel Analytics
Stars: ✭ 294 (-3.92%)
Mutual labels:  cocoapods
Material Showcase Ios
✨ An elegant way to guide your beloved users in iOS apps - Material Showcase.
Stars: ✭ 300 (-1.96%)
Mutual labels:  cocoapods
Functionkit
A framework for functional types and operations designed to fit naturally into Swift.
Stars: ✭ 302 (-1.31%)
Mutual labels:  cocoapods
Imageloaderswift
A lightweight and fast image loader for iOS written in Swift.
Stars: ✭ 290 (-5.23%)
Mutual labels:  cocoapods
Anyformatkit
Simple text formatting in Swift
Stars: ✭ 296 (-3.27%)
Mutual labels:  cocoapods
Stevia
🍃 Concise Autolayout code
Stars: ✭ 3,182 (+939.87%)
Mutual labels:  cocoapods
Web3.swift
A pure swift Ethereum Web3 library
Stars: ✭ 295 (-3.59%)
Mutual labels:  cocoapods

GLNotificationBar

CI Status Version License Platform

FYI: Updated with XCode 9.0 & swift 4.0.

overView

Note

GLNotificationBar is a library that allows you to easily create banner notifications that appear on top of screen, used to handle push notification in active state.Made with xcode 8.3.1 and swift 3

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

GLNotificationBar requires iOS 8.0+.

Installation

CocoaPods

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

pod 'GLNotificationBar'

Manual

Copy the file GLNotificationBar.swift & GLNotificationBar.xib from ~/GLNotificationBar/GLNotificationBar/Classes to your project.

User Guide

Swift:

let notificationBar = GLNotificationBar(title: "Today Quote", message: "Yesterday is today's memory, and tomorrow is today's dream.", preferredStyle: .DetailedBanner, handler: nil)
notificationBar.addAction(GLNotifyAction(title: "Like", style: .Default, handler: { (action) in
   print("I Like this quote")
}))
notificationBar.addAction(GLNotifyAction(title: "Cancel", style: .Cancel, handler: nil))

Objective C:

  • Run pod install. pod 'GLNotificationBar'
  • Then add @import GLNotificationBar; at top of your viewcontroller class.
  • Now add following code wherever you want.
    GLNotificationBar * notificationBar = [[GLNotificationBar alloc]initWithTitle:@"Today Quote" message:@"Yesterday is today's memory, and tomorrow is today's dream." preferredStyle:0 handler:nil];
    [notificationBar addAction:[[GLNotifyAction alloc]initWithTitle:@"Like" style:0 handler:^(GLNotifyAction * action) {
        NSLog(@"I Like this quote");
        //NSLog(@"Text reply %@",action.textResponse);
    }]];
    [notificationBar addAction:[[GLNotifyAction alloc]initWithTitle:@"Cancel" style:4 handler:nil]];
    

Diving In Depth

  • GLNotificationBar is simple to use,implementation is similar to UIAlertController.

    let notificationBar = GLNotificationBar(title: "hallowean", message: "😎Hi there! We've missed you. Enjoy the new hallowean sticker,borders,bgs on your app.😈🎅🏻", preferredStyle: .DetailedBanner, handler: nil)
    
    

    This simply presents GLNotificationBar with given title and message,handler can be used to catch tap gesture on notification bar. The default behavior of notification bar is, dismissed automatically when tapped on it.

There are two types of GLNotificationBar style and Five type of GLNotifyAction types.

  • .DetailedBanner

    • .DetailedBanner style is similar to ios10 style notification bar, swiping down this type of notification open's in detail, which may include GLNotifyAction's GLNotifyAction can be added to GLNotificationBar as follows

      let cancelButton = GLNotifyAction(title: "Cancel", style: .Cancel) { (result) in
            print(result.actionTitle)
         }
         notificationBar.addAction(cancelButton)
      

      OR

      notificationBar.addAction(GLNotifyAction(title: "Cancel", style: .Cancel) { (result) in
          print(result.actionTitle)
      })
      
    • GLNotifyAction also has four different types each performs their respective action.

      public enum GLNotificationActionType {
         case Default  // Apply the default style to the action’s button.
         case Destructive  //Apply a style that indicates the action might change or delete data.
         case TextInput  //Apply a style that indicates the action opens an textinput field helps to respond notification as string.
         case OnlyTextInput  //Apply a style which removes all other action added and simply adds text field as input to respond notification.
         case Cancel  //Apply a style that indicates the action cancels the operation and leaves things unchanged.
      }
      

    detailedBanner

  • .SimpleBanner

    • .SimpleBanner is similar to .DetailedBanner in appearance, but it's options are restricted. It can't be swiped down to open in detail form.
    • GLNotifyAction added to this type of notification bar will not be taken into account.

    simpleBanner

  • GLNotifyAction's .OnlyTextInput

     notificationBar.addAction(GLNotifyAction(title: "Reply", style: .OnlyTextInput) { (result) in
          print(result.textResponse)
       })
    
    • .OnlyTextInput is some what different from other action types.
    • Adding this action removes all other action added and stight away presents textfield as option for user input without any user interaction.
    • This helps user to repond to a notification with text.

    textInput_ActionType

  • notificationBar.showTime

     notificationBar.showTime(3.0)
    
    • This method helps to set time interval for notification bar to hide.
    • The default value is 5.0 seconds.
    • And 0.0 can used to turn off auto hide of notification bar.
  • notificationBar.notificationSound

     notificationBar.notificationSound("Your sound name", ofType: ".mp3", vibrate: true)
    
    • By default GLNotificationBar does't play any sound, to play notification sound add this method.
    • This method helps to play notification sound when it is displayed.
    • If mentioned sound file is not found means system default sound will be played.
  • Adding Shadow & Visual Effect Style

    • Add dropdown shadow effect to notification bar by using below function notificationBar.setShadow(true)
    • Change Visual effect view style using notificationBar.setColorStyle(.extraLight)

Author

gokul, [email protected]

Contributors

CavalcanteLeo, https://github.com/CavalcanteLeo

jameshays, https://github.com/jameshays

Social

License

GLNotificationBar is available under the MIT license. See the LICENSE file for more info.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].