A customizable framework to create draggable views

Overview

CFNotify

Travis branch GitHub issues Swift GitHub forks GitHub stars GitHub license Carthage compatible CocoaPods

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 !

Demo1 Demo2 Demo3

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

Requirements

  • Swift 4.0+
  • Xcode 9
  • iOS 9.0+

Change Log

Please read CHANGELOG.md.

Installation

  • Carthage (Recommended)

    Add the following lines into Cartfile

    #CFNotify
    github "JT501/CFNotify"

    Run carthage update and then add CFNotify.framework and CFResources.bundle into your project

  • Cocoapods

    Add the following lines into Podfile

    pod "CFNotify"

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)

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

CFNotify.present(config: Config, view: UIView)

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)?)

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() // hide the current view

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

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

  • Cyber

    CyberView
    // Use Pre-set theme
    let cyberView = CFNotifyView.cyberWith(title: "Title",
                                            body: "Body",
                                           theme: .info(.light))
    
    //More customizations
    let customCyberView = CFNotifyView.cyberWith(titleFont: UIFont,
                                                titleColor: UIColor,
                                                  bodyFont: UIFont,
                                                 bodyColor: UIColor,
                                           backgroundColor: UIColor,
                                                 blurStyle: UIBlurEffectStyle)
  • Classic

    ClassicView
    // Use Pre-set theme
    let classicView = CFNotifyView.classicWith(title: "Title",
                                                body: "Body",
                                               theme: .success(.light))
    
    //More customizations
    let customClassicView = CFNotifyView.classicWith(titleFont: UIFont,
                                                    titleColor: UIColor,
                                                      bodyFont: UIFont,
                                                     bodyColor: UIColor,
                                               backgroundColor: UIColor)
  • Toast

    ToastView
    // Use Pre-set theme
    let toastView = CFNotifyView.toastWith(text: "Text",
                                          theme: .fail(.dark))
    
    //More customizations
    let customToastView = CFNotifyView.toastWith(text: String,
                                             textFont: UIFont,
                                            textColor: UIColor,
                                      backgroundColor: UIColor)                                    

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 hide

Delegate

CFNotify provides Delegate methods for some of common events. You need to conform to the CFNotifyDelegate.

func cfNotifyDidAppear() {}

func cfNotifyStartDragging(atPoint: CGPoint) {}

func cfNotifyIsDragging(atPoint: CGPoint) {}

func cfNotifyEndDragging(atPoint: CGPoint) {}

func cfNotifyDidDisappear() {}

func cfNotifyIsTapped() {}

To-Do List

  • Add SPM support
  • Improve the example app
  • Add alert view with buttons
  • Full documentation

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.

You might also like...
An infinite scroll control implemented with two views.

LCCycleBanner An infinite scroll control implemented with two views. Requirements iOS 9.0+ Swift 4.0+ Programming in Objective-C? Try LCInfiniteScroll

Easily create different alerts in SwiftUI

AlertWizard 🧙🏻‍♂️ This package lets you easily create different alerts in SwiftUI with the call of a single function. As this is my first package th

Create Apple-like alerts & toasts using SwiftUI
Create Apple-like alerts & toasts using SwiftUI

AlertToast-SwiftUI Present Apple-like alert & toast in SwiftUI 🌄 Example 🔭 Overview Currently in SwiftUI, the only way to inform the user about some

Highly customizable alertview and alert/notification/success/error/alarm popup written in Swift
Highly customizable alertview and alert/notification/success/error/alarm popup written in Swift

CDAlertView is highly customizable alert popup written in Swift. Usage is similar to UIAlertController. Screenshots Animations Usage Basic usage witho

The easiest way to display highly customizable in app notification banners in iOS
The easiest way to display highly customizable in app notification banners in iOS

Written in Swift 5 NotificationBanner is an extremely customizable and lightweight library that makes the task of displaying in app notification banne

PMAlertController is a great and customizable alert that can substitute UIAlertController
PMAlertController is a great and customizable alert that can substitute UIAlertController

PMAlertController is a small library that allows you to substitute Apple's uncustomizable UIAlertController, with a beautiful and totally customizable

A simple, customizable popup dialog for iOS written in Swift. Replaces UIAlertController alert style.
A simple, customizable popup dialog for iOS written in Swift. Replaces UIAlertController alert style.

