TestsTested | ✗ |
LangLanguage | SwiftSwift |
License | MIT |
ReleasedLast Release | Aug 2015 |
SPMSupports SPM | ✗ |
Maintained by Tatsuya Tanaka.
A simple toast library written by Swift
Add manually:
// simple
Toast.show("Hello world\nToast test")
// customization
Toast.show("Hello world\nToast test", view:self.view) {(config) in
// appearance
config.maxWidth = CGFloat(0.8)
config.paddingHorizontal = CGFloat(10.0)
config.paddingVertical = CGFloat(10.0)
config.cornerRadius = CGFloat(8)
config.alpha = CGFloat(0.5)
config.font = UIFont(name: "SnellRoundhand", size: 25.0)
config.textColor = UIColor(red: 0.192, green: 0.216, blue: 0.082, alpha: 1.0)
config.backgroundColor = UIColor(red: 0.886, green: 0.976, blue: 0.72, alpha: 1.0)
// shadow
config.shadow = true
config.shadowOpacity = Float(0.5)
config.shadowRadius = CGFloat(10.0)
config.shadowOffset = CGSizeMake(4.0, 4.0)
config.shadowColor = UIColor(red: 0.576, green: 0.624, blue: 0.36, alpha: 1.0).CGColor
// duration
config.durationBefore = 1.0
config.duration = 2.0
config.durationAfter = 0.5
// position
config.position = Toast.Position.Bottom.rawValue | Toast.Position.Right.rawValue
}
// global settings
Toast.config.backgroundColor = UIColor.blackColor()
Toast.config.textColor = UIColor.whiteColor()
If you use this library in Objective-C, you need to import the following:
#import <TTToast/TTToast.h>
#import <TTToast/TTToast-Swift.h> // auto-generated header file
and set [Build Settings]-[Build Options]-[Embeedded Content Contains Swift Code] to Yes
.
[TTToast show:@"Hello world"];
[TTToast show:message:@"Hello world" view:self.view config:^(TTToastConfig* config) {
config.backgroundColor = [UIColor blackColor];
config.position = TTToastPositionTop | TTToastPositionLeft
}];
git checkout -b my-new-feature
git commit -am 'Add some feature'
git push origin my-new-feature
TTToast is released under the MIT license. See LICENSE for details.