/ Notifications

iOS Basic Notification screens

iOS Basic Notification screens

NotificationView

You can easily implement iOS Basic Notification screens. There is a default theme and a dark theme. You can attach an image to the Notification screen with only the UIImageView. You can adjust the disappearance time. You can get a delegate or callback for the visible and disappearing states. You can get delegates and callbacks for tap.

Theme Multiple
theme multiple
Custom Duration
custom duration
Rotate
rotate

Screen

- iPhoneSE iPhone8Plus
Vertical screen_se_vertical screen_8P_vertical
Horizontal screen_se_horizontal screen_8P_horizontal
- iPhoneX iPad
Vertical screen_X_vertical screen_pad_vertical
Horizontal screen_pad_horizontal screen_pad_horizontal-1

Theme

default dark
theme_default theme_dark

Type

custom1 custom2
custom1 custom2

Requirements

NotificationView written in Swift 4. Compatible with iOS 8.0+

Installation

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

pod 'NotificationView'

Usage

import NotificationView

DefaultNotification

let notificationView = NotificationView.default
notificationView.title = title
notificationView.subtitle = subtitle
notificationView.body = body
notificationView.image = image
notificationView.show()

MultipleNotification

let notificationView = NotificationView()
notificationView.title = title
notificationView.subtitle = subtitle
notificationView.body = body
notificationView.image = image
notificationView.show()

done!

Property

NotificationView


//Theme for NotificationView. There are dark mode and default mode.
notificationView.theme

//The time at the top right of NotificationView.
notificationView.date

//The title of the NotificationView.
notificationView.title

//The subtitle of the NotificationView.
notificationView.subtitle

//The body of the NotificationView.
notificationView.body

//The image of the NotificationView.
notificationView.image

//The background color of the NotificationView.
notificationView.backgroundColor

//It is a dictionary that can contain any data.
notificationView.param

//The identifier for the NotificationView.
notificationView.identifier

//The time until the NotificationView is shown and then disappears.
notificationView.hideDuration

//An UIImageView that displays the AppIcon image.
notificationView.iconImageView

//An UILabel that displays the AppName text.
notificationView.appNameLabel

//An UILabel that displays the Date text.
notificationView.dateLabel

//An UILabel that displays the Title text.
notificationView.titleLabel

//An UILabel that displays the Subtitle text.
notificationView.subtitleLabel

//An UILabel that displays the Body text.
notificationView.bodyLabel

//An UIImageView that displays the Image.
notificationView.imageView

Method

NotificationView Show

notificationView.show()

notificationView.show { (state) in
    print("callback: \(state)")
}

notificationView.showAfter(0.1)

notificationView.showAfter(0.1) { (state) in
    print("callback: \(state)")
}

NotificationView Hide

notificationView.hide()

notificationView.hideAfter(0.1)

Delegate

class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()

        let notificationView = NotificationView()
        notificationView.delegate = self
    }
}

extension ViewController: NotificationViewDelegate {

    /**
    Called when NotificationView is willAppear.
    - Parameters:
    - notificationView: NotificationView
    */
    func notificationViewWillAppear(_ notificationView: NotificationView) {
        print("delegate: notificationViewWillAppear")
    }

    /**
    Called when NotificationView is didAppear.
    - Parameters:
    - notificationView: NotificationView
    */
    func notificationViewDidAppear(_ notificationView: NotificationView) {
        print("delegate: notificationViewDidAppear")
    }

    /**
    Called when NotificationView is willDisappear.
    - Parameters:
    - notificationView: NotificationView
    */
    func notificationViewWillDisappear(_ notificationView: NotificationView) {
        print("delegate: notificationViewWillDisappear")
    }

    /**
    Called when NotificationView is didDisappear.
    - Parameters:
    - notificationView: NotificationView
    */
    func notificationViewDidDisappear(_ notificationView: NotificationView) {   
        print("delegate: notificationViewDidDisappear")
    }

    /**
    Called when the NotificationView is touched.
    - Parameters:
    - notificationView: NotificationView
    */
    func notificationViewDidTap(_ notificationView: NotificationView) {
        print("delegate: notificationViewDidTap")
    }
}

GitHub