Introduction Popup Dialog is a simple, customizable popup dialog written in Swift. Features Easy to use API with hardly any boilerplate code Convenien

Fully customizable and extensible action sheet controller written in Swift
Fully customizable and extensible action sheet controller written in Swift

XLActionController By XMARTLABS. XLActionController is an extensible library to quickly create any custom action sheet controller. Examples The action

💌 Easy to use and customizable messages/notifications for iOS à la Tweetbot

Notice: TSMessages is no longer being maintained/updated. We recommend everyone migrate to RMessage. This repository will be kept as is for those who

Comments
  • iTunes Store submission issue

    iTunes Store submission issue

    Getting this back from Apple: Invalid Bundle Structure - The binary file '<Appname>.app/Frameworks/CFNotify.framework/CFResources.bundle/CFResources' is not permitted. Your app can’t contain standalone executables or libraries, other than the CFBundleExecutable of supported bundles. Refer to the Bundle Programming Guide for information on the iOS app bundle structure.

    opened by andreyz 4
  • Enums should follow Swift conventions

    Enums should follow Swift conventions

    This enumerations should be changed from:

    public enum Theme {
            case Success(Style)
            case Fail(Style)
            case Info(Style)
            case Warning(Style)
        }
    
        public enum Style {
            case Light
            case Dark
        }
    

    To:

    public enum Theme {
            case success(Style)
            case fail(Style)
            case info(Style)
            case warning(Style)
        }
    
        public enum Style {
            case light
            case dark
        }
    

    In order to follow the Swift enumeration conventions as accepted in here

    opened by minuscorp 1
Releases(1.0.3)
Owner
Johnny Tsoi
Independent Full Stack Developer. Creator of @Mention-la .
Johnny Tsoi
An iOS library for SwiftUI to create draggable sheet experiences similar to iOS applications like Maps and Stocks.

An iOS library for SwiftUI to create draggable sheet experiences similar to iOS applications like Maps and Stocks.

Wouter 63 Jan 5, 2023
SwiftUI Draggable Bottom Sheet

SwiftUI Draggable Bottom Sheet

paigeshin 2 Mar 3, 2022
Highly configurable iOS Alert Views with custom content views

NYAlertViewController NYAlertViewController is a replacement for UIAlertController/UIAlertView with support for content views and UI customization. Fe

Nealon Young 609 Nov 20, 2022
A customizable, full-feature, lightweight iOS framework to be used instead of UIAlertController.

A customizable, full-feature, lightweight iOS framework to be used instead of UIAlertController.

Ali Samaiee 11 Jun 6, 2022
OEANotification is a customizable notification view framework

OEANotification OEANotification is an iOS library which provides to create notifications and customize them easily. You can create notifications with

Ömer Aslan 19 Jan 30, 2021
BottomSheet makes it easy to take advantage of the new UISheetPresentationController in SwiftUI with a simple .bottomSheet modifier on existing views.

BottomSheet makes it easy to take advantage of the new UISheetPresentationController in SwiftUI with a simple .bottomSheet modifier on existing views.

Adam Foot 341 Dec 15, 2022
Whisper is a component that will make the task of display messages and in-app notifications simple. It has three different views inside

Description ?? Break the silence of your UI, whispering, shouting or whistling at it. Whisper is a component that will make the task of displaying mes

HyperRedink 3.7k Dec 25, 2022
It is a highly configurable iOS library which allows easy styling with built in styles as well as extra header and footer views so that you can make extremely unique alerts and action sheets.

 CFAlertViewController CFAlertViewController is a library that helps you display and customise Alerts, Action Sheets, and Notifications on iPad and i

Crowdfire Inc. 1.1k Dec 18, 2022
Action sheet allows including your custom views and buttons.

CustomizableActionSheet Action sheet allows including your custom views and buttons. Installation CocoaPods Edit your Podfile: pod 'CustomizableAction

Ryuta Kibe 191 Nov 26, 2021
(Experimental libraries) Controls interrupt handling, such as alert views, and is compatible with UIKit and Swift UI.

UIPresentCoordinator Controls interrupt handling, such as alert views, and is compatible with UIKit and Swift UI. This library manages items that are

Yuki Tamazawa 1 Jan 22, 2022