Latest 1.1.3
Homepage https://github.com/danjiang/DTMessageBar
License MIT
Platforms ios 8.4, requires ARC
Authors

Swift
Platform
CocoaPods
Carthage compatible

Introduction

Simple message bar.

Demo

Standard Style.

Success Standard

Info Standard

Warning Standard

Error Standard

Emoji Style.

Success Emoji

Info Emoji

Warning Emoji

Error Emoji

Installation

Requirement

iOS 8.4+

CocoaPods

To install DTMessageBar add a dependency to your Podfile:

pod "DTMessageBar"

Carthage

To install DTMessageBar add a dependency to your Cartfile:

github "danjiang/DTMessageBar"
carthage update --platform ios

Usage

Import

import DTMessageBar

Use

DTMessageBar.error(message: "Good Jobs") // Top is default position
DTMessageBar.success(message: "Good Jobs", position: .top)
DTMessageBar.info(message: "Good Jobs", position: .center)
DTMessageBar.warning(message: "Good Jobs", position: .bottom)

Customize

Icon Set

DTMessageBar.iconSet = .standard // Standard is default icon set
DTMessageBar.iconSet = .emoji
DTMessageBar.iconSet = .custom // You should put your own icon set in Assets.xcassets with name as success_custom, info_custom, warning_custom and error_custom.

Theme

DTMessageBar.theme = DTMessageBar.DefaultTheme() // Default theme

// Impelement DTMessageBarTheme to provide your own theme

struct DarkTheme: DTMessageBarTheme {

  var successBorderColor: UIColor {
    return UIColor.black
  }

  var successBackgroundColor: UIColor {
    return UIColor(red:0.11, green:0.11, blue:0.15, alpha:0.8)
  }

  var successTextColor: UIColor {
    return UIColor.white
  }

  var infoBorderColor: UIColor {
    return UIColor.black
  }

  var infoBackgroundColor: UIColor {
    return UIColor(red:0.11, green:0.11, blue:0.15, alpha:0.8)
  }

  var infoTextColor: UIColor {
    return UIColor.white
  }

  var warningBorderColor: UIColor {
    return UIColor.black
  }

  var warningBackgroundColor: UIColor {
    return UIColor(red:0.11, green:0.11, blue:0.15, alpha:0.8)
  }

  var warningTextColor: UIColor {
    return UIColor.white
  }

  var errorBorderColor: UIColor {
    return UIColor.black
  }

  var errorBackgroundColor: UIColor {
    return UIColor(red:0.11, green:0.11, blue:0.15, alpha:0.8)
  }

  var errorTextColor: UIColor {
    return UIColor.white
  }

}

DTMessageBar.theme = DarkTheme()

Latest podspec

{
    "name": "DTMessageBar",
    "version": "1.1.3",
    "summary": "Simple message bar",
    "homepage": "https://github.com/danjiang/DTMessageBar",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Dan Jiang": "[email protected]"
    },
    "social_media_url": "https://twitter.com/danjianglife",
    "platforms": {
        "ios": "8.4"
    },
    "requires_arc": true,
    "swift_version": "4.0",
    "source": {
        "git": "https://github.com/danjiang/DTMessageBar.git",
        "tag": "1.1.3",
        "submodules": true
    },
    "source_files": "Sources/**/*.{h,swift}",
    "resources": "Sources/*.bundle"
}

Pin It on Pinterest

Share This