Skip to content

c2mInc/C2Alert

Repository files navigation

C2Alert

CI Status Version License Platform

About

C2Alert is a simple alert library with good and customizable design.

With Icon

No Icon

Requirements

Installation

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

pod 'C2Alert'

Supported Swift Versions

C2Alert Version Swift Version Min. iOS Version
=> 0.1.1 Swift 5 >= iOS 9.0

Getting started

Create a C2Alert object with suitable initializer, then call the show function

Usage

Basic

let alert = C2Alert(title: "Success", message: "You're doing great!", image: UIImage(named: "success_icon")!)
alert.show()

Available modifiers

let alert = C2Alert(title: "Success", message: "You're doing great!", image: UIImage(named: "success_icon")!)
alert.autoHideAfterSeconds = 5
alert.dialogBackgroundColor = .gray
alert.dialogImageColor = .black
alert.dialogMessageTextColor = .black
alert.dialogTitleTextColor = .black
alert.duration = 0.6 // This is show and hide animate duration
alert.hideOnBackgroundTouch = false // default true
alert.imageSize = CGSize(width: 100, height: 100)
alert.messageFont = UIFont(name: "Avenir-Roman", size: 15)!
alert.titleFont = UIFont(name: "Avenir-Heavy", size: 18)!
alert.overlay = true // default true
alert.overlayColor = .black // default black
alert.overlayOpacity = 0.3 // default 0.6
alert.paddingFromSides = 30 // default 32
alert.seperatorHeight = 8 // Space between title, message and image
alert.paddingTopAndBottom = 22 // default 24
alert.iconWithoutTintColor = true // default false. Use 'true' for custom image without tint
alert.show()

Requirements

  • iOS 9.0+
  • Xcode 8.0+
  • Swift 5.0+

Author

Connected2.me / Berk Kaya

License

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