Swift 中的轻量级下拉消息栏。简单而美丽
斯威夫特掉落
SwiftyDrop 是一个轻量级的纯 Swift 简单而漂亮的下拉消息。
特征
- 易于使用,例如:
Drop.down("Message")
- 消息字段会根据消息而扩展。
外观如何
States
Blurs
iPhone X
iPad
Demo
Git clone or download this repository and open SwiftyDrop.xcodeproj . You can try SwiftyDrop in your Mac or iPhone.
Runtime Requirements
- iOS8.0 or later
- Xcode 9.0
- Swift 4.0
Installation and Setup
Note: Embedded frameworks require a minimum deployment target of iOS 8.1.
Information: To use SwiftyDrop with a project targeting iOS 8.0 or lower, you must include the source file directly in your project.SwiftyDrop/Drop.swift
Installing with CocoaPods
CocoaPods is a centralised dependency manager that automates the process of adding libraries to your Cocoa application. You can install it with the following command:
To integrate SwiftyDrop into your Xcode project using CocoaPods, specify it in your and run .Podfile
pod install
Installing with Carthage
Just add to your Cartfile:
Manual Installation
To install SwiftyDrop without a dependency manager, please add all of the files in to your Xcode Project./SwiftyDrop
Usage
Basic
To start using SwiftyDrop, write the following line wherever you want to show dropdown message:
Then invoke SwiftyDrop, by calling:
It is really simple!
States
SwiftyDrop has states of display.
Examples
Custom states
You can customize looks by comforming protocol.
Examples are:DropStatable
Of course you can use class or struct to make custom state if it is comforming to protocol.DropStatable
Prepared States are enum:
- .Default
- .Info
- .Success
- .Warning
- .Error
- .Color: UIColor
- .Blur: UIBlurEffectStyle
Duration
You can change duration like this above. Default duration is 4.0.
Action
Contribution
Please file issues or submit pull requests! We're waiting! :)
License
SwiftyDrop is released under the MIT license. Go read the LICENSE file for more information.