Simple custom user notifications
-
Manually: Copy the file
SFSwiftNotification.swift
to your project. -
CocoaPods: (Soon available)
In your ViewController
var notifyView:SFSwiftNotification?
In viewDidLoad()
notifyView = SFSwiftNotification(frame: notifyFrame,
title: nil,
animationType: AnimationType.AnimationTypeCollision,
direction: Direction.LeftToRight,
delegate: self)
notifyView!.backgroundColor = UIColor.orangeColor()
notifyView!.label.textColor = UIColor.whiteColor()
notifyView!.label.text = "This is an SFSwiftNotification"
self.view.addSubview(notifyView)
To start the notification:
@IBAction func notify(sender : AnyObject) {
self.notifyView!.animate(notifyFrame, delay: 1)
}
AnimationTypes:
.AnimationTypeCollision
.AnimationTypeBounce
Directions:
.TopToBottom
.LeftToRight
.RightToLeft