TextField Validation for iOS / Objective C

TextField Validation for iOS / Objective C

We all have experienced it’s very time taking task to handle all validations for a single text field like empty validation,  characters limit etc and to manage them in a efficient way. It is very annoying to show validation alerts for each text field, so if you have so many text-fields in a form and each text field have average of 2 validations then user may get frustrated to get so much alert during filling the form.

To overcome this problem I have created an inherited class of “UITextField” called “TextFieldValidator” in which you just need to give them all the regex string that you want to validate in a particular textfield, no matter how many types of validation you want to perform you just need to give them in sequence. I’m sure this will save your lot of time in development and good news is that you can easily integrate “TextFieldValidator” into your previous application without putting much effort.


Lets check what are the steps to integrate “TextFieldValidator” in your iOS project

1. Include “TextFieldValidator.h” & “TextFieldValidtor.m” in your project.

Include textfield classes

2. Add error icon file that will show on the textfield at the right side when any validation get failed.

Error


How to use

1. Either you can drag UITextField in the view, change their class name to “TextFieldValidator” and create outlet or create instance programmatically.

TextField Outlet

2. You need to assign a view to “presentInView” data member of “TextFieldValidator” class on which you want to show error popup. If you are managing text field from storyboard/xib then you can directly assign outlet of “presentInView” to any view.

Present in view

3. You can assign delegate in the similar way as you do for UITextField.

4. Now you need to assign all your validation regex in sequence as per below code

// Add regex for validating characters limit
[txtUserName
addRegx:@”^.{3,10}$” withMsg:@”User name characters limit should be come between 3-10″];

// Add regex for validating alpha numeric characters

[txtUserName addRegx:@”[A-Za-z0-9]{3,10}” withMsg:@”Only alpha numeric characters are allowed.”];

You can assign all your regex to the textfield inside viewDidLoad method of ViewController class.

5. Now on form submission event you need to check whether all textfields validations get successfully executed or not, for this you just need to call “validate” method and this method will return YES if all the validations you provided is successfully executed and if they return NO then textfield will automatically show error icon at the right side of textfield and when user will tap on that icon a popup will show with message corresponding to the validation that get failed. See below code for reference:

if([txtUserName validate] & [txtEmail validate] & [txtPassword validate] & [txtConfirmPass validate] & [txtPhone validate]){
       //Success
}
Make sure you are using ‘&’ operator for validate multiple textfield in ‘if’ condition otherwise it will check only first field if you use ‘&&’ operator.


Now its time to check on the app

Lets take an example of registration form that contains 5 fields in which “Username”, “Email”, “Password” & “Confirm Password” are mandatory and “Phone number” is optional but phone number should be in proper format.

Img

I have applied below validations regex to all above textfields

// Add regex for validating characters limit
[txtUserName
addRegx:@”^.{3,10}$” withMsg:@”User name charaters limit should be come between 3-10″];

// Add regex for validating alpha numeric characters
[txtUserName addRegx:@”[A-Za-z0-9]{3,10}” withMsg:@”Only alpha numeric characters are allowed.”];

// Add regex for validating email id
[txtEmail addRegx:@”[A-Z0-9a-z._%+-]{3,}+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}” withMsg:@”Enter valid email.”];

// Add regex for validating characters limit
[txtPassword addRegx:@”^.{6,50}$” withMsg:@”Password characters limit should be come between 6-20″];

// Add regex for validating alpha numeric characters
[txtPassword addRegx:@”[A-Za-z0-9]{6,20}” withMsg:@”Password must contain alpha numeric characters.”];

// Add regex for validating confirm password text with the password field   
[txtConfirmPass addConfirmValidationTo:txtPassword withMsg:@”Confirm password didn’t match.”];

