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

Swift
Platform
CocoaPods
Carthage compatible

Introduction

Simple loading HUD and image message.

Demo

Installation

Requirement

iOS 8.4+

CocoaPods

To install DTMessageHUD add a dependency to your Podfile:

pod "DTMessageHUD"

Carthage

To install DTMessageHUD add a dependency to your Cartfile:

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

Usage

Import

import DTMessageHUD

Use in Window

// Show loading HUD. Dismiss by yourself
DTMessageHUD.hud()
DTMessageHUD.dismiss()

// Show image message. Dismiss automatically
DTMessageHUD.success()
DTMessageHUD.info()
DTMessageHUD.warning()
DTMessageHUD.error()
DTMessageHUD.custom(image: #imageLiteral(resourceName: "dollar"))

Use in View

// Want to put mesage view in this view
@IBOutlet weak var boxView: UIView!

// Show loading HUD. Dismiss by yourself
DTMessageHUD.hud(inView: boxView)
DTMessageHUD.dismiss(inView: boxView)

// Show image message. Dismiss automatically
DTMessageHUD.success(inView: boxView)
DTMessageHUD.info(inView: boxView)
DTMessageHUD.warning(inView: boxView)
DTMessageHUD.error(inView: boxView)
DTMessageHUD.custom(image: #imageLiteral(resourceName: "dollar"), inView: boxView)

Customize

DTMessageHUD.theme = DTMessageHUD.LightTheme() // Default theme
DTMessageHUD.theme = DTMessageHUD.DarkTheme()
DTMessageHUD.theme = DTMessageHUD.ColorfulTheme()

// Impelement DTMessageHUDTheme to provide your own theme

struct MyTheme: DTMessageHUDTheme {
    ...
}

DTMessageHUD.theme = MyTheme()

Circular Loading View

// Use circular loading view directly. Start animation and stop animation by yourself
let loadingView = DTCircularLoadingView(frame: CGRect(x: 0, y: 0, width: 40, height: 40),
                                          insetX: 3,
                                          insetY: 3,
                                          lineWidth: 6,
                                          strokeColor: UIColor.blue)
loadingView.startAnimation()
loadingView.stopAnimation()

TODO

  • circular progress view
  • linear progress view

Latest podspec

{
    "name": "DTMessageHUD",
    "version": "1.2.0",
    "summary": "Simple loading HUD and image message",
    "homepage": "https://github.com/danjiang/DTMessageHUD",
    "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/DTMessageHUD.git",
        "tag": "1.2.0",
        "submodules": true
    },
    "source_files": "Sources/**/*.{h,swift}",
    "resources": "Sources/*.bundle"
}

Pin It on Pinterest

Share This