An easy alert on status bar.
Demo |
---|
import AlertBar
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.")
AlertBar accepts to custom alert duration.
AlertBar.show(type: .success, message: "This is a Success message.", duration: 10)
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,
font: UIFont.systemFont(ofSize: 14.0, weight: .medium)
)
AlertBar.setDefault(options: options)
Or set parameter of show
method to each AlertBar.
let options = AlertBar.Options(
shouldConsiderSafeArea: true,
isStretchable: true,
textAlignment: .center,
font: UIFont.systemFont(ofSize: 14.0, weight: .medium)
)
AlertBar.show(type: .success, message: "This is AlertBar!", options: options)
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 |
---|---|
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 |
---|---|
AlertBar accepts to custom text alignment.
AlertBar is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "AlertBar"
AlertBar is available through Carthage since 0.3.1
.
To install it, simply add the following line to your Cartfile:
github "jinSasaki/AlertBar"
Jin Sasaki, sasakky_j@gmail.com
AlertBar is available under the MIT license. See the LICENSE file for more info.