Git Product home page Git Product logo

gtnotification's Introduction

GTNotification CI Status

An in-app notification banner for Swift.

Setup with CocoaPods (recommended setup)

  • Add the instructions below to your Podfile:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
use_frameworks!

pod 'GTNotification', '>= 1.4.3'
  • Then add import GTNotification at the top of your Swift class.

  • Finally compile and run and you will be good to go.

Otherwise you can also manually import the framework

Just drag and drop 'GTNotification/*.swift file(s) into your Xcode project and do not forget to check the checkbox entitled "Copy items if needed" and the appropriate checkboxe(s) in "Add to targets" section.

Example

// Initialize a notification
let notification: GTNotification = GTNotification()
notification.title = "Welcome Notification"
notification.message = "Thank you for checking out GTNotificationView."
notification.position = GTNotificationPosition.Top
notification.animation = GTNotificationAnimation.Slide
notification.blurEnabled = true

// Perform a custom selector on tap
notification.addTarget(self, action: Selector("dismissNotification"))

// Set the notification's delegate
notification.delegate = self

// Show the notification
GTNotificationManager.sharedInstance.showNotification(notification)

GTNotificationDelegate Methods

// MARK: GTNotificationDelegate Methods
    
func notificationDidDismiss(notification: GTNotification)
{
    // The notification was dismissed automatically
    NSLog("The notification was dismissed automatically")
}
    
func notificationFontForTitleLabel(notification: GTNotification) -> UIFont
{
    return UIFont(name: "AvenirNext-Medium", size: 16.0)!
}
    
func notificationFontForMessageLabel(notification: GTNotification) -> UIFont
{
    return UIFont(name: "AvenirNext-Regular", size: 13.0)!
}

Screenshots

Dark Blur

Dark Blur Notification

Light Blur

Light Blur Notification

Extra Light Blur

Extra Light Blur Notification

Solid Color

Solid Color Notification

gtnotification's People

Contributors

king-wizard avatar mathieuwhite avatar readmecritic avatar

Watchers

James Cloos avatar Thompson Sanjoto avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.