Latest 5.5.0
Homepage https://github.com/JanGorman/SwiftMessageBar
License MIT
Platforms ios 10.0
Authors ,

Carthage compatible
Version
License
Platform

An iOS message bar, written in Swift

image

Requirements

  • iOS 9.0+
  • Swift 5
  • Xcode 10.2+

Installation

You can use Carthage:

github "JanGorman/SwiftMessageBar"

or CocoaPods:

pod 'SwiftMessageBar'

Usage

The included sample code shows how to use the message bar. There are three different message types:

enum MessageType {
    case error, success, info
}

To display a message:

import SwiftMessageBar

@IBAction func showSuccess(sender: AnyObject) {
    SwiftMessageBar.showMessage(withTitle: "Success", message: "The Message Body", type: .success)
}

You can customize the duration of each message and also pass in a tap handler closure that is executed when a user taps on the message.

To customize the look of the messages, create a custom Config and set it on the shared messagebar. You can adjust colors, fonts as well as custom images. Config comes with a Builder class for easy configuration. For example:

let config = SwiftMessageBar.Config.Builder()
    .withErrorColor(.green)
    .withSuccessColor(.red)
    .withTitleFont(.boldSystemFont(ofSize: 30))
    .withMessageFont(.systemFont(ofSize: 17))
    .build()
SwiftMessageBar.setSharedConfig(config)

Haptic Feedback

Per default SwiftMessageBar provides the user with haptic feedback using UINotificationFeedbackGenerator. You can opt out of this behaviour by disabling it in the configuration:

let config = SwiftMessageBar.Config.Builder()
    .withHapticFeedbackEnabled(false)
    .build()
SwiftMessageBar.setSharedConfig(config)

Licence

SwiftMessageBar is released under the MIT license. See LICENSE for details

Latest podspec

{
    "name": "SwiftMessageBar",
    "version": "5.5.0",
    "summary": "A Swift Message Bar",
    "swift_versions": "5.0",
    "description": "A longer description of SwiftMessageBar in Markdown format.nn* Think: Why did you write this? What is the focus? What does it do?n* CocoaPods will be using this to generate tags, and improve search results.n* Try to keep it short, snappy and to the point.n* Finally, don't worry about the indent, CocoaPods strips it!",
    "homepage": "https://github.com/JanGorman/SwiftMessageBar",
    "license": "MIT",
    "authors": {
        "Jan Gorman": "https://github.com/JanGorman/",
        "Ramy Kfoury": "https://github.com/ramy-kfoury/"
    },
    "social_media_url": "http://twitter.com/JanGorman",
    "platforms": {
        "ios": "10.0"
    },
    "source": {
        "git": "https://github.com/JanGorman/SwiftMessageBar.git",
        "tag": "5.5.0"
    },
    "source_files": "SwiftMessageBar/*.swift",
    "resources": "SwiftMessageBar/*.png"
}

Pin It on Pinterest

Share This