Skip to content

Commit

Permalink
Fix lint warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
david-azancot committed Nov 18, 2019
1 parent 827c71a commit 778b272
Showing 1 changed file with 48 additions and 15 deletions.
63 changes: 48 additions & 15 deletions Sources/Forms/Tables/___TABLE___/___TABLE___DetailsForm.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@
import UIKit
import QMobileUI

/// Generated details form for ___TABLE___ table.
/// A progress bar.
@IBDesignable

class ___TABLE___CustomProgressBarDetail: UIView {
@IBInspectable var percent: CGFloat = 0.90
@IBInspectable var barColor: UIColor = UIColor.blue
Expand All @@ -36,9 +35,10 @@ class ___TABLE___CustomProgressBarDetail: UIView {
setNeedsDisplay()
}
}

override func draw(_ rect: CGRect) {
let X = self.bounds.midX
let Y = self.bounds.midY
let x = self.bounds.midX // swiftlint:disable:this identifier_name
let y = self.bounds.midY // swiftlint:disable:this identifier_name
var strokeStart: CGFloat = 0
var strokeEnd: CGFloat = percent
let degrees = 270.0
Expand All @@ -56,13 +56,39 @@ class ___TABLE___CustomProgressBarDetail: UIView {
let radians = CGFloat(degrees * Double.pi / 180)
layer.transform = CATransform3DMakeRotation(radians, 0.0, 0.0, 1.0)
}
let path = UIBezierPath(ovalIn: CGRect(x: (X - (120/2)), y: (Y - (120/2)), width: 120, height: 120)).cgPath
self.addOval(self.bgThickness, path: path, strokeStart: strokeStart, strokeEnd: 1.0, strokeColor: self.bgColor, fillColor: UIColor.clear, shadowRadius: 0, shadowOpacity: 0, shadowOffsset: CGSize.zero)
self.addOval2(self.thickness, path: path, strokeStart: strokeStart, strokeEnd: strokeEnd, strokeColor: self.barColor, fillColor: UIColor.clear, shadowRadius: 0, shadowOpacity: 0, shadowOffsset: CGSize.zero)
let ovalSize: CGFloat = 120
let ovalRect = CGRect(x: x - (ovalSize/2), y: y - (ovalSize/2), width: ovalSize, height: ovalSize)
let path = UIBezierPath(ovalIn: ovalRect).cgPath
self.addOval(self.bgThickness,
path: path,
strokeStart: strokeStart,
strokeEnd: 1.0,
strokeColor: self.bgColor,
fillColor: .clear,
shadowRadius: 0,
shadowOpacity: 0,
shadowOffsset: .zero)
self.addOval2(self.thickness,
path: path,
strokeStart: strokeStart,
strokeEnd: strokeEnd,
strokeColor: self.barColor,
fillColor: .clear,
shadowRadius: 0,
shadowOpacity: 0,
shadowOffsset: .zero)
}
// swiftlint:disable:next function_parameter_count
func addOval(_ lineWidth: CGFloat, path: CGPath, strokeStart: CGFloat, strokeEnd: CGFloat, strokeColor: UIColor, fillColor: UIColor, shadowRadius: CGFloat, shadowOpacity: Float, shadowOffsset: CGSize) {

// swiftlint:disable:next function_parameter_count
func addOval(_ lineWidth: CGFloat,
path: CGPath,
strokeStart: CGFloat,
strokeEnd: CGFloat,
strokeColor: UIColor,
fillColor: UIColor,
shadowRadius: CGFloat,
shadowOpacity: Float,
shadowOffsset: CGSize) {
arc.lineWidth = lineWidth
arc.path = path
arc.strokeStart = strokeStart
Expand All @@ -76,11 +102,18 @@ class ___TABLE___CustomProgressBarDetail: UIView {
arc.opacity = 0.2
arc.lineCap = .round
layer.addSublayer(arc)

}
// swiftlint:disable:next function_parameter_count
func addOval2(_ lineWidth: CGFloat, path: CGPath, strokeStart: CGFloat, strokeEnd: CGFloat, strokeColor: UIColor, fillColor: UIColor, shadowRadius: CGFloat, shadowOpacity: Float, shadowOffsset: CGSize) {

// swiftlint:disable:next function_parameter_count
func addOval2(_ lineWidth: CGFloat,
path: CGPath,
strokeStart: CGFloat,
strokeEnd: CGFloat,
strokeColor: UIColor,
fillColor: UIColor,
shadowRadius: CGFloat,
shadowOpacity: Float,
shadowOffsset: CGSize) {
arc2.lineWidth = lineWidth
arc2.path = path
arc2.strokeStart = strokeStart
Expand All @@ -94,6 +127,7 @@ class ___TABLE___CustomProgressBarDetail: UIView {
arc2.lineCap = .round
layer.addSublayer(arc2)
}

func animateGraph() {

let animation = CABasicAnimation(keyPath: "strokeEnd")
Expand All @@ -112,6 +146,7 @@ class ___TABLE___CustomProgressBarDetail: UIView {
}
}

/// Generated details form for ___TABLE___ table.
class ___TABLE___DetailsForm: DetailsForm___DETAILFORMTYPE___ {

/// The record displayed in this form
Expand All @@ -129,7 +164,7 @@ class ___TABLE___DetailsForm: DetailsForm___DETAILFORMTYPE___ {
override func onWillAppear(_ animated: Bool) {
// Called when the view is about to made visible. Default does nothing
graphView.isHidden = true

}

override func onDidAppear(_ animated: Bool) {
Expand All @@ -146,7 +181,5 @@ class ___TABLE___DetailsForm: DetailsForm___DETAILFORMTYPE___ {
override func onDidDisappear(_ animated: Bool) {
// Called after the view was dismissed, covered or otherwise hidden. Default does nothing
}

// MARK: Custom actions

}

0 comments on commit 778b272

Please sign in to comment.