// // ProgressBar.swift // MVMCoreUI // // Created by Panth Patel on 5/3/19. // Copyright © 2019 Verizon Wireless. All rights reserved. // import Foundation public class ProgressBar: UIProgressView { public func styleprogessbar(json: [AnyHashable: Any]?) { var barstyle = Bool() var progresscolor = String() var backgroundcolor = String() let thickness = json?.floatFromStringForKey("thickness") let percentage = json?.floatFromStringForKey("percent") if let backgroundcolorUnwrapped = json?.optionalStringForKey("backgroundColor") { backgroundcolor = backgroundcolorUnwrapped } if let progresscolorUnwrapped = json?.optionalStringForKey("progressColor") { progresscolor = progresscolorUnwrapped } if let barStyleUnwrapped = json?["barStyle"] as? Bool { barstyle = barStyleUnwrapped } progressTintColor = UIColor.mfGet(forHex: progresscolor) trackTintColor = UIColor.mfGet(forHex: backgroundcolor) progress = (percentage ?? Float(PaddingThree))/100 switch barstyle { case true: progressViewStyle = .bar default: layer.cornerRadius = CGFloat((thickness ?? Float(PaddingTwo))/2) clipsToBounds = true } } }