Latest 0.4.2
Homepage https://github.com/jinSasaki/AlertBar
License MIT
Platforms ios 8.0, requires ARC
Authors

Version
License
Platform
Carthage compatible

An easy alert on status bar.

Demo
demo

Usage

Import

import AlertBar

Show alert message

AlertBar has default types:

  • success
  • error
  • notice
  • warning
  • info
AlertBar.show(type: .success, message: "This is a Success message.")

And you can customize the background and text colors of AlertBar.
Select custom type and set background and text colors as UIColor: .custom(BackgroundColor, TextColor)

AlertBar.show(type: .custom(.lightGray, .black), message: "This is a Custom message.")

Alert duration

AlertBar accepts to custom alert duration.

AlertBar.show(type: .success, message: "This is a Success message.", duration: 10)

AlertBar Options

AlertBar accepts options follows:

  • Consider Safe Area
  • Stretch bar
  • TextAlignment

Use setDefault method to set default options.

let options = AlertBar.Options(
    shouldConsiderSafeArea: true, 
    isStretchable: true, 
    textAlignment: .center
)
AlertBar.setDefault(options: options)

Or set parameter of show method to each AlertBar.

let options = AlertBar.Options(
    shouldConsiderSafeArea: true, 
    isStretchable: true, 
    textAlignment: .center
)
AlertBar.show(type: .success, message: "This is AlertBar!", options: options)

Consider Safe Area

The Safe Area is adopted from iOS 11 and AlertBar can change whether to consider SafeArea or not.

AlertBar.Options#shouldConsiderSafeArea: Bool
is set to true by default.

shouldConsiderSafeArea == true shouldConsiderSafeArea == false
true false

Stretch bar

AlertBar can stretch the bar if the message needs the multi lines.

AlertBar.Options#isStretchable: Bool
is set to false by default.

isStretchable == true isStretchable == false
true false

TextAlignment

AlertBar accepts to custom text alignment.

Installation

CocoaPods

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

pod "AlertBar"

Carthage

AlertBar is available through Carthage since 0.3.1.
To install it, simply add the following line to your Cartfile:

github "jinSasaki/AlertBar"

Author

Jin Sasaki, [email protected]

License

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

Latest podspec

{
    "name": "AlertBar",
    "version": "0.4.2",
    "summary": "An easy alert on status bar.",
    "homepage": "https://github.com/jinSasaki/AlertBar",
    "screenshots": "https://github.com/jinSasaki/AlertBar/raw/master/assets/demo.gif",
    "license": "MIT",
    "authors": {
        "Jin Sasaki": "[email protected]"
    },
    "source": {
        "git": "https://github.com/jinSasaki/AlertBar.git",
        "tag": "0.4.2"
    },
    "social_media_url": "https://twitter.com/sasakky_j",
    "platforms": {
        "ios": "8.0"
    },
    "requires_arc": true,
    "source_files": "Sources/**/*",
    "pushed_with_swift_version": "4.0.2"
}

Pin It on Pinterest

Share This