KUIActionSheet
Custom UIActionSheet for Swift
Requirements
- iOS 8.0+
- Xcode 9.0
- Swift 4.2
- Swift 3.0 (2.0.4)
Installation
CocoaPods
KUIActionSheet is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "KUIActionSheet"
Usage
KUIActionSheet
import KUIActionSheet
let actionSheet = KUIActionSheet.view(parentViewController: self)
actionSheet?.add(customView: UIView<KUIActionSheetItemViewProtocol>)
actionSheet?.add(item: KUIActionSheetItem(title: "Menu1", destructive: false) { [weak self] (item) in
print(item.title)
})
actionSheet?.add(item: KUIActionSheetItem(asyncTitle: { (completion) -> Void in
DispatchQueue.main.asyncAfter(deadline: .now() + 2.0, execute: {
completion("Async Title")
})
}, handler: { (item) in
print(item)
}))
actionSheet?.show()
CustomView
class CustomView: UIView, KUIActionSheetItemViewProtocol {
func ... () {
actionSheet?.dismiss()
}
}
CustomTheme
public protocol KUIActionSheetProtocol {
var backgroundColor: UIColor { get }
var showAnimationDuration: NSTimeInterval { get }
var dimissAnimationDuration: NSTimeInterval { get }
var blurEffectStyle: UIBlurEffectStyle { get }
var itemTheme: KUIActionSheetItemTheme { get }
}
public protocol KUIActionSheetItemTheme {
var height: CGFloat { get }
var font: UIFont { get }
var titleColor: UIColor { get }
var destructiveTitleColor: UIColor { get }
}
Authors
Taeun Kim (kofktu), [email protected]
License
KUIActionSheet is available under the MIT
license. See the LICENSE
file for more info.