[Swift-OpenSource] scalessec / Toast-Swift
2020. 11. 2. 14:50ㆍ개발자료/iOS
반응형
# Basic Examples
// basic usage
self.view.makeToast("This is a piece of toast")
// toast with a specific duration and position
self.view.makeToast("This is a piece of toast", duration: 3.0, position: .top)
// toast presented with multiple options and with a completion closure
self.view.makeToast("This is a piece of toast", duration: 2.0, point: CGPoint(x: 110.0, y: 110.0), title: "Toast Title", image: UIImage(named: "toast.png")) { didTap in
if didTap {
print("completion from tap")
} else {
print("completion without tap")
}
}
// display toast with an activity spinner
self.view.makeToastActivity(.center)
// display any view as toast
self.view.showToast(myView)
// immediately hides all toast views in self.view
self.view.hideAllToasts()
# But wait, there's more!
// create a new style
var style = ToastStyle()
// this is just one of many style options
style.messageColor = .blue
// present the toast with the new style
self.view.makeToast("This is a piece of toast", duration: 3.0, position: .bottom, style: style)
// or perhaps you want to use this style for all toasts going forward?
// just set the shared style and there's no need to provide the style again
ToastManager.shared.style = style
self.view.makeToast("This is a piece of toast") // now uses the shared style
// toggle "tap to dismiss" functionality
ToastManager.shared.isTapToDismissEnabled = true
// toggle queueing behavior
ToastManager.shared.isQueueEnabled = true
github.com/scalessec/Toast-Swift
반응형
'개발자료 > iOS' 카테고리의 다른 글
[ERROR] decidePolicyForNavigationAction was not called (0) | 2020.11.03 |
---|---|
[Swift] 구문 이름표(Labeled Statements) (0) | 2020.11.02 |
Interface Builder TableView Separator Line (0) | 2020.11.02 |
Keyboard (0) | 2020.10.23 |
Apple 푸시 알림 서비스 업데이트 (0) | 2020.10.12 |