Removing redundant "self". Provided a capture list for closure.

This commit is contained in:
Christiano, Kevin 2019-03-20 10:03:48 -04:00
parent 64b1b73da1
commit 394321bdc4

View File

@ -23,8 +23,8 @@ import MVMCore
//------------------------------------------------------ //------------------------------------------------------
@objc override open func updateView(_ size: CGFloat) { @objc override open func updateView(_ size: CGFloat) {
MVMCoreDispatchUtility.performBlock(onMainThread: { MVMCoreDispatchUtility.performBlock(onMainThread: { [weak self] in
self.setNeedsDisplay() self?.setNeedsDisplay()
}) })
} }
@ -34,13 +34,13 @@ import MVMCore
dashLayer.backgroundColor = UIColor.clear.cgColor dashLayer.backgroundColor = UIColor.clear.cgColor
dashLayer.frame = bounds dashLayer.frame = bounds
if let sublayers = self.layer.sublayers { if let sublayers = layer.sublayers {
for sublayer in sublayers { for sublayer in sublayers {
sublayer.removeFromSuperlayer() sublayer.removeFromSuperlayer()
} }
} }
self.layer.addSublayer(dashLayer) layer.addSublayer(dashLayer)
let path = UIBezierPath() let path = UIBezierPath()
path.move(to: CGPoint(x: dashLayer.frame.origin.x, y: dashLayer.frame.size.height / 2.0)) //add yourStartPoint here path.move(to: CGPoint(x: dashLayer.frame.origin.x, y: dashLayer.frame.size.height / 2.0)) //add yourStartPoint here
@ -53,9 +53,9 @@ import MVMCore
dashLayer.lineCap = .round dashLayer.lineCap = .round
dashLayer.lineDashPattern = [NSNumber(value: 2), NSNumber(value: 2)] dashLayer.lineDashPattern = [NSNumber(value: 2), NSNumber(value: 2)]
dashLayer.path = path.cgPath dashLayer.path = path.cgPath
dashLayer.strokeColor = self.dashColor?.cgColor ?? UIColor.mfLighterGray().cgColor dashLayer.strokeColor = dashColor?.cgColor ?? UIColor.mfLighterGray().cgColor
dashLayer.fillColor = UIColor.clear.cgColor dashLayer.fillColor = UIColor.clear.cgColor
dashLayer.backgroundColor = self.bgColor?.cgColor ?? UIColor.white.cgColor dashLayer.backgroundColor = bgColor?.cgColor ?? UIColor.white.cgColor
} }
//------------------------------------------------------ //------------------------------------------------------
@ -69,19 +69,19 @@ import MVMCore
guard let jsonDictionary = json else { return } guard let jsonDictionary = json else { return }
if let backgroundColorHex = jsonDictionary[KeyBackgroundColor] as? String { if let backgroundColorHex = jsonDictionary[KeyBackgroundColor] as? String {
self.backgroundColor = UIColor.mfGet(forHex: backgroundColorHex) backgroundColor = UIColor.mfGet(forHex: backgroundColorHex)
} }
if let isHiddenValue = jsonDictionary[KeyIsHidden] as? Bool { if let isHiddenValue = jsonDictionary[KeyIsHidden] as? Bool {
self.isHidden = isHiddenValue isHidden = isHiddenValue
} }
if let bgColorHex = jsonDictionary["bgColor"] as? String { if let bgColorHex = jsonDictionary["bgColor"] as? String {
self.bgColor = UIColor.mfGet(forHex: bgColorHex) bgColor = UIColor.mfGet(forHex: bgColorHex)
} }
if let dashColorHex = jsonDictionary["dashColor"] as? String { if let dashColorHex = jsonDictionary["dashColor"] as? String {
self.dashColor = UIColor.mfGet(forHex: dashColorHex) dashColor = UIColor.mfGet(forHex: dashColorHex)
} }
} }