ProgressBar Changes

This commit is contained in:
Panth Patel 2019-05-20 17:31:41 -04:00
parent 145cafbc30
commit a95456edff
2 changed files with 5 additions and 4 deletions

View File

@ -8,7 +8,7 @@
import Foundation import Foundation
public class ProgressBar: UIProgressView { public class ProgressBar: UIProgressView, MVMCoreUIMoleculeViewProtocol {
var isRounded = Bool() var isRounded = Bool()
var thickness : Float = 0.0 { var thickness : Float = 0.0 {
@ -16,7 +16,7 @@ public class ProgressBar: UIProgressView {
heightAnchor.constraint(equalToConstant: CGFloat(newValue)).isActive = true heightAnchor.constraint(equalToConstant: CGFloat(newValue)).isActive = true
switch isRounded { switch isRounded {
case true: case true:
layer.cornerRadius = CGFloat((newValue ?? Float(0.0))/2) layer.cornerRadius = CGFloat(newValue/2)
clipsToBounds = true clipsToBounds = true
default: default:
progressViewStyle = .bar progressViewStyle = .bar
@ -24,7 +24,7 @@ public class ProgressBar: UIProgressView {
} }
} }
open func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: DelegateObject?, additionalData: [AnyHashable: Any]?) { open func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: DelegateObject?, additionalData: [AnyHashable: Any]?) {
isRounded = json?.optionalBoolForKey("roundedRect") ?? false isRounded = json?.optionalBoolForKey("roundedRect") ?? false
thickness = json?.floatFromStringForKey("thickness") ?? Float(0.0) thickness = json?.floatFromStringForKey("thickness") ?? Float(0.0)
let percentage = json?.floatFromStringForKey("percent") let percentage = json?.floatFromStringForKey("percent")

View File

@ -34,7 +34,8 @@
@"caretButton": CaretButton.class, @"caretButton": CaretButton.class,
@"textField" : MFTextField.class, @"textField" : MFTextField.class,
@"checkbox" : MVMCoreUICheckBox.class, @"checkbox" : MVMCoreUICheckBox.class,
@"progressbar" : ProgressBarView.class @"progressBarView" : ProgressBarView.class,
@"progressBar": ProgressBar.class
} mutableCopy]; } mutableCopy];
}); });
return mapping; return mapping;