36 lines
1.1 KiB
Swift
36 lines
1.1 KiB
Swift
//
|
|
// ResourcesViewProgress.swift
|
|
// Wallet
|
|
//
|
|
// Created by Igor Danich on 16.08.2020.
|
|
// Copyright © 2020 List. All rights reserved.
|
|
//
|
|
|
|
import UIKit
|
|
|
|
@IBDesignable
|
|
class ResourcesViewProgress: CommonViewCustom {
|
|
|
|
@IBOutlet private weak var backgroundView: UIImageView!
|
|
@IBOutlet private weak var label: UILabel!
|
|
|
|
@IBInspectable var progress: CGFloat = 0 {
|
|
didSet {
|
|
guard oldValue != progress else { return }
|
|
backgroundView.image = .draw(size: backgroundView.frameSize) { (size, _) in
|
|
let path = UIBezierPath(roundedRect: .init(origin: .zero, size: size), cornerRadius: 10)
|
|
Asset.fog.color.setFill()
|
|
path.fill()
|
|
path.addClip()
|
|
Asset.deepWater.color.setFill()
|
|
UIBezierPath(rect: .init(origin: .zero, size: .init(width: size.width*progress, height: size.height))).fill()
|
|
}
|
|
}
|
|
}
|
|
|
|
@IBInspectable var title: String? {
|
|
didSet { label.attributedText = title?.localized.attributed(style: .regular, size: 12, color: Asset.textSnow.color, alignment: .center) }
|
|
}
|
|
|
|
}
|