GithubHelp home page GithubHelp logo

carabina / impressivenotifications Goto Github PK

View Code? Open in Web Editor NEW

This project forked from impresyjna/impressivenotifications

0.0 1.0 0.0 213 KB

ImpressiveNotifications are custom in-app notifications with 3 types of layouts.

License: GNU General Public License v3.0

Objective-C 4.84% Swift 95.16%

impressivenotifications's Introduction

Gallery Banner

Carthage Compatible License Platform Swift

Description

ImpressiveNotifications are custom in-app notifications with 3 types of layouts. The notifications will animate in and out. They will hide when they are clicked on or with an automatic dismissal. It is also available to add custom behavior when notification is tapped.

Installation

ImpressiveNotifications is available through Carthage. To install just write into your Cartfile:

github "impresyjna/ImpressiveNotifications"

Usage

Call INNotifications.show with a type, data structure and customStyle if you want. Only type is necessary.

Built-in notification types are : .success .warning .danger .custom(UIView)

Example:

INNotifications.show(type: .danger, data: INNotificationData(title: "Error", description: "Error notification"))

Configuration

ImpressiveNotifications gives user possibility to customize view.

Custom style

INNotificationStyle is the structure created to customize the appearance of notification.

public struct INNotificationStyle {
    let cornerRadius: CGFloat?
    let backgroundColor: UIColor?
    let titleColor: UIColor?
    let descriptionColor: UIColor?
    let imageSize: CGSize?
}

Example:

INNotifications.show(type: .danger, data: INNotificationData(title: "Error", description: "Error notification"), customStyle: INNotificationStyle(cornerRadius: 10.0, backgroundColor: .black, titleColor: .red, descriptionColor: .yellow, imageSize: CGSize(width: 100.0, height: 100.0)))

Custom data, time and completionHandler

INNotificationData is the structure created to customize data on the notification, time and add completionHandler on tap

public struct INNotificationData {
    let title: String
    let description: String?
    let image: UIImage?
    let delay: TimeInterval
    let completionHandler: (() -> Void)?
}

Example:

INNotifications.show(type: .danger, data: INNotificationData(title: "Danger", description: "Danger notification", image: UIImage(named: "danger"), delay: 20.0, completionHandler: {
            print("Hello")
    } 
))

Custom view

It is also possible to add custom view created for example in storyboard.

Example:

let storyboard = UIStoryboard(name: "Main", bundle: nil)
let vc = storyboard.instantiateViewController(withIdentifier: "CustomViewController")

INNotifications.show(type: .custom(vc.view))

impressivenotifications's People

Contributors

impresyjna avatar

Watchers

Carabineiro 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.