Latest 0.1.0
Homepage https://github.com/pkrll/NotifiOS
License MIT
Platforms ios 8.0
Frameworks UIKit
Authors

[![CI Status](http://img.shields.io/travis/Ardalan Samimi/NotifiOS.svg?style=flat)](https://travis-ci.org/Ardalan Samimi/NotifiOS)
Version
License
Platform

Overview

Create user notifications with NotifiOS, a very small and easy to use Swift library (subclassing UVIew).

Requirements

  • iOS 8

Install with CocoaPods

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

pod "NotifiOS"

Usage

It is recommended that you instantiate NotifiOS with the convenience initializer init(withMaxDimensions:) where you input the maximum dimensions of the view, as it will automatically adjusts itself depending on the content. The max dimensions property will make sure it does not grow over a certain size.

let view = NotifiOS(withMaxDimensions: CGSize(width: 250, height: 250))

NotifiOS basically consist of two subviews: A text label and an Image View. To set the image of the view, use the setImage(:, withSize:) method, where withSize should be provided as the preferred size of the image. Set the title with the setTitle(:) method.

let image = UIImage(named: "SomeImage")
view.setImage(image, withSize: CGSize(width: 65, height: 70))
view.setTitle("Some Title!")

NotifiOS also provides an activity indicator. Note: The spinner will hide the image when active.

view.loadActivityIndicator()
view.setTitle("Loading...")
view.delayFadeOut = 0 // To make sure the view will not go away
view.removeOnTouch = false

// Change the image after the loading is done:
let image = UIImage(named: "SomeImage")
view.setImage(image, withSize: CGSize(width: 65, height: 70))
view.setTitle("Did Load!")
view.beginFadeOut()

If not configured otherwise, NotifiOS will begin fading out 1 second after the view has been added as a subview (for configurations, see below).

someSuperView.addSubview(view)

Configurations

Customize the NotifiOS experience.

view.fadeDuration = 5 // The duration of the fade.
view.delayFadeOut = 5 // The number of seconds the view should be displayed. If set to 0, the view will stay until the beginFadeout() method is called.
view.removeOnTouch = true // If true, the view will start the fadeout process when the user taps it.
view.afterTouch = {
  // The callback that will be fired after the fadeout has finished.
}

You can also customize the title, image view and activity indicator elements.

Example

An example project is included with this repo. To run the example project, clone the repo, and run pod install from the Example directory first.

Author

Ardalan Samimi, [email protected]

License

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

Latest podspec

{
    "name": "NotifiOS",
    "version": "0.1.0",
    "summary": "Simple Notification View for iOS",
    "description": "NotifiOS provides the ability to create small notification popup views.",
    "homepage": "https://github.com/pkrll/NotifiOS",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Ardalan Samimi": "[email protected]"
    },
    "source": {
        "git": "https://github.com/pkrll/NotifiOS.git",
        "tag": "0.1.0"
    },
    "social_media_url": "https://twitter.com/pkrll",
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "NotifiOS/Classes/**/*",
    "frameworks": "UIKit"
}

Pin It on Pinterest

Share This