CFNotify is written in Swift. Using UIKit Dynamics as animator. It can make ANY UIView object draggable and throwable. This library mainly use for in-app notification and alerts. Let’s notice and alert your users in more playable and fun way !

Features

  • Work with ANY UIView object !
  • Using UIKit Dynamics. Light and Smooth !
  • Highly Customizable
  • Included three ready to use views: CyberView.ClassicView.ToastView
  • Simple to implement

Installation

Getting Started

There is an example project inside the source code. You are suggested to have a look first and get familiar with this framework.

The Basics

This is the basic function with all default settings, design your own UIView or use CFNotifyView to create one easily.

CFNotify.present(view: UIView)Copy the code

If you need more custom settings, create your own Config and use the following function.

CFNotify.present(config: Config, view: UIView)Copy the code

if you want custom tap action, use the following function. (If you use tapHandler, it will override the default tap to hide action)

CFNotify.present(config: Config, view: UIView, tapHandler: (()->Void)?)Copy the code

CFNotify will put all the views to be shown in queue (First In First Out). You can hide the view programmatically using the following functions.

CFNotify.hide(a)// hide the current view

CFNotify.hideAll(a)// hide all the views in queue (Clear the queue)Copy the code

CFNotifyView

You can create an alert view quickly and easily by using CFNotifyView class.

CFNotifyView included 3 views currently: Cyber, Classic, Toast.

Each style has 4 themes: Info, Success, Fail, Warning

Each theme has 2 styles: Light and Dark

Config

You can config CFNotify using Config class. Config class included lots of properties, the following three are the most common:

  • initPosition : where the view is born
  • appearPosition : where the view appear position
  • hideTime : the view will automatically hide after hideTime (default is 3 sec)

Example:

var classicViewConfig = CFNotify.Config()
classicViewConfig.initPosition = .top(.random) //the view is born at the top randomly out of the boundary of screen
classicViewConfig.appearPosition = .top //the view will appear at the top of screen
classicViewConfig.hideTime = .never //the view will never automatically hideCopy the code

To-Do List

Bugs and issues

If you find any bugs or encounter some issues regard to this framework, please feel free to open a new issue in Issues page.

Contribute

You are welcome to contribute into this project, feel free to Pull Request.

License

CFNotify is released under an MIT License. See LICENSE for details.