This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "key.substructure" : [ | |
| { | |
| "key.namelength" : 14, | |
| "key.elements" : [ | |
| { | |
| "key.offset" : 36, | |
| "key.kind" : "source.lang.swift.structure.elem.typeref", | |
| "key.length" : 16 | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import UIKit | |
| class ViewController: UIViewController { | |
| override func viewDidLoad() { | |
| super.viewDidLoad() | |
| // Do any additional setup after loading the view. | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // EverythingVisiter.swift | |
| // ProjectAnalysis | |
| // | |
| // Created by David Piper in 2019 | |
| // | |
| import Foundation | |
| import SwiftSyntax |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func resetDrawing() { | |
| // 1 | |
| lineArray = [] | |
| setNeedsDisplay() | |
| } | |
| func exportDrawing() -> UIImage? { | |
| // 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) { | |
| // 1 | |
| guard let touch = touches.first else { return } | |
| let firstPoint = touch.location(in: self) | |
| // 2 | |
| lineArray.append([CGPoint]()) | |
| lineArray[lineArray.count - 1].append(firstPoint) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 1 | |
| override func draw(_ rect: CGRect) { | |
| guard let context = UIGraphicsGetCurrentContext() else { return } | |
| draw(inContext: context) | |
| } | |
| func draw(inContext context: CGContext) { | |
| // 2 | |
| context.setLineWidth(5) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class DrawView: UIView { | |
| // 1 | |
| private var lineArray: [[CGPoint]] = [[CGPoint]]() | |
| override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) { | |
| // 2 | |
| guard let touch = touches.first else { return } | |
| let firstPoint = touch.location(in: self) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 1 | |
| struct RadarView: UIViewRepresentable { | |
| // 2 | |
| typealias UIViewType = RadarChartView | |
| // 3 | |
| func makeUIView(context: UIViewRepresentableContext<RadarView>) -> RadarChartView { | |
| let radarChart = RadarChartView() | |
| // Setup radar Chart |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 1 | |
| class CustomRadioactivityUnit: Dimension { | |
| // 2 | |
| static let becquerel = CustomRadioactivityUnit(symbol: "Bq", converter: UnitConverterLinear(coefficient: 1.0)) | |
| static let curie = CustomRadioactivityUnit(symbol: "Ci", converter: UnitConverterLinear(coefficient: 3.7e10)) | |
| // 3 | |
| static let baseUnit = becquerel | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 1 | |
| extension UnitIlluminance { | |
| // 2 | |
| static let footCandle = UnitIlluminance(symbol: "fc", converter: UnitConverterLinear(coefficient: 10.76)) | |
| } | |
| // 3 | |
| let footCandle = Measurement(value: 1, unit: UnitIlluminance.footCandle) | |
| let lumen = footCandle.converted(to: UnitIlluminance.lux) |