• Stars
    star
    709
  • Rank 63,849 (Top 2 %)
  • Language
    Swift
  • License
    MIT License
  • Created over 9 years ago
  • Updated about 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A simple style messages/notifications, in Swift.

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(.normal) / slide(.distance(50)) / fade
  • position : top / bottom
  • textAlignment : topLeft / topCenter / topRight / left / center / right / bottomLeft / bottomCenter / bottomRight
self.showMessage("String or NSAttributedString", type: .success, options: [
    .accessibilityIdentifier(nil),
    .animations([.slide(.normal)]),
    .animationDuration(0.3),
    .autoHide(true),
    .autoHideDelay(3.0),
    .cornerRadius(0.0),
    .height(44.0),
    .hideOnTap(true),
    .handleTap({}),
    .isInsideSafeAreaInsets(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 11+ (Swift 5.x)
  • iOS 8.0+
  • Xcode 10.0+ (Swift 4.2)
  • iOS 8.0+
  • Xcode 9.0+ (Swift 4.0)
  • 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.

More Repositories

1

SwiftTheme

🎨 Powerful theme/skin manager for iOS 9+ 主题/换肤, 暗色模式
Swift
2,445
star
2

SwiftUI-WeChat

🇨🇳 Learn how to make WeChat with SwiftUI. 微信 7.0 🟢
Swift
996
star
3

VideoPlayer

📽 A video player for SwiftUI, support for caching, preload and custom control view. SwiftUI 视频播放器,支持边下边播、预加载、自定义控制层
Swift
491
star
4

GSPlayer

⏯ Video player, support for caching, preload, fullscreen transition and custom control view. 视频播放器,支持边下边播、预加载、全屏转场和自定义控制层
Swift
343
star
5

GSImageViewerController

An image viewer controller with zoom transition, in Swift.
Swift
287
star
6

Refresh

🎈 Great SwiftUI drop-down refresh and scroll up to load more. 下拉刷新、上拉加载
Swift
255
star
7

GSCaptchaButton

为普通按钮增加验证码倒计时功能,不影响按钮样式
Swift
54
star
8

GSRefresh

Fully customizable drop-down refresh and load more.
Swift
33
star
9

TabBar

🚥 TabBar for SwiftUI - Make custom TabView possible
Swift
31
star
10

GSAlert

[deprecated] UIAlertController support iOS 7+ and written in swift.
Swift
28
star
11

POP-SnapKit

[deprecated] Use SnapKit with the Facebook Pop animation framework.
Objective-C++
21
star
12

GSPhotos

[deprecated] PhotosKit+ALAssetsLibrary, 支持iOS7+, 基于Swift
Swift
9
star
13

GSChange

Automatically synchronize changes, such as likes, follow, etc.
Swift
8
star
14

wxxsw

5
star
15

GSVerificationCode

验证码控件,支持设置输入长度、自定义外观等
Swift
3
star
16

SwiftThemeResources

Resources of SwiftTheme demo
2
star
17

ImageViewer

1
star