• Stars
    star
    184
  • Rank 209,187 (Top 5 %)
  • Language
    Swift
  • License
    MIT License
  • Created about 6 years ago
  • Updated over 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

iOS Basic Notification screens 🀚

NotificationView

CI Status Version License Platform Swift 5.0

Introduce

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
Custom Duration
Rotate



Screen

- iPhoneSE iPhone8Plus
Vertical demo demo
Horizontal demo demo
- iPhoneX iPad
Vertical demo demo
Horizontal demo demo

Theme

default dark
demo demo

Type

custom1 custom2
demo demo



Requirements

NotificationView written in Swift 5.0. Compatible with iOS 8.0+

Installation

Versioning notes

Version 0.2.1 introduces Swift 5.0 support

Version 0.2.0 introduces Swift 4.2 support

Version 0.1.1 introduces Swift 4.0 support

Cocoapods

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

pod 'NotificationView'

Swift Package Manager

To integrate NotificationView via SPM into your Xcode 11 project specify it in Project > Swift Packages:

https://github.com/pikachu987/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 and custom mode.
notificationView.theme

//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")
    }
}

Custom

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

notificationView.theme = .custom
notificationView.backgroundColor = .red
notificationView.appNameLabel.textColor = .blue
notificationView.dateLabel.textColor = .blue
notificationView.titleLabel.textColor = .blue
notificationView.subtitleLabel.textColor = .blue
notificationView.bodyLabel.textColor = .blue

notificationView.show()



Author

pikachu987, [email protected]

License

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

More Repositories

1

Tags

πŸ™Œ Quick, Simple Tag Library πŸ‘
Swift
361
star
2

CropPickerView

Image Crop View
Swift
93
star
3

PKCCrop

Swift
48
star
4

PKCSlice

Slice Button
Swift
48
star
5

TransitionController

😁 πŸ™Œ πŸŽ‰
Swift
31
star
6

PKCAlertView

Swift
26
star
7

WebController

Quick WKWebView πŸ˜„
Swift
24
star
8

CropPickerController

CropPickerController πŸ‘
Swift
18
star
9

VideoConverter

πŸ™Œ Video Trim, Crop, Rotate, Mute πŸ‘
Swift
15
star
10

TextGradation

TextGradation πŸ‘
Swift
15
star
11

PKCUtil

Swift
15
star
12

VideoTrim

πŸ™Œ UI showing video trim πŸ‘
Swift
14
star
13

PKCSwipeReusableView

Swift
14
star
14

CalendarPicker

iOS DatePicker + function πŸ‘
Swift
12
star
15

Reorder

Swift
11
star
16

tec

HTML
5
star
17

TIL

Today I Learned
Objective-C
5
star
18

GCDExample

Swift
5
star
19

FilterSearch

Swift
4
star
20

ConsoleLog

Swift
4
star
21

pikachu987.github.io

HTML
4
star
22

RxSwiftExample

RxSwift 😡
Swift
4
star
23

PKCCheck

swift decibel check, sound check, plug check, audio access, camera access, photo access
Shell
4
star
24

PKCCamera

Swift
4
star
25

SwiftAlgorithm

Swift Algorithm πŸ‘
3
star
26

PKCTest

Shell
3
star
27

InstagramUI

Swift
3
star
28

cv

κΉ€κ΄€ν˜Έ 포트폴리였
HTML
3
star
29

InputTag

Swift
3
star
30

Crop

JavaScript
3
star
31

PKCCalendar

Shell
3
star
32

FilterViewer

Swift
3
star
33

Search

Swift
3
star
34

commonScript

script common util
JavaScript
3
star
35

PKCCoreDataHelper

코어데이터
Swift
3
star
36

SwiftGrammar

μŠ€μœ„ν”„νŠΈ 문법 😱
2
star
37

PageControlView

Easy Page Control πŸ‘
Swift
1
star
38

ProjectData

HTML
1
star
39

pikachu987

1
star