// Add regex for validating phone number
[txtPhone addRegx:@”[0-9]{3}\\-[0-9]{3}\\-[0-9]{4}” withMsg:@”Phone number must be in proper format (eg. ###-###-####)”];

// To set phone number is not mandatory
txtPhone.isMandatory=NO;

Now if I tap on “Submit” button then error will show for text fields according to the validation that failed

if([txtUserName validate] & [txtEmail validate] & [txtPassword validate] & [txtConfirmPass validate] & [txtPhone validate]){
       //Success
}

Img1         IMG_5323

IMG_5331         IMG_5332

IMG_5325         IMG_5324


Change appearance for error popup

I have created some constants under TextFieldValidator class header file that will help you to change the look and feel of error popup. Check below for those constants:

/**
    Image name for showing error on textfield.
 */
#define IconImageName @“error.png”

/**
    Background color of message popup.
 */
#define ColorPopUpBg [UIColor colorWithRed:0.702 green:0.000 blue:0.000 alpha:1.000]

/**
    Font color of the message.
 */
#define ColorFont [UIColor whiteColor]

/**
    Font size of the message.
 */
#define FontSize 15

/**
    Font style name of the message.
 */
#define FontName @“Helvetica-Bold”

/**
    Padding in pixels for the popup.
 */
#define PaddingInErrorPopUp 5

/**
    Default message for validating length, you can also assign message separately using method ‘updateLengthValidationMsg:’ for textfields.
 */
#define MsgValidateLength @”This field cannot be blank”


Code is freely available on github, you can download through URL: https://github.com/dhawaldawar/TextFieldValidator

I hope this will reduce your lot of efforts for implementing validation stuff and thanks for reading.

Please do comments on it so we can make it more better.

Thank you.

15 Replies to “TextField Validation for iOS / Objective C”

  1. We all have experienced it s very time taking task to handle all validations for a single text field like empty validation,  characters limit etc and to manage them in a efficient way. OS, can you help me to know what i`m doing wrong?

Leave a Reply

Your email address will not be published. Required fields are marked *

Alert #1

Show:

DialogBox.show(title: "Success", message: "You are now a new member.", boxApp:appearance, 
buttonTitle: "Ok", buttonAppearance: nil, actionBlock: nil)

Box Settings:

var appearance = BoxAppearance()

// Layout
appearance.layout.cornerRadius = 5.0
appearance.layout.width = 270.0

// Title
appearance.title.textColor = UIColor.darkGray
appearance.title.font = UIFont.boldSystemFont(ofSize: 17.0)

// Message
appearance.message.textColor = UIColor.darkGray
appearance.message.font = UIFont.systemFont(ofSize: 16.0)

// Animation
appearance.animation = BoxAnimationType.bounce

// Button
appearance.button.backgroundColor = UIColor.init(red: 98.0/255.0, green: 193.0/255.0, 
blue: 104.0/255.0, alpha: 1.0)

Alert #2


Show:

DialogBox.show(title: "Success", message: "You are now a new member.", boxApp: appearance, 
buttonTitle: "Ok", buttonAppearance: nil, actionBlock: nil)

Box Settings:

var appearance = BoxAppearance()

// Layout
appearance.layout.cornerRadius = 5.0
appearance.layout.width = 270.0

// Title
appearance.title.textColor = UIColor.darkGray
appearance.title.font = UIFont.boldSystemFont(ofSize: 17.0)

// Message
appearance.message.textColor = UIColor.darkGray
appearance.message.font = UIFont.systemFont(ofSize: 16.0)

// Icon
appearance.icon.type = BoxIconType.image
appearance.icon.size = CGSize(width: 50, height: 50)
appearance.icon.image.name = "success"
appearance.icon.position = BoxIconPosition.centerBelowTitle

// Animation
appearance.animation = BoxAnimationType.bounce

// Button
appearance.button.backgroundColor = UIColor.init(red: 103.0/255.0, green: 196.0/255.0, 
blue: 77.0/255.0, alpha: 1.0)

Alert #3

Show:

DialogBox.show(title: "Thank you!", message: "You are now a new member.", 
boxApp: appearance, buttonTitle: "Continue!", buttonAppearance: nil, 
actionBlock: nil)

Box Settings:

var appearance = BoxAppearance()

// Layout
appearance.layout.cornerRadius = 5.0
appearance.layout.width = 270.0

// Title
appearance.title.textColor = UIColor.darkGray
appearance.title.font = UIFont.boldSystemFont(ofSize: 17.0)

// Message
appearance.message.textColor = UIColor.darkGray
appearance.message.font = UIFont.systemFont(ofSize: 16.0)

// Icon
appearance.icon.type = BoxIconType.image
appearance.icon.size = CGSize(width: 70, height: 70)
appearance.icon.image.name = "success"
appearance.icon.margin = "0|-55|0|0"
appearance.icon.position = BoxIconPosition.topCenter
appearance.icon.backgroundColor = UIColor.white
appearance.icon.padding = "5|5|5|5"
appearance.icon.cornerRadius = 40

// Animation
appearance.animation = BoxAnimationType.bounce

// Button
appearance.button.backgroundColor = UIColor.init(red: 103.0/255.0, green: 196.0/255.0, 
blue: 77.0/255.0, alpha: 1.0)

Alert #4

Show:

DialogBox.show(title: "Thank you!", message: "You are now a new member.", 
boxApp: appearance, buttonTitle: "Continue!", buttonAppearance: nil, 
actionBlock: nil)

Box Setting:

var appearance = BoxAppearance()

// Layout
appearance.layout.padding = 0
appearance.layout.spacing = 0
appearance.layout.cornerRadius = 5.0
appearance.layout.width = 270.0

// Title
appearance.title.textColor = UIColor.white
appearance.title.backgroundColor = UIColor.init(red: 103.0/255.0, green: 196.0/255.0, blue: 77.0/255.0, alpha: 1.0)
appearance.title.padding = "0|100|0|10"

// Message
appearance.message.margin = "20|0|20|0"
appearance.message.textColor = UIColor.darkGray
appearance.message.font = UIFont.systemFont(ofSize: 16.0)

// Icon
appearance.icon.type = BoxIconType.image
appearance.icon.size = CGSize(width: 70, height: 70)
appearance.icon.image.name = "successWhite"
appearance.icon.margin = "0|-120|0|70"
appearance.icon.position = BoxIconPosition.centerBelowTitle

// Animation
appearance.animation = BoxAnimationType.bounce

// Button
appearance.button.containerMargin = "20|20|20|20"
appearance.button.textColor = UIColor.darkGray
appearance.button.backgroundColor = UIColor.init(red: 210.0/255.0, green: 210.0/255.0, 
blue: 210.0/255.0, alpha: 1.0)
appearance.button.bottomPosition.cornerRadius = 20.0

Alert #5

Show:

DialogBox.show(title: "Thank you!", message: "You are a new member.", boxApp: appearance, 
buttonTitle: "Continue!", buttonAppearance: nil, actionBlock: nil)

Box Setting:

var appearance = BoxAppearance()

// Layout
appearance.layout.cornerRadius = 5.0
appearance.layout.width = 270.0

// Title
appearance.title.textColor = UIColor.darkGray

// Message
appearance.message.textColor = UIColor.darkGray
appearance.message.textAlignment = NSTextAlignment.left
appearance.message.font = UIFont.systemFont(ofSize: 16.0)

// Icon
appearance.icon.type = BoxIconType.image
appearance.icon.size = CGSize(width: 50, height: 50)
appearance.icon.image.name = "success"
appearance.icon.position = BoxIconPosition.leftBesideMessage

// Animation
appearance.animation = BoxAnimationType.bounce

// Button
appearance.button.backgroundColor = UIColor.init(red: 103.0/255.0, green: 196.0/255.0, 
blue: 77.0/255.0, alpha: 1.0)

Alert #6

Show:

let dialogBox = DialogBox.init()
dialogBox.addButton(title: "No", buttonAppearance: btnAppearanceNo){
     print("Pressed No")
}
dialogBox.addButton(title: "Yes", buttonAppearance: btnAppearanceYes) {
     print("Pressed Yes")
}
dialogBox.show(title: "Warning!", message: "Do you really want to proceed with it?", 
boxApp: appearance)

Box Setting

var appearance = BoxAppearance()

// Layout
appearance.layout.cornerRadius = 5.0
appearance.layout.width = 270.0

// Title
appearance.title.textColor = UIColor.darkGray

// Message
appearance.message.textColor = UIColor.darkGray
appearance.message.font = UIFont.systemFont(ofSize: 16.0)

// Animation
appearance.animation = BoxAnimationType.bounce

// Button
appearance.button.titleFont = UIFont.boldSystemFont(ofSize: 17.0)

Button Setting – “No”

var btnAppearanceNo = BoxButtonAppearance()
btnAppearanceNo.backgroundColor = UIColor.init(red: 210.0/255.0, green: 210.0/255.0, 
blue: 210.0/255.0, alpha: 1.0)
btnAppearanceNo.textColor = UIColor.darkGray

Button Setting – “Yes”

var btnAppearanceYes = BoxButtonAppearance()
btnAppearanceYes.backgroundColor = UIColor.init(red: 237.0/255.0, green: 86.0/255.0, 
blue: 77.0/255.0, alpha: 1.0)
btnAppearanceYes.textColor = UIColor.white

Alert #7

Show:

let dialogBox = DialogBox.init()
dialogBox.addButton(title: "No", buttonAppearance: btnAppearanceNo) {
    print("Pressed No")
}
dialogBox.addButton(title: "Yes", buttonAppearance: btnAppearanceYes) {
    print("Pressed Yes")
}
dialogBox.show(title: "Warning!", message: "Do you really want to proceed with it?", boxApp: BoxAppearanceAlert._7)

Box Settings:

var appearance = BoxAppearance()

// Layout
appearance.layout.cornerRadius = 5.0
appearance.layout.width = 270.0

// Title
appearance.title.textColor = UIColor.darkGray

// Message
appearance.message.textColor = UIColor.darkGray

// Animation
appearance.animation = BoxAnimationType.bounce

// Button
appearance.button.bottomPosition.layout = BoxButtonBottomPositionLayout.withoutSpacing

Button Settings –  “No”:

var btnAppearanceNo = BoxButtonAppearance()
btnAppearanceNo.backgroundColor = UIColor.init(red: 210.0/255.0, green: 210.0/255.0, 
blue: 210.0/255.0, alpha: 1.0)
btnAppearanceNo.textColor = UIColor.darkGray

Button Settings – “Yes”:

var btnAppearanceYes = BoxButtonAppearance()
btnAppearanceYes.backgroundColor = UIColor.init(red: 237.0/255.0, green: 86.0/255.0, 
blue: 77.0/255.0, alpha: 1.0)
btnAppearanceYes.textColor = UIColor.white

Alert #8

Show Box:

let dialogBox = DialogBox.init()
dialogBox.addButton(title: "No", buttonAppearance: btnAppearanceNo) {
    print("Pressed No")
}
dialogBox.addButton(title: "Not sure", buttonAppearance: btnAppearanceNo) {
    print("Pressed Cancel")
}
dialogBox.addButton(title: "Yes", buttonAppearance: btnAppearanceYes) {
    print("Pressed Yes")
}
dialogBox.show(title: "Warning!", message: "Do you really want to proceed with it?", 
boxApp: appearance)

Box Setting

var appearance = BoxAppearance()

// Layout
appearance.layout.cornerRadius = 5.0
appearance.layout.width = 270.0

// Title
appearance.title.textColor = UIColor.darkGray

// Message
appearance.message.textColor = UIColor.darkGray
appearance.message.font = UIFont.systemFont(ofSize: 16.0)

// Animation
appearance.animation = BoxAnimationType.bounce

// Button
appearance.button.titleFont = UIFont.boldSystemFont(ofSize: 17.0)

Button Setting – “No”

var btnAppearanceNo = BoxButtonAppearance()
btnAppearanceNo.backgroundColor = UIColor.init(red: 210.0/255.0, green: 210.0/255.0, 
blue: 210.0/255.0, alpha: 1.0)
btnAppearanceNo.textColor = UIColor.darkGray

Button Setting – “Yes”

var btnAppearanceYes = BoxButtonAppearance()
btnAppearanceYes.backgroundColor = UIColor.init(red: 237.0/255.0, green: 86.0/255.0, 
blue: 77.0/255.0, alpha: 1.0)
btnAppearanceYes.textColor = UIColor.white

Alert #9

Show Box:

let dialogBox = DialogBox.init()
dialogBox.addButton(title: "No", buttonAppearance: btnAppearanceNo) {
    print("Pressed No")
}
dialogBox.addButton(title: "Go to App Store", buttonAppearance: btnAppearanceAppStore) {
    print("Pressed Go to AppStore")
}
dialogBox.show(title: "Update required!", message: "We have made tremendous changes in the new 
version, would you like to update the APP now?", boxApp: appearance)

Box Settings:

var appearance = BoxAppearance()

// Layout
appearance.layout.padding = 0

appearance.layout.cornerRadius = 0.0
appearance.layout.width = 270.0

// Title
appearance.title.padding = "0|10|0|10"
appearance.title.textColor = UIColor.darkGray
appearance.title.backgroundColor = UIColor.init(red: 220.0/255.0, green: 220.0/255.0, 
blue: 220.0/255.0, alpha: 1.0)

// Message
appearance.message.margin = "20|0|20|0"
appearance.message.textColor = UIColor.darkGray
appearance.message.font = UIFont.systemFont(ofSize: 16.0)

// Icon
appearance.icon.type = BoxIconType.image
appearance.icon.image.name = "update"
appearance.icon.size = CGSize(width: 70, height: 70)

// Animation
appearance.animation = BoxAnimationType.bounce

// Button
appearance.button.borderWidth = 1.0
appearance.button.borderColor = UIColor.lightGray
appearance.button.bottomPosition.layout = BoxButtonBottomPositionLayout.withoutSpacing
appearance.button.bottomPosition.maximumNoOfButtonsInSingleRow = 1

Button Setting – “No”

var btnAppearanceNo = BoxButtonAppearance()
btnAppearanceNo.backgroundColor = UIColor.white
btnAppearanceNo.textColor = UIColor.darkGray

Button Settings – “Go to App Store”

var btnAppearanceAppStore = BoxButtonAppearance()
btnAppearanceAppStore.backgroundColor = UIColor.init(red: 32.0/255.0, green: 128.0/255.0, 
blue: 175.0/255.0, alpha: 1.0)
btnAppearanceAppStore.textColor = UIColor.white

Alert #10

Show Box:

DialogBox.show(title: "Error!", message: "Oops, something went wrong.", 
boxApp: appearance, buttonTitle: "Try Again", buttonAppearance: nil, buttonBlock: {
    print("Pressed Try Again")
}, closeBlock: {
    print("Pressed Cancel")
})

Box Setting:

var appearance = BoxAppearance()

// Layout
appearance.layout.cornerRadius = 5.0
appearance.layout.width = 270.0
appearance.layout.backgroundColor = UIColor.init(red: 212.0/255.0, green: 72.0/255.0, 
blue: 59.0/255.0, alpha: 1.0)

// Title
appearance.title.padding = "0|30|0|10"
appearance.title.textColor = UIColor.white
appearance.title.font = UIFont.boldSystemFont(ofSize: 18.0)

// Message
appearance.message.margin = "20|0|20|0"
appearance.message.textColor = UIColor.white
appearance.message.font = UIFont.systemFont(ofSize: 16.0)

// Icon
appearance.icon.type = BoxIconType.image
appearance.icon.image.name = "error"
appearance.icon.size = CGSize(width: 70, height: 70)

// Animation
appearance.animation = BoxAnimationType.bounce

// Button
appearance.button.backgroundColor = UIColor.init(red: 163.0/255.0, green: 54.0/255.0, 
blue: 44.0/255.0, alpha: 1.0)
appearance.button.bottomPosition.cornerRadius = 20.0
appearance.button.containerMargin = "0|10|0|10"

// Close
appearance.closeButton.show = true
appearance.closeButton.font = UIFont.boldSystemFont(ofSize: 16.0)
appearance.closeButton.title = "X"
appearance.closeButton.textColor = UIColor.white
appearance.closeButton.position = BoxCloseButtonPosition.cornerInside

Alert #11

Show Box:

DialogBox.show(title: "Thank you!", message: "You are now a new member.", 
boxApp: appearance, closeBlock:{
    print("Pressed Cancel")
})

Box Settings:

var appearance = BoxAppearance()
        
// Layout
appearance.layout.cornerRadius = 5.0
appearance.layout.width = 270.0
        
// Title
appearance.title.textColor = UIColor.darkGray
        
// Message
appearance.message.textColor = UIColor.darkGray
        
// Animation
appearance.animation = BoxAnimationType.bounce
        
// Close
appearance.closeButton.show = true
appearance.closeButton.imageName = "cancel"
appearance.closeButton.position = BoxCloseButtonPosition.cornerOutside

Alert #12

Show Box:

let dialogBox = DialogBox.init()
dialogBox.addButton(title: "No", buttonAppearance: nil) {
    print("Pressed No")
}
dialogBox.addButton(title: "Yes", buttonAppearance: nil) {
    print("Pressed Yes")
}
dialogBox.show(title: "Warning!", message: "Do you really want to proceed with it?", 
boxApp: appearance)

Box Settings:

var appearance = BoxAppearance()
        
// Layout
appearance.layout.padding = 0.0
appearance.layout.cornerRadius = 5.0
appearance.layout.width = 270.0
        
// Title
appearance.title.textAlignment = NSTextAlignment.left
appearance.title.textColor = UIColor.darkGray
appearance.title.margin = "20|20|20|0"
       
// Message
appearance.message.textAlignment = NSTextAlignment.left
appearance.message.textColor = UIColor.darkGray
appearance.message.margin = "20|0|20|0"
        
// Animation
appearance.animation = BoxAnimationType.bounce
        
// Button
appearance.button.bottomPosition.cornerRadius = 0
appearance.button.containerMargin = "120|0|0|10"
appearance.button.bottomPosition.horizontalSpacing = 0.0
appearance.button.backgroundColor = UIColor.white
appearance.button.textColor = UIColor.init(red: 237.0/255.0, green: 86.0/255.0, blue: 77.0/255.0, alpha: 1.0)

Alert #13:

Show Box:

DialogBox.show(title: "Success!", message: "Your email has been sent.", boxApp: appearance, 
buttonTitle: "Go back", buttonAppearance: nil) {
    print("Go back")
}

Box Settings:

var appearance = BoxAppearance()
        
// Layout
appearance.layout.backgroundColor = UIColor.init(red: 99.0/255.0, green: 157.0/255.0, blue: 72.0/255.0, alpha: 1.0)
appearance.layout.cornerRadius = 10.0
appearance.layout.width = 300.0
        
// Title
appearance.title.textColor = UIColor.white
appearance.title.font = UIFont.boldSystemFont(ofSize: 20.0)
        
// Message
appearance.message.textColor = UIColor.white
appearance.message.font = UIFont.systemFont(ofSize: 17.0)
        
// Icon
appearance.icon.type = BoxIconType.image
appearance.icon.image.name = "email"
appearance.icon.margin = "0|30|0|20"
appearance.icon.position = BoxIconPosition.topCenter
appearance.icon.size = CGSize(width: 116, height: 117)
        
// Animation
appearance.animation = BoxAnimationType.bounce
        
// Button
appearance.button.bottomPosition.cornerRadius = 20
appearance.button.backgroundColor = UIColor.init(red: 99.0/255.0, green: 157.0/255.0, blue: 72.0/255.0, alpha: 1.0)
appearance.button.textColor = UIColor.white
appearance.button.borderColor = UIColor.white
appearance.button.borderWidth = 2.0
appearance.button.containerMargin = "70|20|70|40"

Alert #14

Show Box:

DialogBox.show(title: nil, message: "Profile Saved", boxApp: appearance)

Box Settings:

var appearance = BoxAppearance()
        
appearance.autoDismiss = true
appearance.position = BoxPosition.bottom
        
// Layout
appearance.layout.backgroundColor = UIColor.white
appearance.layout.cornerRadius = 10.0
appearance.layout.width = 170.0
        
// Background
appearance.containerBackground.style = BoxBackgroundStyle.customColor
appearance.containerBackground.color = UIColor.init(red: 0.0, green: 0.0, blue: 0.0, 
alpha: 0.7)
appearance.containerBackground.tapToDismiss = true
        
// Message
appearance.message.textColor = UIColor.black
appearance.message.font = UIFont.boldSystemFont(ofSize: 18.0)
        
// Icon
appearance.icon.type = BoxIconType.image
appearance.icon.image.name = "save"
appearance.icon.position = BoxIconPosition.topCenter
appearance.icon.size = CGSize(width: 70, height: 70)
        
// Animation
appearance.animation = BoxAnimationType.bounce

Notification #1

Show Box:

DialogBox.show(title: "Thank you!", message: "You are now a new member.", 
boxApp: appearance)

Box Settings:

var appearance = BoxAppearance()
        
appearance.position = BoxPosition.top
appearance.positionMargin = 20
appearance.autoDismiss = true
        
// Layout
appearance.layout.spacing = 10
appearance.layout.padding = 10
appearance.layout.cornerRadius = 5.0
appearance.layout.width = 270.0
appearance.layout.backgroundColor = UIColor.init(red: 98.0/255.0, green: 193.0/255.0, 
blue: 104.0/255.0, alpha: 1.0)
        
// Background
appearance.containerBackground.tapToDismiss = true
appearance.containerBackground.style = BoxBackgroundStyle.customColor
appearance.containerBackground.color = UIColor.init(red: 0.0, green: 0.0, blue: 0.0, 
alpha: 0.7)
        
// Title
appearance.title.textColor = UIColor.white
appearance.title.textAlignment = NSTextAlignment.left
appearance.title.font = UIFont.boldSystemFont(ofSize: 17.0)
appearance.title.margin = "10|0|10|0"
        
// Message
appearance.message.textColor = UIColor.white
appearance.message.textAlignment = NSTextAlignment.left
appearance.message.font = UIFont.systemFont(ofSize: 16.0)
appearance.message.margin = "10|0|10|0"
        
// Animation
appearance.animation = BoxAnimationType.slideFromTop

 

Notification #2

Show Box:

DialogBox.show(title: "Internet connection required.", message: nil, boxApp: appearance, 
superView: self.view)

Box Settings:

var appearance = BoxAppearance()

appearance.position = BoxPosition.top
appearance.positionMargin = 64
appearance.autoDismiss = true

// Layout
appearance.layout.spacing = 10
appearance.layout.padding = 20
appearance.layout.cornerRadius = 0.0
appearance.layout.width = Float(UIScreen.main.bounds.size.width)
appearance.layout.backgroundColor = UIColor.init(red: 225.0/255.0, green: 78.0/255.0, 
blue: 73.0/255.0, alpha: 1.0)

// Background
appearance.containerBackground.tapToDismiss = true
appearance.containerBackground.style = BoxBackgroundStyle.customColor
appearance.containerBackground.color = UIColor.init(red: 0.0, green: 0.0, blue: 0.0, 
alpha: 0.7)

// Title
appearance.title.textColor = UIColor.white
appearance.title.textAlignment = NSTextAlignment.left
appearance.title.font = UIFont.boldSystemFont(ofSize: 17.0)

// Icon
appearance.icon.type = BoxIconType.image
appearance.icon.position = BoxIconPosition.leftFullHeight
appearance.icon.image.name = "warning"
appearance.icon.padding = "20|0|20|0"

// Animation
appearance.animation = BoxAnimationType.slideFromTop

Notification #3

Show Box:

DialogBox.show(title: "Internet connection required.", message: nil, 
boxApp: appearance, superView: self.view)

Box Settings:

var appearance = BoxAppearance()

appearance.position = BoxPosition.top
appearance.positionMargin = 64
appearance.autoDismiss = true

// Layout
appearance.layout.spacing = 10
appearance.layout.padding = 20

appearance.layout.cornerRadius = 0.0
appearance.layout.width = Float(UIScreen.main.bounds.size.width)
appearance.layout.backgroundColor = UIColor.init(red: 225.0/255.0, green: 78.0/255.0, 
blue: 73.0/255.0, alpha: 1.0)

// Background
appearance.containerBackground.tapToDismiss = true
appearance.containerBackground.style = BoxBackgroundStyle.customColor
appearance.containerBackground.color = UIColor.init(red: 0.0, green: 0.0, blue: 0.0, 
alpha: 0.7)

// Title
appearance.title.textColor = UIColor.white
appearance.title.textAlignment = NSTextAlignment.left
appearance.title.font = UIFont.boldSystemFont(ofSize: 17.0)

// Icon
appearance.icon.type = BoxIconType.image
appearance.icon.image.name = "warning"
appearance.icon.padding = "20|0|20|0"
appearance.icon.position = BoxIconPosition.leftFullHeight
appearance.icon.separator.show = true
appearance.icon.separator.borderWidth = 1.0
appearance.icon.separator.color = UIColor.white
appearance.icon.separator.margin = 10.0

// Animation
appearance.animation = BoxAnimationType.slideFromTop

Notification #4

Show Box:

DialogBox.show(title: "Login successful.", message: nil, boxApp: appearance)

Box Settings:

var appearance = BoxAppearance()

appearance.position = BoxPosition.top
appearance.positionMargin = 20
appearance.autoDismiss = true

// Layout
appearance.layout.spacing = 10
appearance.layout.padding = 20
appearance.layout.cornerRadius = 10.0
appearance.layout.width = 300.0
appearance.layout.backgroundColor = UIColor.white
appearance.layout.borderWidth = 2.0
appearance.layout.borderColor = UIColor.init(red: 142.0/255.0, green: 176.0/255.0, 
blue: 37.0/255.0, alpha: 1.0)

// Background
appearance.containerBackground.tapToDismiss = true
appearance.containerBackground.style = BoxBackgroundStyle.customColor
appearance.containerBackground.color = UIColor.init(red: 0.0, green: 0.0, blue: 0.0, 
alpha: 0.7)

// Title
appearance.title.textColor = UIColor.darkGray
appearance.title.textAlignment = NSTextAlignment.left
appearance.title.font = UIFont.systemFont(ofSize: 16.0)

// Icon
appearance.icon.type = BoxIconType.image
appearance.icon.position = BoxIconPosition.leftFullHeight
appearance.icon.image.name = "successWhite"
appearance.icon.padding = "20|0|20|0"
appearance.icon.size = CGSize(width: 30, height: 30)
appearance.icon.backgroundColor = UIColor.init(red: 142.0/255.0, green: 176.0/255.0, 
blue: 37.0/255.0, alpha: 1.0)

// Animation
appearance.animation = BoxAnimationType.slideFromTop

Notification #5

Show Box:

DialogBox.show(title: "Thank you!", message: "You are a new member.", boxApp: appearance, 
buttonTitle: "Ok", buttonAppearance: nil) {
     print("Pressed Continue")
}

Box Settings:

var appearance = BoxAppearance()

appearance.position = BoxPosition.top
appearance.positionMargin = 20

// Layout
appearance.layout.spacing = 5
appearance.layout.padding = 10
appearance.layout.cornerRadius = 5.0
appearance.layout.width = 300.0
appearance.layout.backgroundColor = UIColor.white

// Background
appearance.containerBackground.style = BoxBackgroundStyle.customColor
appearance.containerBackground.color = UIColor.init(red: 0.0, green: 0.0, blue: 0.0, 
alpha: 0.7)

// Title
appearance.title.textColor = UIColor.darkGray
appearance.title.textAlignment = NSTextAlignment.left
appearance.title.font = UIFont.boldSystemFont(ofSize: 17.0)

// Message
appearance.message.textColor = UIColor.darkGray
appearance.message.textAlignment = NSTextAlignment.left
appearance.message.font = UIFont.systemFont(ofSize: 16.0)

// Icon
appearance.icon.type = BoxIconType.image
appearance.icon.image.name = "success"
appearance.icon.position = BoxIconPosition.leftFullHeight
appearance.icon.padding = "10|0|10|0"

// Animation
appearance.animation = BoxAnimationType.slideFromTop

// Button
appearance.button.titleFont = UIFont.boldSystemFont(ofSize: 17.0)
appearance.button.textColor = UIColor.white
appearance.button.backgroundColor = UIColor.init(red: 98.0/255.0, green: 193.0/255.0, 
blue: 104.0/255.0, alpha: 1.0)
appearance.button.position = BoxButtonPosition.right

Notification #6

Show Box:

let dialogBox = DialogBox()
dialogBox.addButton(title: "Yes", buttonAppearance: nil) {
     print("Pressed Yes")
}
dialogBox.addButton(title: "No", buttonAppearance: nil) {
     print("Pressed No")
}
dialogBox.show(title: "Thank you!", message: "You are a new member.", boxApp: appearance)

Box Settings:

var appearance = BoxAppearance()

appearance.position = BoxPosition.top
appearance.positionMargin = 20

// Layout
appearance.layout.spacing = 5
appearance.layout.padding = 10
appearance.layout.cornerRadius = 5.0
appearance.layout.width = 300.0
appearance.layout.backgroundColor = UIColor.init(red: 225.0/255.0, green: 78.0/255.0, 
blue: 73.0/255.0, alpha: 1.0)
       
// Background
appearance.containerBackground.style = BoxBackgroundStyle.customColor
appearance.containerBackground.color = UIColor.init(red: 0.0, green: 0.0, blue: 0.0, 
alpha: 0.7)

// Title
appearance.title.textColor = UIColor.white
appearance.title.textAlignment = NSTextAlignment.left
appearance.title.font = UIFont.boldSystemFont(ofSize: 17.0)

// Message
appearance.message.textColor = UIColor.white
appearance.message.textAlignment = NSTextAlignment.left
appearance.message.font = UIFont.systemFont(ofSize: 16.0)

// Icon
appearance.icon.type = BoxIconType.image
appearance.icon.image.name = "warning"
appearance.icon.size = CGSize(width: 30, height: 30)
appearance.icon.position = BoxIconPosition.leftFullHeight
appearance.icon.padding = "10|0|10|0"

// Animation
appearance.animation = BoxAnimationType.slideFromTop

// Button
appearance.button.titleFont = UIFont.boldSystemFont(ofSize: 17.0)
appearance.button.textColor = UIColor.white
appearance.button.backgroundColor = UIColor.init(red: 178.0/255.0, green: 62.0/255.0, 
blue: 59.0/255.0, alpha: 1.0)
appearance.button.borderColor = UIColor.white
appearance.button.borderWidth = 1.0
appearance.button.position = BoxButtonPosition.right

Notification #7

Show Box:

DialogBox.show(title: "Thank you!", message: "You are now a new member.", 
boxApp: appearance)

Box Settings:

var appearance = BoxAppearance()

appearance.position = BoxPosition.top
appearance.positionMargin = 20

// Layout
appearance.layout.spacing = 10
appearance.layout.padding = 10
appearance.layout.cornerRadius = 5.0
appearance.layout.width = 270.0
appearance.layout.backgroundColor = UIColor.init(red: 98.0/255.0, green: 193.0/255.0, 
blue: 104.0/255.0, alpha: 1.0)

// Background
appearance.containerBackground.style = BoxBackgroundStyle.customColor
appearance.containerBackground.color = UIColor.init(red: 0.0, green: 0.0, blue: 0.0, 
alpha: 0.7)

// Title
appearance.title.textColor = UIColor.white
appearance.title.textAlignment = NSTextAlignment.left
appearance.title.font = UIFont.boldSystemFont(ofSize: 17.0)
appearance.title.margin = "10|0|10|0"

// Message
appearance.message.textColor = UIColor.white
appearance.message.textAlignment = NSTextAlignment.left
appearance.message.font = UIFont.systemFont(ofSize: 16.0)
appearance.message.margin = "10|0|10|0"

// Animation
appearance.animation = BoxAnimationType.slideFromTop

// Close
appearance.closeButton.show = true
appearance.closeButton.position = BoxCloseButtonPosition.cornerInside
appearance.closeButton.title = "x"
appearance.closeButton.textColor = UIColor.white

Notification #8

Show Box:

DialogBox.show(title: "Thank you!", message: "You are now a new member.", 
boxApp: appearance)

Box Settings:

var appearance = BoxAppearance()

appearance.position = BoxPosition.top
appearance.positionMargin = 30

// Layout
appearance.layout.spacing = 10
appearance.layout.padding = 10
appearance.layout.cornerRadius = 5.0
appearance.layout.width = 270.0
appearance.layout.backgroundColor = UIColor.white
       
// Background
appearance.containerBackground.style = BoxBackgroundStyle.customColor
appearance.containerBackground.color = UIColor.init(red: 0.0, green: 0.0, blue: 0.0, 
alpha: 0.7)

// Title
appearance.title.textColor = UIColor.init(red: 98.0/255.0, green: 193.0/255.0, 
blue: 104.0/255.0, alpha: 1.0)
appearance.title.textAlignment = NSTextAlignment.left
appearance.title.font = UIFont.boldSystemFont(ofSize: 17.0)
appearance.title.margin = "10|0|10|0"

// Message
appearance.message.textColor = UIColor.darkGray
appearance.message.textAlignment = NSTextAlignment.left
appearance.message.font = UIFont.systemFont(ofSize: 16.0)
appearance.message.margin = "10|0|10|0"

// Animation
appearance.animation = BoxAnimationType.slideFromTop

// Close 
appearance.closeButton.show = true
appearance.closeButton.position = BoxCloseButtonPosition.cornerOutside
appearance.closeButton.imageName = "cancel"

Loading #1

Show Box:

DialogBox.show(title: nil, message: nil, boxApp: appearance)

Box Settings:

var appearance = BoxAppearance()

appearance.position = BoxPosition.center
appearance.positionMargin = 20
appearance.autoDismiss = true

// Layout
appearance.layout.padding = 10
appearance.layout.enableShadow = false
appearance.layout.width = 100.0
appearance.layout.backgroundColor = UIColor.clear
       
// Background
appearance.containerBackground.tapToDismiss = true
appearance.containerBackground.style = BoxBackgroundStyle.customColor
appearance.containerBackground.color = UIColor.init(red: 0.0, green: 0.0, blue: 0.0, alpha: 0.7)

// Icon
appearance.icon.type = BoxIconType.loading

// Animation
appearance.animation = BoxAnimationType.fade

Loading #2

Show Box:

DialogBox.show(title: nil, message: nil, boxApp: appearance)

Box Settings:

var appearance = BoxAppearance()

appearance.position = BoxPosition.center
appearance.positionMargin = 20
appearance.autoDismiss = true

// Layout
appearance.layout.padding = 10
appearance.layout.enableShadow = false
appearance.layout.width = 100.0
appearance.layout.backgroundColor = UIColor.clear

// Background
appearance.containerBackground.tapToDismiss = true
appearance.containerBackground.style = BoxBackgroundStyle.customColor
appearance.containerBackground.color = UIColor.init(red: 0.0, green: 0.0, blue: 0.0, alpha: 0.7)

// Icon
appearance.icon.type = BoxIconType.loading
appearance.icon.loading.imageName = "loadingBlue"

// Animation
appearance.animation = BoxAnimationType.fade

Loading #3

Show Box:

DialogBox.show(title: nil, message: nil, boxApp: appearance)

Box Settings:

var appearance = BoxAppearance()

appearance.position = BoxPosition.center
appearance.positionMargin = 20
appearance.autoDismiss = true

// Layout
appearance.layout.padding = 20
appearance.layout.enableShadow = false
appearance.layout.width = 80.0
appearance.layout.backgroundColor = UIColor.white

// Background
appearance.containerBackground.tapToDismiss = true
appearance.containerBackground.style = BoxBackgroundStyle.customColor
appearance.containerBackground.color = UIColor.init(red: 0.0, green: 0.0, blue: 0.0, alpha: 0.7)

// Icon
appearance.icon.type = BoxIconType.loading
appearance.icon.loading.imageName = "loadingBlue"

// Animation
appearance.animation = BoxAnimationType.fade

Loading #4

Show Box:

DialogBox.show(title: nil, message: "Please wait", boxApp: appearance)

Box Settings:

var appearance = BoxAppearance()

appearance.position = BoxPosition.center
appearance.positionMargin = 20
appearance.autoDismiss = true

// Layout
appearance.layout.padding = 10
appearance.layout.spacing = 10
appearance.layout.enableShadow = false
appearance.layout.width = 150.0
appearance.layout.backgroundColor = UIColor.white

// Background
appearance.containerBackground.tapToDismiss = true
appearance.containerBackground.style = BoxBackgroundStyle.customColor
appearance.containerBackground.color = UIColor.init(red: 0.0, green: 0.0, blue: 0.0, alpha: 0.7)

// Icon
appearance.icon.type = BoxIconType.loading
appearance.icon.position = BoxIconPosition.topCenter

appearance.icon.loading.imageName = "loadingPurple"

// Animation
appearance.animation = BoxAnimationType.fade

Loading #5

Show Box:

DialogBox.show(title: "Please wait", message: nil, boxApp: appearance)

Box Settings:

var appearance = BoxAppearance()

appearance.position = BoxPosition.center
appearance.positionMargin = 20
appearance.autoDismiss = true

// Layout
appearance.layout.padding = 10
appearance.layout.spacing = 10
appearance.layout.enableShadow = false
appearance.layout.width = 150.0
appearance.layout.backgroundColor = UIColor.white

// Background
appearance.containerBackground.tapToDismiss = true
appearance.containerBackground.style = BoxBackgroundStyle.customColor
appearance.containerBackground.color = UIColor.init(red: 0.0, green: 0.0, blue: 0.0, alpha: 0.7)

// Title
appearance.title.font = UIFont.systemFont(ofSize: 16.0)
appearance.title.textColor = UIColor.darkGray

// Icon
appearance.icon.type = BoxIconType.loading
appearance.icon.position = BoxIconPosition.centerBelowTitle
appearance.icon.loading.imageName = "loadingPurple"

// Animation
appearance.animation = BoxAnimationType.fade

Loading #6

Show Box:

DialogBox.show(title: nil, message: "Please wait", boxApp: BoxAppearanceLoading._6)

Box Settings:

var appearance = BoxAppearance()

appearance.position = BoxPosition.center
appearance.positionMargin = 20
appearance.autoDismiss = true

// Layout
appearance.layout.padding = 10
appearance.layout.spacing = 0
appearance.layout.enableShadow = false
appearance.layout.width = 150.0
appearance.layout.backgroundColor = UIColor.white

// Background
appearance.containerBackground.tapToDismiss = true
appearance.containerBackground.style = BoxBackgroundStyle.customColor
appearance.containerBackground.color = UIColor.init(red: 0.0, green: 0.0, blue: 0.0, alpha: 0.7)

// Icon
appearance.icon.type = BoxIconType.loading
appearance.icon.position = BoxIconPosition.leftBesideMessage

appearance.icon.loading.imageName = "loadingPurple"
appearance.icon.size = CGSize(width: 20, height: 20)

// Animation
appearance.animation = BoxAnimationType.fade

Loading #7

Show Box:

DialogBox.show(title: "Please wait", message: "We are processing your request", boxApp: appearance)

Box Settings:

var appearance = BoxAppearance()

appearance.position = BoxPosition.center
appearance.positionMargin = 20
appearance.autoDismiss = true

// Layout
appearance.layout.padding = 10
appearance.layout.spacing = 10
appearance.layout.enableShadow = false
appearance.layout.width = 250.0
appearance.layout.backgroundColor = UIColor.white

// Background
appearance.containerBackground.tapToDismiss = true
appearance.containerBackground.style = BoxBackgroundStyle.customColor
appearance.containerBackground.color = UIColor.init(red: 0.0, green: 0.0, blue: 0.0, alpha: 0.7)

// Icon
appearance.icon.type = BoxIconType.loading
appearance.icon.position = BoxIconPosition.centerBelowTitle

appearance.icon.loading.imageName = "loadingPurple"

// Animation
appearance.animation = BoxAnimationType.fade

Loading #8

Show Box:

DialogBox.show(title: "Please wait...", message: "Processing your request", boxApp: appearance)

Box Settings:

var appearance = BoxAppearance()

appearance.position = BoxPosition.center
appearance.positionMargin = 20
appearance.autoDismiss = true

// Layout
appearance.layout.enableShadow = false
appearance.layout.width = 300.0
appearance.layout.backgroundColor = UIColor.white

// Title
appearance.title.textAlignment = NSTextAlignment.left

// Message
appearance.message.textAlignment = NSTextAlignment.left

// Background
appearance.containerBackground.tapToDismiss = true
appearance.containerBackground.style = BoxBackgroundStyle.customColor
appearance.containerBackground.color = UIColor.init(red: 0.0, green: 0.0, blue: 0.0, alpha: 0.7)

// Icon
appearance.icon.type = BoxIconType.loading
appearance.icon.position = BoxIconPosition.leftBesideMessage
appearance.icon.loading.imageName = "loadingPurple"

// Animation
appearance.animation = BoxAnimationType.fade

Screen message #1

Show Box:

DialogBox.show(title: nil, message: "Sorry we couldn't find any matches for search", boxApp: appearance, superView: self.view)

Box Settings:

var appearance = BoxAppearance()

appearance.position = BoxPosition.center
appearance.positionMargin = 20
appearance.autoDismiss = true

// Layout
appearance.layout.padding = 10
appearance.layout.enableShadow = false
appearance.layout.width = Float(UIScreen.main.bounds.size.width-40)
appearance.layout.backgroundColor = UIColor.clear

// Background
appearance.containerBackground.tapToDismiss = true
appearance.containerBackground.style = BoxBackgroundStyle.customColor
appearance.containerBackground.color = UIColor.white

// Message
appearance.message.font = UIFont.boldSystemFont(ofSize: 16.0)
appearance.message.textColor = UIColor.darkGray

// Icon
appearance.icon.type = BoxIconType.image
appearance.icon.image.name = "search"
appearance.icon.size = CGSize(width: 100, height: 100)

// Animation
appearance.animation = BoxAnimationType.none

Screen Message #2

Show Box:

DialogBox.show(title: nil, message: "Internet connection not found", superView: self.view , boxApp: appearance, buttonTitle: "Try Again", buttonAppearance: nil){ 
     print("Pressed Try Again")
}

Box Settings:

var appearance = BoxAppearance()

appearance.position = BoxPosition.center
appearance.positionMargin = 20
appearance.autoDismiss = true

// Layout
appearance.layout.padding = 10
appearance.layout.enableShadow = false
appearance.layout.width = Float(UIScreen.main.bounds.size.width-40)
appearance.layout.backgroundColor = UIColor.clear

// Background
appearance.containerBackground.style = BoxBackgroundStyle.customColor
appearance.containerBackground.color = UIColor.white

// Message
appearance.message.font = UIFont.boldSystemFont(ofSize: 16.0)
appearance.message.textColor = UIColor.darkGray

// Icon
appearance.icon.type = BoxIconType.image
appearance.icon.image.name = "wifi"
appearance.icon.size = CGSize(width: 100, height: 100)

// Animation
appearance.animation = BoxAnimationType.none

// Button
appearance.button.containerMargin = "80|0|80|0"
appearance.button.titleFont = UIFont.boldSystemFont(ofSize: 17.0)
appearance.button.bottomPosition.cornerRadius = 20.0
appearance.button.bottomPosition.maximumNoOfButtonsInSingleRow = 1
appearance.button.backgroundColor = UIColor.init(red: 0.0, green: 165.0/255.0, blue: 218.0/255.0, alpha: 1.0)

Screen Message #3

Show Box:

DialogBox.show(title: "You have no podcast", message: "Subscribe to a podcast or download episodes to add them to Unplayed.",superView: self.view , boxApp: appearance, buttonTitle: "Show Featured Podcast", buttonAppearance: nil) {
     print("Button Pressed")
}

Box Settings:

var appearance = BoxAppearance()

appearance.position = BoxPosition.center
appearance.positionMargin = 20
appearance.autoDismiss = true

// Layout
appearance.layout.padding = 10
appearance.layout.enableShadow = false
appearance.layout.width = Float(UIScreen.main.bounds.size.width-40)
appearance.layout.backgroundColor = UIColor.clear

// Background
appearance.containerBackground.style = BoxBackgroundStyle.customColor
appearance.containerBackground.color = UIColor.white

// Title
appearance.title.font = UIFont.boldSystemFont(ofSize: 17.0)

// Message
appearance.message.font = UIFont.systemFont(ofSize: 16.0)
appearance.message.textColor = UIColor.darkGray

// Icon
appearance.icon.type = BoxIconType.image
appearance.icon.image.name = "podcast"
appearance.icon.size = CGSize(width: 100, height: 100)

// Animation
appearance.animation = BoxAnimationType.none

// Button
appearance.button.titleFont = UIFont.boldSystemFont(ofSize: 17.0)
appearance.button.bottomPosition.cornerRadius = 20.0
appearance.button.bottomPosition.maximumNoOfButtonsInSingleRow = 1
appearance.button.textColor = UIColor.init(red: 127.0/255.0, green: 34.0/255.0, blue: 185.0/255.0, alpha: 1.0)
appearance.button.backgroundColor = UIColor.clear
appearance.button.titleFont = UIFont.boldSystemFont(ofSize: 16.0)

Screen Message #4

Show Box:

DialogBox.show(title: "Success", message: "Your profile has been created successfully.", boxApp: appearance, buttonTitle: "Ok", buttonAppearance: nil, actionBlock: nil)

Box Settings:

var appearance = BoxAppearance()

// Layout
appearance.layout.cornerRadius = 5.0
appearance.layout.width = Float(UIScreen.main.bounds.size.width - CGFloat(40.0))
appearance.layout.backgroundColor = UIColor.clear
appearance.layout.enableShadow = false

// Title
appearance.title.textColor = UIColor.darkGray
appearance.title.font = UIFont.boldSystemFont(ofSize: 17.0)
appearance.title.textColor = UIColor.init(red: 23.0/255.0, green: 76.0/255.0, blue: 43.0/255.0, alpha: 1.0)

// Message
appearance.message.textColor = UIColor.darkGray
appearance.message.font = UIFont.systemFont(ofSize: 16.0)
appearance.message.textColor = UIColor.init(red: 23.0/255.0, green: 76.0/255.0, blue: 43.0/255.0, alpha: 1.0)
appearance.message.margin = "0|0|0|20"

// Icon
appearance.icon.type = BoxIconType.image
appearance.icon.size = CGSize(width: 100, height: 100)
appearance.icon.image.name = "successWhite"
appearance.icon.position = BoxIconPosition.topCenter
appearance.icon.margin = "0|0|0|80"

// Animation
appearance.animation = BoxAnimationType.none

appearance.containerBackground.style = BoxBackgroundStyle.customColor
appearance.containerBackground.color = UIColor.init(red: 100.0/255.0, green: 208.0/255.0, blue: 44.0/255.0, alpha: 1.0)

// Button
appearance.button.titleFont = UIFont.boldSystemFont(ofSize: 17.0)
appearance.button.textColor = UIColor.darkGray
appearance.button.backgroundColor = UIColor.white
appearance.button.bottomPosition.cornerRadius = 3.0
appearance.button.containerMargin = "50|0|50|0"

Screen Message #5

Show Box:

DialogBox.show(title: "Welcome John!", message: "Your profile has been created successfully.", boxApp: appearance, buttonTitle: "Continue!", buttonAppearance: nil, actionBlock: nil)

Box Settings:

var appearance = BoxAppearance()

appearance.position = BoxPosition.top
appearance.positionMargin = 0

// Layout
appearance.layout.padding = 0
appearance.layout.cornerRadius = 5.0
appearance.layout.width = Float(UIScreen.main.bounds.size.width)
appearance.layout.backgroundColor = UIColor.clear
appearance.layout.enableShadow = false

// Title
appearance.title.textColor = UIColor.init(red: 10.0/255.0, green: 9.0/255.0, blue: 79.0/255.0, alpha: 1.0)
appearance.title.textAlignment = NSTextAlignment.left
appearance.title.font = UIFont.boldSystemFont(ofSize: 17.0)
appearance.title.margin = "20|30|0|0"

// Message
appearance.message.textColor = UIColor.darkGray
appearance.message.textAlignment = NSTextAlignment.left
appearance.message.font = UIFont.systemFont(ofSize: 16.0)
appearance.message.margin = "20|0|0|20"

// Icon
appearance.icon.type = BoxIconType.image
appearance.icon.size = CGSize(width: 100, height: 100)
appearance.icon.image.name = "successWhite"
appearance.icon.position = BoxIconPosition.topCenter
appearance.icon.backgroundColor = UIColor.init(red: 100.0/255.0, green: 208.0/255.0, blue: 44.0/255.0, alpha: 1.0)
appearance.icon.padding = "\((Float(UIScreen.main.bounds.size.width) - 100)/2)|100|\((Float(UIScreen.main.bounds.size.width) - 100)/2)|100"

// Animation
appearance.animation = BoxAnimationType.none

// Background
appearance.containerBackground.style = BoxBackgroundStyle.customColor
appearance.containerBackground.color = UIColor.white

// Button
appearance.button.titleFont = UIFont.boldSystemFont(ofSize: 17.0)
appearance.button.textColor = UIColor.white
appearance.button.backgroundColor = UIColor.init(red: 177.0/255.0, green: 209.0/255.0, blue: 6.0/255.0, alpha: 1.0)
appearance.button.bottomPosition.cornerRadius = 3.0
appearance.button.containerMargin = "70|40|70|0"