GithubHelp home page GithubHelp logo

mibahl / gsmessages Goto Github PK

View Code? Open in Web Editor NEW

This project forked from wxxsw/gsmessages

1.0 1.0 0.0 5.78 MB

A simple style messages/notifications, in Swift.

License: MIT License

Ruby 1.52% Swift 96.86% Objective-C 1.62%

gsmessages's Introduction

GSMessages

Demo

Example

To show notifications use the following code:

self.showMessage("Something success", type: .success)

To display a notice on a view:

view.showMessage("Something success", type: .success)

To hide a notification manually:

self.hideMessage()

Options (Current setting is default value):

  • type : success / error / warning / info
  • animation : slide / fade
  • position : top / bottom
  • textAlignment : topLeft / topCenter / topRight / left / center / right / bottomLeft / bottomCenter / bottomRight
self.showMessage("Some Text...", type: .success, options: [
    .animation(.slide),
    .animationDuration(0.3),
    .autoHide(true),
    .autoHideDelay(3.0),
    .cornerRadius(0.0),
    .height(44.0),
    .hideOnTap(true),
    .margin(.zero),
    .padding(.init(top: 10, left: 30, bottom: 10, right: 30)),
    .position(.top),
    .textAlignment(.center),
    .textColor(.white),
    .textNumberOfLines(1),
])

Font / Background Color

To set custom fonts and background colors in the following ways:

GSMessage.font = UIFont.boldSystemFont(ofSize: 14)
GSMessage.successBackgroundColor = UIColor(red: 142.0/255, green: 183.0/255, blue: 64.0/255,  alpha: 0.95)
GSMessage.warningBackgroundColor = UIColor(red: 230.0/255, green: 189.0/255, blue: 1.0/255,   alpha: 0.95)
GSMessage.errorBackgroundColor   = UIColor(red: 219.0/255, green: 36.0/255,  blue: 27.0/255,  alpha: 0.70)
GSMessage.infoBackgroundColor    = UIColor(red: 44.0/255,  green: 187.0/255, blue: 255.0/255, alpha: 0.90)

Requirements

Master

  • iOS 8.0+
  • Xcode 9.0+ (Swift 4.x)
  • iOS 8.0+
  • Xcode 8.0+ (Swift 3.x)
  • iOS 7.0+
  • Xcode 7.3+ (Swift 2.x)

Installation

In your Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!

pod "GSMessages"

And in your *.swift:

import GSMessages

In your Cartfile:

github "wxxsw/GSMessages"

And in your *.swift:

import GSMessages

License

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.