Releases: MoveUpwards/Sejima
Small MUToast buttons refactoring
Remove index in button tap callback
toast.add(view: cancel) { view in
print("Button did tap cancel")
}
toast.add(view: okay) { view in
print("Button did tap ok")
toast.hide()
}
Add MUToast buttons
usage
First you can define the layout basics using UIAppearance
MUToast.appearance().displayDuration = 0
MUToast.appearance().cornerRadius = 4
MUToast.appearance().titleColor = .white
MUToast.appearance().backgroundColor = .black
MUToast.appearance().indicatorColor = .red
MUToast.appearance().indicatorWidth = 10
MUToast.appearance().detailColor = .white
MUButton.appearance().borderWidth = 2
MUButton.appearance().cornerRadius = 4.0
Then you customize your toast view
let toast = MUToast()
toast.icon = #imageLiteral(resourceName: "reddit")
toast.buttonHeight = 30.0
toast.spacing = 8
toast.buttonSpacing = 16
toast.displayPosition = .bottom
toast.title = "Sorry, can't reach Reddit"
toast.titleFont = .boldSystemFont(ofSize: 18)
toast.detail = "Add multiple line detail text if needed"
toast.detailFont = .systemFont(ofSize: 14)
Then init buttons objects you want to add in your toast
let cancel = MUButton()
cancel.title = "CANCEL"
cancel.titleFont = .boldSystemFont(ofSize: 14)
cancel.buttonBackgroundColor = .clear
cancel.borderColor = .orange
let okay = MUButton()
okay.title = "OKAY"
okay.titleFont = .boldSystemFont(ofSize: 14)
okay.buttonBackgroundColor = .red
okay.borderColor = .red
Add button along with an options closure that will be triggered every time the button get tapped
toast.add(view: cancel) { (button, index) in
print("Button at index \(index) did tap")
}
toast.add(view: okay) { (button, index) in
print("Button at index \(index) did tap")
}
Then show your toast
toast.show(in: vc, onTap: {
print("toast has been tapped")
}, completion: { dismiss in
print("toast has been dismissed > ", dismiss)
})
Fix content compression + hugging
MUHeader + MUCard
MUCircularProgress
- Add progress type MUCircularProgressType
.indeterminate
and.determinate
/// Define the type of the circular progress.
public enum MUCircularProgressType: Int {
/// Circular progress with min and max value
case determinate
/// Circular progress with indeterminate loading
case indeterminate
}
- Add rotation for
.indeterminate
type.
/// Define the progress style
open var progressType: MUCircularProgressType = .determinate
/// Specifies the animation duration for the indeterminate rotation of the progress line.
@objc open dynamic var rotateDuration: TimeInterval = 1.0
Add new components
Add realtime graph view #66
Swift 5
0.5.5 Migrate to swift 5
Update MUToast display duration
Change display duration logic.
If you specify a negative value or 0, the toast will not hide automatically once animation end.
Improve MURadarGraph
Documentation
Update overall documentation to reach 100% coverage
MURadarGraph
Provide text vertical and horizontal offset to tweak graph legend
MUToast improvements
Fix layout expected size #65
Improve MUToast
Add marker view to give some visual information with color
Make title vertical centered when no detail test given
Title and Detail text font can't be modified using UIAppearance due to layout calculation issue