update based on Scott's comment
This commit is contained in:
parent
d52e204721
commit
358842e433
@ -38,10 +38,18 @@ import UIKit
|
||||
super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData)
|
||||
thicknessConstraint?.constant = json?.optionalCGFloatForKey("thickness") ?? defaultHeight
|
||||
roundedRect = json?.optionalBoolForKey("roundedRect") ?? false
|
||||
guard let list = json?.optionalArrayForKey("progressList") as? [[AnyHashable: Any]], let progressObjectList = ProgressBarObject.getProgressBarObjectList(list), progressObjectList.count > 0 else {
|
||||
setupProgressList(json?.optionalArrayForKey("progressList") as? [[AnyHashable: Any]])
|
||||
}
|
||||
|
||||
func setupProgressList(_ list: [[AnyHashable: Any]]?) {
|
||||
for subview in subviews {
|
||||
subview.removeFromSuperview()
|
||||
}
|
||||
let progressObjectList = ProgressBarObject.getProgressBarObjectList(list)
|
||||
progressList = progressObjectList
|
||||
guard (progressList?.count ?? 0) > 0 else {
|
||||
return
|
||||
}
|
||||
progressList = progressObjectList
|
||||
var previous: UIView?
|
||||
for progressObject in progressList! {
|
||||
guard progressObject.progress > 0.0 else {
|
||||
@ -61,7 +69,7 @@ import UIKit
|
||||
|
||||
|
||||
@objcMembers open class ProgressBarObject {
|
||||
///form 0.0 to 1.0. input progress should be [0 100]
|
||||
///from 0.0 to 1.0. input progress should be [0 100]
|
||||
var progress: CGFloat = 0.0
|
||||
///default color is cerulean
|
||||
var color: UIColor = UIColor.mfCerulean()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user