├── mac ├── Podfile ├── keyrace-mac │ ├── Assets.xcassets │ │ ├── Contents.json │ │ ├── magic-keyboard.imageset │ │ │ ├── magic-keyboard.png │ │ │ ├── magic-keyboard@2x.png │ │ │ ├── magic-keyboard@3x.png │ │ │ └── Contents.json │ │ ├── AccentColor.colorset │ │ │ └── Contents.json │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Preview Content │ │ └── Preview Assets.xcassets │ │ │ └── Contents.json │ ├── MenuView.swift │ ├── keyrace_mac.entitlements │ ├── Info.plist │ ├── UserDefaults.swift │ ├── ContentView.swift │ ├── AppDelegate.swift │ ├── SettingsView.swift │ ├── LeaderboardView.swift │ └── TypingChart.swift ├── Pods │ ├── Target Support Files │ │ ├── Pods-keyrace-mac │ │ │ ├── Pods-keyrace-mac-frameworks-Debug-output-files.xcfilelist │ │ │ ├── Pods-keyrace-mac-frameworks-Release-output-files.xcfilelist │ │ │ ├── Pods-keyrace-mac.modulemap │ │ │ ├── Pods-keyrace-mac-dummy.m │ │ │ ├── Pods-keyrace-mac-frameworks-Debug-input-files.xcfilelist │ │ │ ├── Pods-keyrace-mac-frameworks-Release-input-files.xcfilelist │ │ │ ├── Pods-keyrace-mac-umbrella.h │ │ │ ├── Pods-keyrace-mac-Info.plist │ │ │ ├── Pods-keyrace-mac.debug.xcconfig │ │ │ └── Pods-keyrace-mac.release.xcconfig │ │ └── Charts │ │ │ ├── Charts.modulemap │ │ │ ├── Charts-dummy.m │ │ │ ├── Charts-prefix.pch │ │ │ ├── Charts-umbrella.h │ │ │ ├── Charts.debug.xcconfig │ │ │ ├── Charts.release.xcconfig │ │ │ └── Charts-Info.plist │ ├── Manifest.lock │ ├── Charts │ │ └── Source │ │ │ └── Charts │ │ │ ├── Interfaces │ │ │ ├── BubbleChartDataProvider.swift │ │ │ ├── CandleChartDataProvider.swift │ │ │ ├── ScatterChartDataProvider.swift │ │ │ ├── LineChartDataProvider.swift │ │ │ ├── CombinedChartDataProvider.swift │ │ │ ├── BarChartDataProvider.swift │ │ │ ├── BarLineScatterCandleBubbleChartDataProvider.swift │ │ │ └── ChartDataProvider.swift │ │ │ ├── Data │ │ │ ├── Implementations │ │ │ │ └── Standard │ │ │ │ │ ├── CandleChartData.swift │ │ │ │ │ ├── BarLineScatterCandleBubbleChartData.swift │ │ │ │ │ ├── LineChartData.swift │ │ │ │ │ ├── BubbleChartData.swift │ │ │ │ │ ├── ScatterChartData.swift │ │ │ │ │ ├── BarLineScatterCandleBubbleChartDataSet.swift │ │ │ │ │ ├── RadarChartDataEntry.swift │ │ │ │ │ ├── RadarChartData.swift │ │ │ │ │ ├── BubbleChartDataSet.swift │ │ │ │ │ ├── RadarChartDataSet.swift │ │ │ │ │ ├── LineScatterCandleRadarChartDataSet.swift │ │ │ │ │ ├── BubbleChartDataEntry.swift │ │ │ │ │ ├── ChartDataEntryBase.swift │ │ │ │ │ ├── LineRadarChartDataSet.swift │ │ │ │ │ ├── ScatterChartDataSet.swift │ │ │ │ │ ├── CandleChartDataEntry.swift │ │ │ │ │ ├── ChartDataEntry.swift │ │ │ │ │ ├── PieChartData.swift │ │ │ │ │ ├── PieChartDataEntry.swift │ │ │ │ │ ├── BarChartData.swift │ │ │ │ │ └── CandleChartDataSet.swift │ │ │ └── Interfaces │ │ │ │ ├── IBubbleChartDataSet.swift │ │ │ │ ├── IBarLineScatterCandleBubbleChartDataSet.swift │ │ │ │ ├── IScatterChartDataSet.swift │ │ │ │ ├── IRadarChartDataSet.swift │ │ │ │ ├── ILineScatterCandleRadarChartDataSet.swift │ │ │ │ ├── IBarChartDataSet.swift │ │ │ │ ├── ILineRadarChartDataSet.swift │ │ │ │ ├── ICandleChartDataSet.swift │ │ │ │ ├── IPieChartDataSet.swift │ │ │ │ └── ILineChartDataSet.swift │ │ │ ├── Highlight │ │ │ ├── IHighlighter.swift │ │ │ ├── PieHighlighter.swift │ │ │ ├── Range.swift │ │ │ ├── PieRadarHighlighter.swift │ │ │ ├── HorizontalBarHighlighter.swift │ │ │ ├── CombinedHighlighter.swift │ │ │ ├── RadarHighlighter.swift │ │ │ └── BarHighlighter.swift │ │ │ ├── Renderers │ │ │ ├── Renderer.swift │ │ │ ├── Scatter │ │ │ │ ├── IShapeRenderer.swift │ │ │ │ ├── CrossShapeRenderer.swift │ │ │ │ ├── XShapeRenderer.swift │ │ │ │ ├── ChevronUpShapeRenderer.swift │ │ │ │ ├── ChevronDownShapeRenderer.swift │ │ │ │ ├── SquareShapeRenderer.swift │ │ │ │ ├── CircleShapeRenderer.swift │ │ │ │ └── TriangleShapeRenderer.swift │ │ │ ├── LineRadarRenderer.swift │ │ │ ├── LineScatterCandleRadarRenderer.swift │ │ │ ├── XAxisRendererRadarChart.swift │ │ │ └── ChartDataRendererBase.swift │ │ │ ├── Charts │ │ │ ├── BubbleChartView.swift │ │ │ ├── LineChartView.swift │ │ │ ├── ScatterChartView.swift │ │ │ └── CandleStickChartView.swift │ │ │ ├── Formatters │ │ │ ├── IFillFormatter.swift │ │ │ ├── IAxisValueFormatter.swift │ │ │ ├── IValueFormatter.swift │ │ │ ├── IndexAxisValueFormatter.swift │ │ │ ├── DefaultFillFormatter.swift │ │ │ ├── DefaultAxisValueFormatter.swift │ │ │ └── DefaultValueFormatter.swift │ │ │ ├── Jobs │ │ │ ├── MoveViewJob.swift │ │ │ ├── AnimatedMoveViewJob.swift │ │ │ ├── ViewPortJob.swift │ │ │ ├── ZoomViewJob.swift │ │ │ ├── AnimatedZoomViewJob.swift │ │ │ └── AnimatedViewPortJob.swift │ │ │ ├── Components │ │ │ ├── ComponentBase.swift │ │ │ ├── Description.swift │ │ │ ├── IMarker.swift │ │ │ ├── ChartLimitLine.swift │ │ │ ├── XAxis.swift │ │ │ ├── MarkerView.swift │ │ │ ├── MarkerImage.swift │ │ │ └── LegendEntry.swift │ │ │ ├── Utils │ │ │ ├── TransformerHorizontalBarChart.swift │ │ │ ├── Platform+Color.swift │ │ │ └── Platform+Touch Handling.swift │ │ │ └── Filters │ │ │ └── DataApproximator.swift │ └── Pods.xcodeproj │ │ └── xcshareddata │ │ └── xcschemes │ │ ├── Charts.xcscheme │ │ └── Pods-keyrace-mac.xcscheme ├── keyrace-mac.xcodeproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ └── xcshareddata │ │ └── xcschemes │ │ └── keyrace-mac.xcscheme ├── keyrace-mac.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── Podfile.lock ├── go.mod ├── .github └── workflows │ ├── make-test.yml │ └── build_app.yml ├── README.md ├── .gitignore └── Makefile /mac/Podfile: -------------------------------------------------------------------------------- 1 | use_frameworks! 2 | inhibit_all_warnings! 3 | 4 | target 'keyrace-mac' do 5 | pod 'Charts' 6 | end 7 | -------------------------------------------------------------------------------- /mac/keyrace-mac/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /mac/keyrace-mac/Preview Content/Preview Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /mac/Pods/Target Support Files/Pods-keyrace-mac/Pods-keyrace-mac-frameworks-Debug-output-files.xcfilelist: -------------------------------------------------------------------------------- 1 | ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Charts.framework -------------------------------------------------------------------------------- /mac/Pods/Target Support Files/Pods-keyrace-mac/Pods-keyrace-mac-frameworks-Release-output-files.xcfilelist: -------------------------------------------------------------------------------- 1 | ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Charts.framework -------------------------------------------------------------------------------- /mac/Pods/Target Support Files/Charts/Charts.modulemap: -------------------------------------------------------------------------------- 1 | framework module Charts { 2 | umbrella header "Charts-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /mac/Pods/Target Support Files/Charts/Charts-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Charts : NSObject 3 | @end 4 | @implementation PodsDummy_Charts 5 | @end 6 | -------------------------------------------------------------------------------- /mac/keyrace-mac/Assets.xcassets/magic-keyboard.imageset/magic-keyboard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nat/keyrace/main/mac/keyrace-mac/Assets.xcassets/magic-keyboard.imageset/magic-keyboard.png -------------------------------------------------------------------------------- /mac/keyrace-mac/Assets.xcassets/magic-keyboard.imageset/magic-keyboard@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nat/keyrace/main/mac/keyrace-mac/Assets.xcassets/magic-keyboard.imageset/magic-keyboard@2x.png -------------------------------------------------------------------------------- /mac/keyrace-mac/Assets.xcassets/magic-keyboard.imageset/magic-keyboard@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nat/keyrace/main/mac/keyrace-mac/Assets.xcassets/magic-keyboard.imageset/magic-keyboard@3x.png -------------------------------------------------------------------------------- /mac/keyrace-mac/MenuView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MenuView.swift 3 | // keyrace-mac 4 | // 5 | // Created by Jessie Frazelle on 2/21/21. 6 | // 7 | 8 | import Foundation 9 | import SwiftUI 10 | 11 | 12 | -------------------------------------------------------------------------------- /mac/Pods/Target Support Files/Pods-keyrace-mac/Pods-keyrace-mac.modulemap: -------------------------------------------------------------------------------- 1 | framework module Pods_keyrace_mac { 2 | umbrella header "Pods-keyrace-mac-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /mac/Pods/Target Support Files/Pods-keyrace-mac/Pods-keyrace-mac-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_keyrace_mac : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_keyrace_mac 5 | @end 6 | -------------------------------------------------------------------------------- /mac/keyrace-mac.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /mac/Pods/Target Support Files/Pods-keyrace-mac/Pods-keyrace-mac-frameworks-Debug-input-files.xcfilelist: -------------------------------------------------------------------------------- 1 | ${PODS_ROOT}/Target Support Files/Pods-keyrace-mac/Pods-keyrace-mac-frameworks.sh 2 | ${BUILT_PRODUCTS_DIR}/Charts/Charts.framework -------------------------------------------------------------------------------- /mac/Pods/Target Support Files/Pods-keyrace-mac/Pods-keyrace-mac-frameworks-Release-input-files.xcfilelist: -------------------------------------------------------------------------------- 1 | ${PODS_ROOT}/Target Support Files/Pods-keyrace-mac/Pods-keyrace-mac-frameworks.sh 2 | ${BUILT_PRODUCTS_DIR}/Charts/Charts.framework -------------------------------------------------------------------------------- /mac/keyrace-mac/keyrace_mac.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /mac/keyrace-mac/Assets.xcassets/AccentColor.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "colors" : [ 3 | { 4 | "idiom" : "universal" 5 | } 6 | ], 7 | "info" : { 8 | "author" : "xcode", 9 | "version" : 1 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /mac/Pods/Target Support Files/Charts/Charts-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /mac/keyrace-mac.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /mac/keyrace-mac.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /mac/keyrace-mac.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /mac/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - Charts (3.6.0): 3 | - Charts/Core (= 3.6.0) 4 | - Charts/Core (3.6.0) 5 | 6 | DEPENDENCIES: 7 | - Charts 8 | 9 | SPEC REPOS: 10 | trunk: 11 | - Charts 12 | 13 | SPEC CHECKSUMS: 14 | Charts: b1e3a1f5a1c9ba5394438ca3b91bd8c9076310af 15 | 16 | PODFILE CHECKSUM: 093009b72365c700e7156a5f77d325630a9bf512 17 | 18 | COCOAPODS: 1.10.1 19 | -------------------------------------------------------------------------------- /mac/Pods/Manifest.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - Charts (3.6.0): 3 | - Charts/Core (= 3.6.0) 4 | - Charts/Core (3.6.0) 5 | 6 | DEPENDENCIES: 7 | - Charts 8 | 9 | SPEC REPOS: 10 | trunk: 11 | - Charts 12 | 13 | SPEC CHECKSUMS: 14 | Charts: b1e3a1f5a1c9ba5394438ca3b91bd8c9076310af 15 | 16 | PODFILE CHECKSUM: 093009b72365c700e7156a5f77d325630a9bf512 17 | 18 | COCOAPODS: 1.10.1 19 | -------------------------------------------------------------------------------- /mac/Pods/Target Support Files/Charts/Charts-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | 14 | FOUNDATION_EXPORT double ChartsVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char ChartsVersionString[]; 16 | 17 | -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/nat/keyrace 2 | 3 | go 1.14 4 | 5 | require ( 6 | github.com/grpc-ecosystem/go-grpc-middleware v1.2.2 // indirect 7 | github.com/improbable-eng/go-httpwares v0.0.0-20200609095714-edc8019f93cc 8 | github.com/karalabe/xgo v0.0.0-20191115072854-c5ccff8648a7 // indirect 9 | github.com/mattn/go-sqlite3 v1.14.6 10 | github.com/sirupsen/logrus v1.7.0 11 | golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad 12 | ) 13 | -------------------------------------------------------------------------------- /mac/Pods/Target Support Files/Pods-keyrace-mac/Pods-keyrace-mac-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | 14 | FOUNDATION_EXPORT double Pods_keyrace_macVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char Pods_keyrace_macVersionString[]; 16 | 17 | -------------------------------------------------------------------------------- /.github/workflows/make-test.yml: -------------------------------------------------------------------------------- 1 | on: [push, pull_request] 2 | name: make test 3 | jobs: 4 | maketest: 5 | name: make test 6 | runs-on: ubuntu-latest 7 | steps: 8 | - uses: actions/checkout@master 9 | - uses: actions/setup-go@v2 10 | with: 11 | go-version: '^1.13.1' # The Go version to download (if necessary) and use. 12 | - name: make test 13 | run: make test 14 | shell: bash 15 | env: 16 | GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} 17 | -------------------------------------------------------------------------------- /mac/Pods/Charts/Source/Charts/Interfaces/BubbleChartDataProvider.swift: -------------------------------------------------------------------------------- 1 | // 2 | // BubbleChartDataProvider.swift 3 | // Charts 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/Charts 10 | // 11 | 12 | import Foundation 13 | import CoreGraphics 14 | 15 | @objc 16 | public protocol BubbleChartDataProvider: BarLineScatterCandleBubbleChartDataProvider 17 | { 18 | var bubbleData: BubbleChartData? { get } 19 | } -------------------------------------------------------------------------------- /mac/Pods/Charts/Source/Charts/Interfaces/CandleChartDataProvider.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CandleChartDataProvider.swift 3 | // Charts 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/Charts 10 | // 11 | 12 | import Foundation 13 | import CoreGraphics 14 | 15 | @objc 16 | public protocol CandleChartDataProvider: BarLineScatterCandleBubbleChartDataProvider 17 | { 18 | var candleData: CandleChartData? { get } 19 | } -------------------------------------------------------------------------------- /mac/Pods/Charts/Source/Charts/Interfaces/ScatterChartDataProvider.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ScatterChartDataProvider.swift 3 | // Charts 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/Charts 10 | // 11 | 12 | import Foundation 13 | import CoreGraphics 14 | 15 | @objc 16 | public protocol ScatterChartDataProvider: BarLineScatterCandleBubbleChartDataProvider 17 | { 18 | var scatterData: ScatterChartData? { get } 19 | } -------------------------------------------------------------------------------- /mac/keyrace-mac/Assets.xcassets/magic-keyboard.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "filename" : "magic-keyboard.png", 5 | "idiom" : "universal", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "filename" : "magic-keyboard@2x.png", 10 | "idiom" : "universal", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "filename" : "magic-keyboard@3x.png", 15 | "idiom" : "universal", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "author" : "xcode", 21 | "version" : 1 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # keyrace 2 | Daily multiplayer keyboard races for macos 3 | 4 | image 5 | 6 | ## To install 7 | 8 | ```bash 9 | git clone https://github.com/nat/keyrace.git 10 | cd keyrace/mac 11 | open keyrace-mac.xcworkspace 12 | ``` 13 | 14 | ## To build and run 15 | 16 | Cmd (⌘) + R or `Product` > `Run` in Xcode! 17 | 18 | **NOTE:** If the `Run` option is grayed out in the menu, make sure that the correct scheme is selected: `Product` > `Scheme` > `keyrace-mac`. 19 | -------------------------------------------------------------------------------- /mac/Pods/Charts/Source/Charts/Interfaces/LineChartDataProvider.swift: -------------------------------------------------------------------------------- 1 | // 2 | // LineChartDataProvider.swift 3 | // Charts 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/Charts 10 | // 11 | 12 | import Foundation 13 | import CoreGraphics 14 | 15 | @objc 16 | public protocol LineChartDataProvider: BarLineScatterCandleBubbleChartDataProvider 17 | { 18 | var lineData: LineChartData? { get } 19 | 20 | func getAxis(_ axis: YAxis.AxisDependency) -> YAxis 21 | } 22 | -------------------------------------------------------------------------------- /.github/workflows/build_app.yml: -------------------------------------------------------------------------------- 1 | name: build mac app 2 | 3 | on: [push, pull_request] 4 | 5 | jobs: 6 | build: 7 | runs-on: macOS-latest 8 | steps: 9 | - name: Checkout repository 10 | uses: actions/checkout@v1 11 | with: 12 | fetch-depth: 0 13 | - name: Select Xcode 12.4 14 | run: sudo xcode-select -switch /Applications/Xcode_12.4.app 15 | - name: Build project 16 | run: make keyrace-mac 17 | - name: Save .zip as artifact 18 | uses: actions/upload-artifact@v1 19 | with: 20 | name: keyrace-mac.app 21 | path: ./build/mac 22 | -------------------------------------------------------------------------------- /mac/Pods/Charts/Source/Charts/Interfaces/CombinedChartDataProvider.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CombinedChartDataProvider.swoft 3 | // Charts 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/Charts 10 | // 11 | 12 | import Foundation 13 | import CoreGraphics 14 | 15 | @objc 16 | public protocol CombinedChartDataProvider: LineChartDataProvider, BarChartDataProvider, BubbleChartDataProvider, CandleChartDataProvider, ScatterChartDataProvider 17 | { 18 | var combinedData: CombinedChartData? { get } 19 | } -------------------------------------------------------------------------------- /mac/Pods/Charts/Source/Charts/Data/Implementations/Standard/CandleChartData.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CandleChartData.swift 3 | // Charts 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/Charts 10 | // 11 | 12 | import Foundation 13 | 14 | open class CandleChartData: BarLineScatterCandleBubbleChartData 15 | { 16 | public override init() 17 | { 18 | super.init() 19 | } 20 | 21 | public override init(dataSets: [IChartDataSet]?) 22 | { 23 | super.init(dataSets: dataSets) 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /mac/Pods/Charts/Source/Charts/Highlight/IHighlighter.swift: -------------------------------------------------------------------------------- 1 | // 2 | // IHighlighter.swift 3 | // Charts 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/Charts 10 | // 11 | 12 | import Foundation 13 | import CoreGraphics 14 | 15 | @objc(IChartHighlighter) 16 | public protocol IHighlighter: class 17 | { 18 | /// - Parameters: 19 | /// - x: 20 | /// - y: 21 | /// - Returns: A Highlight object corresponding to the given x- and y- touch positions in pixels. 22 | func getHighlight(x: CGFloat, y: CGFloat) -> Highlight? 23 | } 24 | -------------------------------------------------------------------------------- /mac/Pods/Charts/Source/Charts/Data/Implementations/Standard/BarLineScatterCandleBubbleChartData.swift: -------------------------------------------------------------------------------- 1 | // 2 | // BarLineScatterCandleBubbleChartData.swift 3 | // Charts 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/Charts 10 | // 11 | 12 | import Foundation 13 | 14 | open class BarLineScatterCandleBubbleChartData: ChartData 15 | { 16 | public override init() 17 | { 18 | super.init() 19 | } 20 | 21 | public override init(dataSets: [IChartDataSet]?) 22 | { 23 | super.init(dataSets: dataSets) 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /mac/Pods/Charts/Source/Charts/Interfaces/BarChartDataProvider.swift: -------------------------------------------------------------------------------- 1 | // 2 | // BarChartDataProvider.swift 3 | // Charts 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/Charts 10 | // 11 | 12 | import Foundation 13 | import CoreGraphics 14 | 15 | @objc 16 | public protocol BarChartDataProvider: BarLineScatterCandleBubbleChartDataProvider 17 | { 18 | var barData: BarChartData? { get } 19 | 20 | var isDrawBarShadowEnabled: Bool { get } 21 | var isDrawValueAboveBarEnabled: Bool { get } 22 | var isHighlightFullBarEnabled: Bool { get } 23 | } -------------------------------------------------------------------------------- /mac/Pods/Charts/Source/Charts/Data/Implementations/Standard/LineChartData.swift: -------------------------------------------------------------------------------- 1 | // 2 | // LineChartData.swift 3 | // Charts 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/Charts 10 | // 11 | 12 | import Foundation 13 | 14 | /// Data object that encapsulates all data associated with a LineChart. 15 | open class LineChartData: ChartData 16 | { 17 | public override init() 18 | { 19 | super.init() 20 | } 21 | 22 | public override init(dataSets: [IChartDataSet]?) 23 | { 24 | super.init(dataSets: dataSets) 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /mac/Pods/Charts/Source/Charts/Renderers/Renderer.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Renderer.swift 3 | // Charts 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/Charts 10 | // 11 | 12 | import Foundation 13 | import CoreGraphics 14 | 15 | @objc(ChartRenderer) 16 | open class Renderer: NSObject 17 | { 18 | /// the component that handles the drawing area of the chart and it's offsets 19 | @objc public let viewPortHandler: ViewPortHandler 20 | 21 | @objc public init(viewPortHandler: ViewPortHandler) 22 | { 23 | self.viewPortHandler = viewPortHandler 24 | super.init() 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /mac/Pods/Charts/Source/Charts/Interfaces/BarLineScatterCandleBubbleChartDataProvider.swift: -------------------------------------------------------------------------------- 1 | // 2 | // BarLineScatterCandleBubbleChartDataProvider.swift 3 | // Charts 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/Charts 10 | // 11 | 12 | import Foundation 13 | import CoreGraphics 14 | 15 | @objc 16 | public protocol BarLineScatterCandleBubbleChartDataProvider: ChartDataProvider 17 | { 18 | func getTransformer(forAxis: YAxis.AxisDependency) -> Transformer 19 | func isInverted(axis: YAxis.AxisDependency) -> Bool 20 | 21 | var lowestVisibleX: Double { get } 22 | var highestVisibleX: Double { get } 23 | } 24 | -------------------------------------------------------------------------------- /mac/Pods/Target Support Files/Charts/Charts.debug.xcconfig: -------------------------------------------------------------------------------- 1 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO 2 | CODE_SIGN_IDENTITY = 3 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/Charts 4 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 5 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS -suppress-warnings 6 | PODS_BUILD_DIR = ${BUILD_DIR} 7 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 8 | PODS_ROOT = ${SRCROOT} 9 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/Charts 10 | PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates 11 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 12 | SKIP_INSTALL = YES 13 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 14 | -------------------------------------------------------------------------------- /mac/Pods/Target Support Files/Charts/Charts.release.xcconfig: -------------------------------------------------------------------------------- 1 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO 2 | CODE_SIGN_IDENTITY = 3 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/Charts 4 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 5 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS -suppress-warnings 6 | PODS_BUILD_DIR = ${BUILD_DIR} 7 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 8 | PODS_ROOT = ${SRCROOT} 9 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/Charts 10 | PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates 11 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 12 | SKIP_INSTALL = YES 13 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 14 | -------------------------------------------------------------------------------- /mac/Pods/Charts/Source/Charts/Charts/BubbleChartView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // BubbleChartView.swift 3 | // Charts 4 | // 5 | // Bubble chart implementation: 6 | // Copyright 2015 Pierre-Marc Airoldi 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/Charts 10 | // 11 | 12 | import Foundation 13 | import CoreGraphics 14 | 15 | open class BubbleChartView: BarLineChartViewBase, BubbleChartDataProvider 16 | { 17 | open override func initialize() 18 | { 19 | super.initialize() 20 | 21 | renderer = BubbleChartRenderer(dataProvider: self, animator: _animator, viewPortHandler: _viewPortHandler) 22 | } 23 | 24 | // MARK: - BubbleChartDataProvider 25 | 26 | open var bubbleData: BubbleChartData? { return _data as? BubbleChartData } 27 | } 28 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode .gitignore 2 | # 3 | # Source: 4 | # https://github.com/github/gitignore/blob/master/Global/Xcode.gitignore 5 | 6 | ## User settings 7 | xcuserdata/ 8 | 9 | ## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9) 10 | *.xcscmblueprint 11 | *.xccheckout 12 | 13 | ## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4) 14 | build/ 15 | DerivedData/ 16 | *.moved-aside 17 | *.pbxuser 18 | !default.pbxuser 19 | *.mode1v3 20 | !default.mode1v3 21 | *.mode2v3 22 | !default.mode2v3 23 | *.perspectivev3 24 | !default.perspectivev3 25 | 26 | ## Gcc Patch 27 | /*.gcno 28 | 29 | ## Sample Data 30 | .assets/*.csv 31 | 32 | ## Secrets 33 | Generated 34 | Secrets.xcconfig 35 | 36 | # Other 37 | keyrace 38 | keyrace.db 39 | keyrace.dSYM 40 | keyrace-server* 41 | vendor 42 | -------------------------------------------------------------------------------- /mac/Pods/Charts/Source/Charts/Formatters/IFillFormatter.swift: -------------------------------------------------------------------------------- 1 | // 2 | // IFillFormatter.swift 3 | // Charts 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/Charts 10 | // 11 | 12 | import Foundation 13 | import CoreGraphics 14 | 15 | /// Protocol for providing a custom logic to where the filling line of a LineDataSet should end. This of course only works if setFillEnabled(...) is set to true. 16 | @objc(IChartFillFormatter) 17 | public protocol IFillFormatter 18 | { 19 | /// - Returns: The vertical (y-axis) position where the filled-line of the LineDataSet should end. 20 | func getFillLinePosition(dataSet: ILineChartDataSet, dataProvider: LineChartDataProvider) -> CGFloat 21 | } 22 | -------------------------------------------------------------------------------- /mac/Pods/Charts/Source/Charts/Data/Interfaces/IBubbleChartDataSet.swift: -------------------------------------------------------------------------------- 1 | // 2 | // IBubbleChartDataSet.swift 3 | // Charts 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/Charts 10 | // 11 | 12 | import Foundation 13 | import CoreGraphics 14 | 15 | @objc 16 | public protocol IBubbleChartDataSet: IBarLineScatterCandleBubbleChartDataSet 17 | { 18 | // MARK: - Data functions and accessors 19 | 20 | var maxSize: CGFloat { get } 21 | var isNormalizeSizeEnabled: Bool { get } 22 | 23 | // MARK: - Styling functions and accessors 24 | 25 | /// Sets/gets the width of the circle that surrounds the bubble when highlighted 26 | var highlightCircleWidth: CGFloat { get set } 27 | } 28 | -------------------------------------------------------------------------------- /mac/Pods/Charts/Source/Charts/Data/Interfaces/IBarLineScatterCandleBubbleChartDataSet.swift: -------------------------------------------------------------------------------- 1 | // 2 | // IBarLineScatterCandleBubbleChartDataSet.swift 3 | // Charts 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/Charts 10 | // 11 | 12 | import Foundation 13 | import CoreGraphics 14 | 15 | @objc 16 | public protocol IBarLineScatterCandleBubbleChartDataSet: IChartDataSet 17 | { 18 | // MARK: - Data functions and accessors 19 | 20 | // MARK: - Styling functions and accessors 21 | 22 | var highlightColor: NSUIColor { get set } 23 | var highlightLineWidth: CGFloat { get set } 24 | var highlightLineDashPhase: CGFloat { get set } 25 | var highlightLineDashLengths: [CGFloat]? { get set } 26 | } 27 | -------------------------------------------------------------------------------- /mac/Pods/Charts/Source/Charts/Charts/LineChartView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // LineChartView.swift 3 | // Charts 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/Charts 10 | // 11 | 12 | import Foundation 13 | import CoreGraphics 14 | 15 | /// Chart that draws lines, surfaces, circles, ... 16 | open class LineChartView: BarLineChartViewBase, LineChartDataProvider 17 | { 18 | internal override func initialize() 19 | { 20 | super.initialize() 21 | 22 | renderer = LineChartRenderer(dataProvider: self, animator: _animator, viewPortHandler: _viewPortHandler) 23 | } 24 | 25 | // MARK: - LineChartDataProvider 26 | 27 | open var lineData: LineChartData? { return _data as? LineChartData } 28 | } 29 | -------------------------------------------------------------------------------- /mac/Pods/Charts/Source/Charts/Highlight/PieHighlighter.swift: -------------------------------------------------------------------------------- 1 | // 2 | // PieHighlighter.swift 3 | // Charts 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/Charts 10 | // 11 | 12 | import Foundation 13 | import CoreGraphics 14 | 15 | @objc(PieChartHighlighter) 16 | open class PieHighlighter: PieRadarHighlighter 17 | { 18 | open override func closestHighlight(index: Int, x: CGFloat, y: CGFloat) -> Highlight? 19 | { 20 | guard 21 | let set = chart?.data?.dataSets[0], 22 | let entry = set.entryForIndex(index) 23 | else { return nil } 24 | 25 | return Highlight(x: Double(index), y: entry.y, xPx: x, yPx: y, dataSetIndex: 0, axis: set.axisDependency) 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /mac/Pods/Charts/Source/Charts/Jobs/MoveViewJob.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MoveViewJob.swift 3 | // Charts 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/Charts 10 | // 11 | 12 | import Foundation 13 | import CoreGraphics 14 | 15 | @objc(MoveChartViewJob) 16 | open class MoveViewJob: ViewPortJob 17 | { 18 | open override func doJob() 19 | { 20 | guard 21 | let viewPortHandler = viewPortHandler, 22 | let transformer = transformer, 23 | let view = view 24 | else { return } 25 | 26 | var pt = CGPoint( 27 | x: xValue, 28 | y: yValue 29 | ) 30 | 31 | transformer.pointValueToPixel(&pt) 32 | viewPortHandler.centerViewPort(pt: pt, chart: view) 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /mac/keyrace-mac/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSMinimumSystemVersion 22 | $(MACOSX_DEPLOYMENT_TARGET) 23 | LSUIElement 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /mac/Pods/Target Support Files/Charts/Charts-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | ${PRODUCT_BUNDLE_IDENTIFIER} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 3.6.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /mac/Pods/Charts/Source/Charts/Data/Implementations/Standard/BubbleChartData.swift: -------------------------------------------------------------------------------- 1 | // 2 | // BubbleChartData.swift 3 | // Charts 4 | // 5 | // Bubble chart implementation: 6 | // Copyright 2015 Pierre-Marc Airoldi 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/Charts 10 | // 11 | 12 | import Foundation 13 | import CoreGraphics 14 | 15 | open class BubbleChartData: BarLineScatterCandleBubbleChartData 16 | { 17 | public override init() 18 | { 19 | super.init() 20 | } 21 | 22 | public override init(dataSets: [IChartDataSet]?) 23 | { 24 | super.init(dataSets: dataSets) 25 | } 26 | 27 | /// Sets the width of the circle that surrounds the bubble when highlighted for all DataSet objects this data object contains 28 | @objc open func setHighlightCircleWidth(_ width: CGFloat) 29 | { 30 | (_dataSets as? [IBubbleChartDataSet])?.forEach { $0.highlightCircleWidth = width } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /mac/Pods/Target Support Files/Pods-keyrace-mac/Pods-keyrace-mac-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | ${PRODUCT_BUNDLE_IDENTIFIER} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /mac/Pods/Charts/Source/Charts/Charts/ScatterChartView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ScatterChartView.swift 3 | // Charts 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/Charts 10 | // 11 | 12 | import Foundation 13 | import CoreGraphics 14 | 15 | /// The ScatterChart. Draws dots, triangles, squares and custom shapes into the chartview. 16 | open class ScatterChartView: BarLineChartViewBase, ScatterChartDataProvider 17 | { 18 | open override func initialize() 19 | { 20 | super.initialize() 21 | 22 | renderer = ScatterChartRenderer(dataProvider: self, animator: _animator, viewPortHandler: _viewPortHandler) 23 | 24 | xAxis.spaceMin = 0.5 25 | xAxis.spaceMax = 0.5 26 | } 27 | 28 | // MARK: - ScatterChartDataProvider 29 | 30 | open var scatterData: ScatterChartData? { return _data as? ScatterChartData } 31 | } 32 | -------------------------------------------------------------------------------- /mac/Pods/Charts/Source/Charts/Data/Implementations/Standard/ScatterChartData.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ScatterChartData.swift 3 | // Charts 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/Charts 10 | // 11 | 12 | import Foundation 13 | import CoreGraphics 14 | 15 | open class ScatterChartData: BarLineScatterCandleBubbleChartData 16 | { 17 | public override init() 18 | { 19 | super.init() 20 | } 21 | 22 | public override init(dataSets: [IChartDataSet]?) 23 | { 24 | super.init(dataSets: dataSets) 25 | } 26 | 27 | /// - Returns: The maximum shape-size across all DataSets. 28 | @objc open func getGreatestShapeSize() -> CGFloat 29 | { 30 | return (_dataSets as? [IScatterChartDataSet])? 31 | .max { $0.scatterShapeSize < $1.scatterShapeSize }? 32 | .scatterShapeSize ?? 0 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /mac/Pods/Charts/Source/Charts/Jobs/AnimatedMoveViewJob.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AnimatedMoveViewJob.swift 3 | // Charts 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/Charts 10 | // 11 | 12 | import Foundation 13 | import CoreGraphics 14 | 15 | open class AnimatedMoveViewJob: AnimatedViewPortJob 16 | { 17 | internal override func animationUpdate() 18 | { 19 | guard 20 | let viewPortHandler = viewPortHandler, 21 | let transformer = transformer, 22 | let view = view 23 | else { return } 24 | 25 | var pt = CGPoint( 26 | x: xOrigin + (CGFloat(xValue) - xOrigin) * phase, 27 | y: yOrigin + (CGFloat(yValue) - yOrigin) * phase 28 | ) 29 | 30 | transformer.pointValueToPixel(&pt) 31 | viewPortHandler.centerViewPort(pt: pt, chart: view) 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /mac/Pods/Charts/Source/Charts/Charts/CandleStickChartView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CandleStickChartView.swift 3 | // Charts 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/Charts 10 | // 11 | 12 | import Foundation 13 | import CoreGraphics 14 | 15 | /// Financial chart type that draws candle-sticks. 16 | open class CandleStickChartView: BarLineChartViewBase, CandleChartDataProvider 17 | { 18 | internal override func initialize() 19 | { 20 | super.initialize() 21 | 22 | renderer = CandleStickChartRenderer(dataProvider: self, animator: _animator, viewPortHandler: _viewPortHandler) 23 | 24 | self.xAxis.spaceMin = 0.5 25 | self.xAxis.spaceMax = 0.5 26 | } 27 | 28 | // MARK: - CandleChartDataProvider 29 | 30 | open var candleData: CandleChartData? 31 | { 32 | return _data as? CandleChartData 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /mac/Pods/Charts/Source/Charts/Renderers/Scatter/IShapeRenderer.swift: -------------------------------------------------------------------------------- 1 | // 2 | // IShapeRenderer.swift 3 | // Charts 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/Charts 10 | // 11 | 12 | import Foundation 13 | import CoreGraphics 14 | 15 | @objc 16 | public protocol IShapeRenderer: class 17 | { 18 | /// Renders the provided ScatterDataSet with a shape. 19 | /// 20 | /// - Parameters: 21 | /// - context: CGContext for drawing on 22 | /// - dataSet: The DataSet to be drawn 23 | /// - viewPortHandler: Contains information about the current state of the view 24 | /// - point: Position to draw the shape at 25 | /// - color: Color to draw the shape 26 | func renderShape( 27 | context: CGContext, 28 | dataSet: IScatterChartDataSet, 29 | viewPortHandler: ViewPortHandler, 30 | point: CGPoint, 31 | color: NSUIColor) 32 | } 33 | -------------------------------------------------------------------------------- /mac/Pods/Charts/Source/Charts/Formatters/IAxisValueFormatter.swift: -------------------------------------------------------------------------------- 1 | // 2 | // IAxisValueFormatter.swift 3 | // Charts 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/Charts 10 | // 11 | 12 | import Foundation 13 | 14 | /// An interface for providing custom axis Strings. 15 | @objc(IChartAxisValueFormatter) 16 | public protocol IAxisValueFormatter: class 17 | { 18 | 19 | /// Called when a value from an axis is formatted before being drawn. 20 | /// 21 | /// For performance reasons, avoid excessive calculations and memory allocations inside this method. 22 | /// 23 | /// - Parameters: 24 | /// - value: the value that is currently being drawn 25 | /// - axis: the axis that the value belongs to 26 | /// - Returns: The customized label that is drawn on the x-axis. 27 | func stringForValue(_ value: Double, 28 | axis: AxisBase?) -> String 29 | 30 | } 31 | -------------------------------------------------------------------------------- /mac/Pods/Charts/Source/Charts/Components/ComponentBase.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ComponentBase.swift 3 | // Charts 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/Charts 10 | // 11 | 12 | import Foundation 13 | import CoreGraphics 14 | 15 | 16 | /// This class encapsulates everything both Axis, Legend and LimitLines have in common 17 | @objc(ChartComponentBase) 18 | open class ComponentBase: NSObject 19 | { 20 | /// flag that indicates if this component is enabled or not 21 | @objc open var enabled = true 22 | 23 | /// The offset this component has on the x-axis 24 | /// **default**: 5.0 25 | @objc open var xOffset = CGFloat(5.0) 26 | 27 | /// The offset this component has on the x-axis 28 | /// **default**: 5.0 (or 0.0 on ChartYAxis) 29 | @objc open var yOffset = CGFloat(5.0) 30 | 31 | public override init() 32 | { 33 | super.init() 34 | } 35 | 36 | @objc open var isEnabled: Bool { return enabled } 37 | } 38 | -------------------------------------------------------------------------------- /mac/Pods/Target Support Files/Pods-keyrace-mac/Pods-keyrace-mac.debug.xcconfig: -------------------------------------------------------------------------------- 1 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES 2 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO 3 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Charts" 4 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 5 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Charts/Charts.framework/Headers" 6 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/../Frameworks' '@loader_path/Frameworks' 7 | OTHER_CFLAGS = $(inherited) -isystem "${PODS_CONFIGURATION_BUILD_DIR}/Charts/Charts.framework/Headers" -iframework "${PODS_CONFIGURATION_BUILD_DIR}/Charts" 8 | OTHER_LDFLAGS = $(inherited) -framework "Charts" 9 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS 10 | PODS_BUILD_DIR = ${BUILD_DIR} 11 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 12 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 13 | PODS_ROOT = ${SRCROOT}/Pods 14 | PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates 15 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 16 | -------------------------------------------------------------------------------- /mac/Pods/Target Support Files/Pods-keyrace-mac/Pods-keyrace-mac.release.xcconfig: -------------------------------------------------------------------------------- 1 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES 2 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO 3 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Charts" 4 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 5 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Charts/Charts.framework/Headers" 6 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/../Frameworks' '@loader_path/Frameworks' 7 | OTHER_CFLAGS = $(inherited) -isystem "${PODS_CONFIGURATION_BUILD_DIR}/Charts/Charts.framework/Headers" -iframework "${PODS_CONFIGURATION_BUILD_DIR}/Charts" 8 | OTHER_LDFLAGS = $(inherited) -framework "Charts" 9 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS 10 | PODS_BUILD_DIR = ${BUILD_DIR} 11 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 12 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 13 | PODS_ROOT = ${SRCROOT}/Pods 14 | PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates 15 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 16 | -------------------------------------------------------------------------------- /mac/Pods/Charts/Source/Charts/Utils/TransformerHorizontalBarChart.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TransformerHorizontalBarChart.swift 3 | // Charts 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/Charts 10 | // 11 | 12 | import Foundation 13 | import CoreGraphics 14 | 15 | @objc(ChartTransformerHorizontalBarChart) 16 | open class TransformerHorizontalBarChart: Transformer 17 | { 18 | /// Prepares the matrix that contains all offsets. 19 | open override func prepareMatrixOffset(inverted: Bool) 20 | { 21 | if !inverted 22 | { 23 | _matrixOffset = CGAffineTransform(translationX: _viewPortHandler.offsetLeft, y: _viewPortHandler.chartHeight - _viewPortHandler.offsetBottom) 24 | } 25 | else 26 | { 27 | _matrixOffset = CGAffineTransform(scaleX: -1.0, y: 1.0) 28 | _matrixOffset = _matrixOffset.translatedBy(x: -(_viewPortHandler.chartWidth - _viewPortHandler.offsetRight), 29 | y: _viewPortHandler.chartHeight - _viewPortHandler.offsetBottom) 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /mac/Pods/Charts/Source/Charts/Interfaces/ChartDataProvider.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ChartDataProvider.swift 3 | // Charts 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/Charts 10 | // 11 | 12 | import Foundation 13 | import CoreGraphics 14 | 15 | @objc 16 | public protocol ChartDataProvider 17 | { 18 | /// The minimum x-value of the chart, regardless of zoom or translation. 19 | var chartXMin: Double { get } 20 | 21 | /// The maximum x-value of the chart, regardless of zoom or translation. 22 | var chartXMax: Double { get } 23 | 24 | /// The minimum y-value of the chart, regardless of zoom or translation. 25 | var chartYMin: Double { get } 26 | 27 | /// The maximum y-value of the chart, regardless of zoom or translation. 28 | var chartYMax: Double { get } 29 | 30 | var maxHighlightDistance: CGFloat { get } 31 | 32 | var xRange: Double { get } 33 | 34 | var centerOffsets: CGPoint { get } 35 | 36 | var data: ChartData? { get } 37 | 38 | var maxVisibleCount: Int { get } 39 | } 40 | -------------------------------------------------------------------------------- /mac/keyrace-mac/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "mac", 5 | "scale" : "1x", 6 | "size" : "16x16" 7 | }, 8 | { 9 | "idiom" : "mac", 10 | "scale" : "2x", 11 | "size" : "16x16" 12 | }, 13 | { 14 | "idiom" : "mac", 15 | "scale" : "1x", 16 | "size" : "32x32" 17 | }, 18 | { 19 | "idiom" : "mac", 20 | "scale" : "2x", 21 | "size" : "32x32" 22 | }, 23 | { 24 | "idiom" : "mac", 25 | "scale" : "1x", 26 | "size" : "128x128" 27 | }, 28 | { 29 | "idiom" : "mac", 30 | "scale" : "2x", 31 | "size" : "128x128" 32 | }, 33 | { 34 | "idiom" : "mac", 35 | "scale" : "1x", 36 | "size" : "256x256" 37 | }, 38 | { 39 | "idiom" : "mac", 40 | "scale" : "2x", 41 | "size" : "256x256" 42 | }, 43 | { 44 | "idiom" : "mac", 45 | "scale" : "1x", 46 | "size" : "512x512" 47 | }, 48 | { 49 | "idiom" : "mac", 50 | "scale" : "2x", 51 | "size" : "512x512" 52 | } 53 | ], 54 | "info" : { 55 | "author" : "xcode", 56 | "version" : 1 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /mac/Pods/Charts/Source/Charts/Data/Interfaces/IScatterChartDataSet.swift: -------------------------------------------------------------------------------- 1 | // 2 | // IScatterChartDataSet.swift 3 | // Charts 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/Charts 10 | // 11 | 12 | import Foundation 13 | import CoreGraphics 14 | 15 | @objc 16 | public protocol IScatterChartDataSet: ILineScatterCandleRadarChartDataSet 17 | { 18 | // MARK: - Data functions and accessors 19 | 20 | // MARK: - Styling functions and accessors 21 | 22 | /// The size the scatter shape will have 23 | var scatterShapeSize: CGFloat { get } 24 | 25 | /// - Returns: The radius of the hole in the shape (applies to Square, Circle and Triangle) 26 | /// Set this to <= 0 to remove holes. 27 | /// **default**: 0.0 28 | var scatterShapeHoleRadius: CGFloat { get } 29 | 30 | /// - Returns: Color for the hole in the shape. Setting to `nil` will behave as transparent. 31 | /// **default**: nil 32 | var scatterShapeHoleColor: NSUIColor? { get } 33 | 34 | /// The IShapeRenderer responsible for rendering this DataSet. 35 | var shapeRenderer: IShapeRenderer? { get } 36 | } 37 | -------------------------------------------------------------------------------- /mac/Pods/Charts/Source/Charts/Renderers/Scatter/CrossShapeRenderer.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CrossShapeRenderer.swift 3 | // Charts 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/Charts 10 | // 11 | import Foundation 12 | import CoreGraphics 13 | 14 | open class CrossShapeRenderer : NSObject, IShapeRenderer 15 | { 16 | open func renderShape( 17 | context: CGContext, 18 | dataSet: IScatterChartDataSet, 19 | viewPortHandler: ViewPortHandler, 20 | point: CGPoint, 21 | color: NSUIColor) 22 | { 23 | let shapeSize = dataSet.scatterShapeSize 24 | let shapeHalf = shapeSize / 2.0 25 | 26 | context.setLineWidth(1.0) 27 | context.setStrokeColor(color.cgColor) 28 | 29 | context.beginPath() 30 | context.move(to: CGPoint(x: point.x - shapeHalf, y: point.y)) 31 | context.addLine(to: CGPoint(x: point.x + shapeHalf, y: point.y)) 32 | context.move(to: CGPoint(x: point.x, y: point.y - shapeHalf)) 33 | context.addLine(to: CGPoint(x: point.x, y: point.y + shapeHalf)) 34 | context.strokePath() 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /mac/Pods/Charts/Source/Charts/Utils/Platform+Color.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Platform+Color.swift 3 | // Charts 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/Charts 10 | // 11 | 12 | #if canImport(UIKit) 13 | import UIKit 14 | 15 | public typealias NSUIColor = UIColor 16 | private func fetchLabelColor() -> UIColor 17 | { 18 | if #available(iOS 13, tvOS 13, *) 19 | { 20 | return .label 21 | } 22 | else 23 | { 24 | return .black 25 | } 26 | } 27 | private let labelColor: UIColor = fetchLabelColor() 28 | 29 | extension UIColor 30 | { 31 | static var labelOrBlack: UIColor { labelColor } 32 | } 33 | #endif 34 | 35 | #if canImport(AppKit) && !targetEnvironment(macCatalyst) 36 | 37 | import AppKit 38 | 39 | public typealias NSUIColor = NSColor 40 | private func fetchLabelColor() -> NSColor 41 | { 42 | if #available(macOS 10.14, *) 43 | { 44 | return .labelColor 45 | } 46 | else 47 | { 48 | return .black 49 | } 50 | } 51 | private let labelColor: NSColor = fetchLabelColor() 52 | 53 | extension NSColor 54 | { 55 | static var labelOrBlack: NSColor { labelColor } 56 | } 57 | #endif 58 | -------------------------------------------------------------------------------- /mac/Pods/Charts/Source/Charts/Renderers/Scatter/XShapeRenderer.swift: -------------------------------------------------------------------------------- 1 | // 2 | // XShapeRenderer.swift 3 | // Charts 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/Charts 10 | // 11 | import Foundation 12 | import CoreGraphics 13 | 14 | open class XShapeRenderer : NSObject, IShapeRenderer 15 | { 16 | open func renderShape( 17 | context: CGContext, 18 | dataSet: IScatterChartDataSet, 19 | viewPortHandler: ViewPortHandler, 20 | point: CGPoint, 21 | color: NSUIColor) 22 | { 23 | let shapeSize = dataSet.scatterShapeSize 24 | let shapeHalf = shapeSize / 2.0 25 | 26 | context.setLineWidth(1.0) 27 | context.setStrokeColor(color.cgColor) 28 | 29 | context.beginPath() 30 | context.move(to: CGPoint(x: point.x - shapeHalf, y: point.y - shapeHalf)) 31 | context.addLine(to: CGPoint(x: point.x + shapeHalf, y: point.y + shapeHalf)) 32 | context.move(to: CGPoint(x: point.x + shapeHalf, y: point.y - shapeHalf)) 33 | context.addLine(to: CGPoint(x: point.x - shapeHalf, y: point.y + shapeHalf)) 34 | context.strokePath() 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /mac/Pods/Charts/Source/Charts/Highlight/Range.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Range.swift 3 | // Charts 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/Charts 10 | // 11 | 12 | import Foundation 13 | 14 | @objc(ChartRange) 15 | open class Range: NSObject 16 | { 17 | @objc open var from: Double 18 | @objc open var to: Double 19 | 20 | @objc public init(from: Double, to: Double) 21 | { 22 | self.from = from 23 | self.to = to 24 | 25 | super.init() 26 | } 27 | 28 | /// - Parameters: 29 | /// - value: 30 | /// - Returns: `true` if this range contains (if the value is in between) the given value, `false` ifnot. 31 | @objc open func contains(_ value: Double) -> Bool 32 | { 33 | if value > from && value <= to 34 | { 35 | return true 36 | } 37 | else 38 | { 39 | return false 40 | } 41 | } 42 | 43 | @objc open func isLarger(_ value: Double) -> Bool 44 | { 45 | return value > to 46 | } 47 | 48 | @objc open func isSmaller(_ value: Double) -> Bool 49 | { 50 | return value < from 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /mac/Pods/Charts/Source/Charts/Data/Interfaces/IRadarChartDataSet.swift: -------------------------------------------------------------------------------- 1 | // 2 | // IRadarChartDataSet.swift 3 | // Charts 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/Charts 10 | // 11 | 12 | import Foundation 13 | import CoreGraphics 14 | 15 | @objc 16 | public protocol IRadarChartDataSet: ILineRadarChartDataSet 17 | { 18 | // MARK: - Data functions and accessors 19 | 20 | // MARK: - Styling functions and accessors 21 | 22 | /// flag indicating whether highlight circle should be drawn or not 23 | var drawHighlightCircleEnabled: Bool { get set } 24 | 25 | var isDrawHighlightCircleEnabled: Bool { get } 26 | 27 | var highlightCircleFillColor: NSUIColor? { get set } 28 | 29 | /// The stroke color for highlight circle. 30 | /// If `nil`, the color of the dataset is taken. 31 | var highlightCircleStrokeColor: NSUIColor? { get set } 32 | 33 | var highlightCircleStrokeAlpha: CGFloat { get set } 34 | 35 | var highlightCircleInnerRadius: CGFloat { get set } 36 | 37 | var highlightCircleOuterRadius: CGFloat { get set } 38 | 39 | var highlightCircleStrokeWidth: CGFloat { get set } 40 | } 41 | -------------------------------------------------------------------------------- /mac/Pods/Charts/Source/Charts/Renderers/Scatter/ChevronUpShapeRenderer.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ChevronUpShapeRenderer.swift 3 | // Charts 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/Charts 10 | // 11 | import Foundation 12 | import CoreGraphics 13 | 14 | open class ChevronUpShapeRenderer : NSObject, IShapeRenderer 15 | { 16 | open func renderShape( 17 | context: CGContext, 18 | dataSet: IScatterChartDataSet, 19 | viewPortHandler: ViewPortHandler, 20 | point: CGPoint, 21 | color: NSUIColor) 22 | { 23 | let shapeSize = dataSet.scatterShapeSize 24 | let shapeHalf = shapeSize / 2.0 25 | 26 | context.setLineWidth(1.0) 27 | context.setStrokeColor(color.cgColor) 28 | 29 | context.beginPath() 30 | context.move(to: CGPoint(x: point.x, y: point.y - 2 * shapeHalf)) 31 | context.addLine(to: CGPoint(x: point.x + 2 * shapeHalf, y: point.y)) 32 | context.move(to: CGPoint(x: point.x, y: point.y - 2 * shapeHalf)) 33 | context.addLine(to: CGPoint(x: point.x - 2 * shapeHalf, y: point.y)) 34 | context.strokePath() 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /mac/Pods/Charts/Source/Charts/Renderers/Scatter/ChevronDownShapeRenderer.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ChevronDownShapeRenderer.swift 3 | // Charts 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/Charts 10 | // 11 | import Foundation 12 | import CoreGraphics 13 | 14 | open class ChevronDownShapeRenderer : NSObject, IShapeRenderer 15 | { 16 | open func renderShape( 17 | context: CGContext, 18 | dataSet: IScatterChartDataSet, 19 | viewPortHandler: ViewPortHandler, 20 | point: CGPoint, 21 | color: NSUIColor) 22 | { 23 | let shapeSize = dataSet.scatterShapeSize 24 | let shapeHalf = shapeSize / 2.0 25 | 26 | context.setLineWidth(1.0) 27 | context.setStrokeColor(color.cgColor) 28 | 29 | context.beginPath() 30 | context.move(to: CGPoint(x: point.x, y: point.y + 2 * shapeHalf)) 31 | context.addLine(to: CGPoint(x: point.x + 2 * shapeHalf, y: point.y)) 32 | context.move(to: CGPoint(x: point.x, y: point.y + 2 * shapeHalf)) 33 | context.addLine(to: CGPoint(x: point.x - 2 * shapeHalf, y: point.y)) 34 | context.strokePath() 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | SERVER=keyrace.app 2 | BUILDTAGS=libsqlite3 sqlite_omit_load_extension 3 | 4 | keyrace-server: $(wildcard *.go) 5 | go mod vendor || true 6 | go build -o $@ \ 7 | -tags "$(BUILDTAGS)" $? 8 | 9 | server: keyrace-server keyrace-server-linux ## Build the server. 10 | 11 | keyrace-server-linux: $(wildcard *.go) 12 | # On a mac you need to `brew install sqlite` 13 | echo "Using sqlite broke the static binary building on macos" 14 | #go mod vendor 15 | #GOOS=linux GOARCH=amd64 CGO_ENABLED=1 go build \ 16 | # -o $@ \ 17 | # -tags "$(BUILDTAGS)" \ 18 | # -installsuffix netgo -ldflags "-w -extldflags" $? 19 | 20 | keyrace-mac: 21 | set -eo pipefail 22 | mkdir -p build/mac 23 | xcodebuild \ 24 | -workspace mac/keyrace-mac.xcworkspace/ \ 25 | -scheme keyrace-mac \ 26 | -archivePath $(PWD)/build/keyrace.xcarchive \ 27 | clean archive 28 | cp -r build/keyrace.xcarchive/Products/Applications/keyrace-mac.app build/mac 29 | 30 | server-test: $(wildcard *.go) 31 | @echo "Running the go tests..." 32 | go mod vendor 33 | go test $? 34 | 35 | test: server-test ## Run the tests. 36 | 37 | deploy: keyrace-server-linux ## Deploy the server binary. 38 | scp keyrace-server-linux $(SERVER): 39 | 40 | clean: 41 | rm -rf keyrace.dSYM 42 | 43 | .PHONY: help 44 | help: ## Show this help. 45 | @fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//' 46 | -------------------------------------------------------------------------------- /mac/Pods/Charts/Source/Charts/Jobs/ViewPortJob.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewPortJob.swift 3 | // Charts 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/Charts 10 | // 11 | 12 | import Foundation 13 | import CoreGraphics 14 | 15 | // This defines a viewport modification job, used for delaying or animating viewport changes 16 | @objc(ChartViewPortJob) 17 | open class ViewPortJob: NSObject 18 | { 19 | internal var point: CGPoint = CGPoint() 20 | internal weak var viewPortHandler: ViewPortHandler? 21 | internal var xValue: Double = 0.0 22 | internal var yValue: Double = 0.0 23 | internal weak var transformer: Transformer? 24 | internal weak var view: ChartViewBase? 25 | 26 | @objc public init( 27 | viewPortHandler: ViewPortHandler, 28 | xValue: Double, 29 | yValue: Double, 30 | transformer: Transformer, 31 | view: ChartViewBase) 32 | { 33 | super.init() 34 | 35 | self.viewPortHandler = viewPortHandler 36 | self.xValue = xValue 37 | self.yValue = yValue 38 | self.transformer = transformer 39 | self.view = view 40 | } 41 | 42 | @objc open func doJob() 43 | { 44 | fatalError("`doJob()` must be overridden by subclasses") 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /mac/Pods/Charts/Source/Charts/Data/Implementations/Standard/BarLineScatterCandleBubbleChartDataSet.swift: -------------------------------------------------------------------------------- 1 | // 2 | // BarLineScatterCandleBubbleChartDataSet.swift 3 | // Charts 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/Charts 10 | // 11 | 12 | import Foundation 13 | import CoreGraphics 14 | 15 | 16 | open class BarLineScatterCandleBubbleChartDataSet: ChartDataSet, IBarLineScatterCandleBubbleChartDataSet 17 | { 18 | // MARK: - Data functions and accessors 19 | 20 | // MARK: - Styling functions and accessors 21 | 22 | open var highlightColor = NSUIColor(red: 255.0/255.0, green: 187.0/255.0, blue: 115.0/255.0, alpha: 1.0) 23 | open var highlightLineWidth = CGFloat(0.5) 24 | open var highlightLineDashPhase = CGFloat(0.0) 25 | open var highlightLineDashLengths: [CGFloat]? 26 | 27 | // MARK: - NSCopying 28 | 29 | open override func copy(with zone: NSZone? = nil) -> Any 30 | { 31 | let copy = super.copy(with: zone) as! BarLineScatterCandleBubbleChartDataSet 32 | copy.highlightColor = highlightColor 33 | copy.highlightLineWidth = highlightLineWidth 34 | copy.highlightLineDashPhase = highlightLineDashPhase 35 | copy.highlightLineDashLengths = highlightLineDashLengths 36 | return copy 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /mac/Pods/Charts/Source/Charts/Data/Implementations/Standard/RadarChartDataEntry.swift: -------------------------------------------------------------------------------- 1 | // 2 | // RadarChartDataEntry.swift 3 | // Charts 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/Charts 10 | // 11 | 12 | import Foundation 13 | import CoreGraphics 14 | 15 | open class RadarChartDataEntry: ChartDataEntry 16 | { 17 | public required init() 18 | { 19 | super.init() 20 | } 21 | 22 | /// - Parameters: 23 | /// - value: The value on the y-axis. 24 | @objc public init(value: Double) 25 | { 26 | super.init(x: .nan, y: value) 27 | } 28 | 29 | /// - Parameters: 30 | /// - value: The value on the y-axis. 31 | /// - data: Spot for additional data this Entry represents. 32 | @objc public convenience init(value: Double, data: Any?) 33 | { 34 | self.init(value: value) 35 | self.data = data 36 | } 37 | 38 | // MARK: Data property accessors 39 | 40 | @objc open var value: Double 41 | { 42 | get { return y } 43 | set { y = newValue } 44 | } 45 | 46 | // MARK: NSCopying 47 | 48 | open override func copy(with zone: NSZone? = nil) -> Any 49 | { 50 | let copy = super.copy(with: zone) as! RadarChartDataEntry 51 | 52 | return copy 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /mac/Pods/Charts/Source/Charts/Data/Interfaces/ILineScatterCandleRadarChartDataSet.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ILineScatterCandleRadarChartDataSet.swift 3 | // Charts 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/Charts 10 | // 11 | 12 | import Foundation 13 | 14 | @objc 15 | public protocol ILineScatterCandleRadarChartDataSet: IBarLineScatterCandleBubbleChartDataSet 16 | { 17 | // MARK: - Data functions and accessors 18 | 19 | // MARK: - Styling functions and accessors 20 | 21 | /// Enables / disables the horizontal highlight-indicator. If disabled, the indicator is not drawn. 22 | var drawHorizontalHighlightIndicatorEnabled: Bool { get set } 23 | 24 | /// Enables / disables the vertical highlight-indicator. If disabled, the indicator is not drawn. 25 | var drawVerticalHighlightIndicatorEnabled: Bool { get set } 26 | 27 | /// `true` if horizontal highlight indicator lines are enabled (drawn) 28 | var isHorizontalHighlightIndicatorEnabled: Bool { get } 29 | 30 | /// `true` if vertical highlight indicator lines are enabled (drawn) 31 | var isVerticalHighlightIndicatorEnabled: Bool { get } 32 | 33 | /// Enables / disables both vertical and horizontal highlight-indicators. 34 | /// :param: enabled 35 | func setDrawHighlightIndicators(_ enabled: Bool) 36 | } 37 | -------------------------------------------------------------------------------- /mac/Pods/Charts/Source/Charts/Data/Implementations/Standard/RadarChartData.swift: -------------------------------------------------------------------------------- 1 | // 2 | // RadarChartData.swift 3 | // Charts 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/Charts 10 | // 11 | 12 | import Foundation 13 | import CoreGraphics 14 | 15 | 16 | open class RadarChartData: ChartData 17 | { 18 | @objc open var highlightColor = NSUIColor(red: 255.0/255.0, green: 187.0/255.0, blue: 115.0/255.0, alpha: 1.0) 19 | @objc open var highlightLineWidth = CGFloat(1.0) 20 | @objc open var highlightLineDashPhase = CGFloat(0.0) 21 | @objc open var highlightLineDashLengths: [CGFloat]? 22 | 23 | /// Sets labels that should be drawn around the RadarChart at the end of each web line. 24 | @objc open var labels = [String]() 25 | 26 | /// Sets the labels that should be drawn around the RadarChart at the end of each web line. 27 | open func setLabels(_ labels: String...) 28 | { 29 | self.labels = labels 30 | } 31 | 32 | public override init() 33 | { 34 | super.init() 35 | } 36 | 37 | public override init(dataSets: [IChartDataSet]?) 38 | { 39 | super.init(dataSets: dataSets) 40 | } 41 | 42 | open override func entryForHighlight(_ highlight: Highlight) -> ChartDataEntry? 43 | { 44 | return getDataSetByIndex(highlight.dataSetIndex)?.entryForIndex(Int(highlight.x)) 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /mac/Pods/Charts/Source/Charts/Formatters/IValueFormatter.swift: -------------------------------------------------------------------------------- 1 | // 2 | // IValueFormatter.swift 3 | // Charts 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/Charts 10 | // 11 | 12 | import Foundation 13 | 14 | /// Interface that allows custom formatting of all values inside the chart before they are drawn to the screen. 15 | /// 16 | /// Simply create your own formatting class and let it implement ValueFormatter. Then override the stringForValue() 17 | /// method and return whatever you want. 18 | 19 | @objc(IChartValueFormatter) 20 | public protocol IValueFormatter: class 21 | { 22 | 23 | /// Called when a value (from labels inside the chart) is formatted before being drawn. 24 | /// 25 | /// For performance reasons, avoid excessive calculations and memory allocations inside this method. 26 | /// 27 | /// - Parameters: 28 | /// - value: The value to be formatted 29 | /// - dataSetIndex: The index of the DataSet the entry in focus belongs to 30 | /// - viewPortHandler: provides information about the current chart state (scale, translation, ...) 31 | /// - Returns: The formatted label ready to be drawn 32 | func stringForValue(_ value: Double, 33 | entry: ChartDataEntry, 34 | dataSetIndex: Int, 35 | viewPortHandler: ViewPortHandler?) -> String 36 | } 37 | -------------------------------------------------------------------------------- /mac/Pods/Charts/Source/Charts/Components/Description.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Description.swift 3 | // Charts 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/Charts 10 | // 11 | 12 | import Foundation 13 | import CoreGraphics 14 | 15 | #if canImport(UIKit) 16 | import UIKit 17 | #endif 18 | 19 | #if canImport(Cocoa) 20 | import Cocoa 21 | #endif 22 | 23 | @objc(ChartDescription) 24 | open class Description: ComponentBase 25 | { 26 | public override init() 27 | { 28 | #if os(tvOS) 29 | // 23 is the smallest recommended font size on the TV 30 | font = .systemFont(ofSize: 23) 31 | #elseif os(OSX) 32 | font = .systemFont(ofSize: NSUIFont.systemFontSize) 33 | #else 34 | font = .systemFont(ofSize: 8.0) 35 | #endif 36 | 37 | super.init() 38 | } 39 | 40 | /// The text to be shown as the description. 41 | @objc open var text: String? 42 | 43 | /// Custom position for the description text in pixels on the screen. 44 | open var position: CGPoint? = nil 45 | 46 | /// The text alignment of the description text. Default RIGHT. 47 | @objc open var textAlign: NSTextAlignment = NSTextAlignment.right 48 | 49 | /// Font object used for drawing the description text. 50 | @objc open var font: NSUIFont 51 | 52 | /// Text color used for drawing the description text 53 | @objc open var textColor = NSUIColor.labelOrBlack 54 | } 55 | -------------------------------------------------------------------------------- /mac/Pods/Charts/Source/Charts/Data/Interfaces/IBarChartDataSet.swift: -------------------------------------------------------------------------------- 1 | // 2 | // IBarChartDataSet.swift 3 | // Charts 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/Charts 10 | // 11 | 12 | import Foundation 13 | import CoreGraphics 14 | 15 | @objc 16 | public protocol IBarChartDataSet: IBarLineScatterCandleBubbleChartDataSet 17 | { 18 | // MARK: - Data functions and accessors 19 | 20 | // MARK: - Styling functions and accessors 21 | 22 | /// `true` if this DataSet is stacked (stacksize > 1) or not. 23 | var isStacked: Bool { get } 24 | 25 | /// The maximum number of bars that can be stacked upon another in this DataSet. 26 | var stackSize: Int { get } 27 | 28 | /// the color used for drawing the bar-shadows. The bar shadows is a surface behind the bar that indicates the maximum value 29 | var barShadowColor: NSUIColor { get set } 30 | 31 | /// the width used for drawing borders around the bars. If borderWidth == 0, no border will be drawn. 32 | var barBorderWidth : CGFloat { get set } 33 | 34 | /// the color drawing borders around the bars. 35 | var barBorderColor: NSUIColor { get set } 36 | 37 | /// the alpha value (transparency) that is used for drawing the highlight indicator bar. min = 0.0 (fully transparent), max = 1.0 (fully opaque) 38 | var highlightAlpha: CGFloat { get set } 39 | 40 | /// array of labels used to describe the different values of the stacked bars 41 | var stackLabels: [String] { get set } 42 | } 43 | -------------------------------------------------------------------------------- /mac/Pods/Charts/Source/Charts/Data/Interfaces/ILineRadarChartDataSet.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ILineRadarChartDataSet.swift 3 | // Charts 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/Charts 10 | // 11 | 12 | import Foundation 13 | import CoreGraphics 14 | 15 | @objc 16 | public protocol ILineRadarChartDataSet: ILineScatterCandleRadarChartDataSet 17 | { 18 | // MARK: - Data functions and accessors 19 | 20 | // MARK: - Styling functions and accessors 21 | 22 | /// The color that is used for filling the line surface area. 23 | var fillColor: NSUIColor { get set } 24 | 25 | /// - Returns: The object that is used for filling the area below the line. 26 | /// **default**: nil 27 | var fill: Fill? { get set } 28 | 29 | /// The alpha value that is used for filling the line surface. 30 | /// **default**: 0.33 31 | var fillAlpha: CGFloat { get set } 32 | 33 | /// line width of the chart (min = 0.0, max = 10) 34 | /// 35 | /// **default**: 1 36 | var lineWidth: CGFloat { get set } 37 | 38 | /// Set to `true` if the DataSet should be drawn filled (surface), and not just as a line. 39 | /// Disabling this will give great performance boost. 40 | /// Please note that this method uses the path clipping for drawing the filled area (with images, gradients and layers). 41 | var drawFilledEnabled: Bool { get set } 42 | 43 | /// `true` if filled drawing is enabled, `false` if not 44 | var isDrawFilledEnabled: Bool { get } 45 | } 46 | -------------------------------------------------------------------------------- /mac/keyrace-mac/UserDefaults.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UserDefaults.swift 3 | // keyrace-mac 4 | // 5 | // Created by Jessie Frazelle on 2/21/21. 6 | // 7 | 8 | import Foundation 9 | 10 | // Store data in UserDefaults. 11 | // This allows us to more easily access it later. 12 | extension UserDefaults { 13 | @objc dynamic var onlyShowFollows: Bool { 14 | get { bool(forKey: "onlyShowFollows") } 15 | set { setValue(newValue, forKey: "onlyShowFollows") } 16 | } 17 | 18 | @objc dynamic var githubToken: String { 19 | get { string(forKey: "githubToken") ?? "" } 20 | set { setValue(newValue, forKey: "githubToken") } 21 | } 22 | 23 | @objc dynamic var githubUsername: String { 24 | get { string(forKey: "githubUsername") ?? "" } 25 | set { setValue(newValue, forKey: "githubUsername") } 26 | } 27 | 28 | @objc dynamic var keyCount: Int { 29 | get { integer(forKey: "keyCount") } 30 | set { setValue(newValue, forKey: "keyCount") } 31 | } 32 | 33 | @objc dynamic var keyCountLastUpdated: Date { 34 | get { (object(forKey: "keyCountLastUpdated") as? Date) ?? Date() } 35 | set { setValue(newValue, forKey: "keyCountLastUpdated") } 36 | } 37 | 38 | @objc dynamic var minutes: [Int] { 39 | get { (object(forKey: "minutes") as? [Int]) ?? [Int](repeating:0, count:1440) } 40 | set { setValue(newValue, forKey: "minutes") } 41 | } 42 | 43 | @objc dynamic var keys: [Int] { 44 | get { (object(forKey: "keys") as? [Int]) ?? [Int](repeating:0, count:256) } 45 | set { setValue(newValue, forKey: "keys") } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /mac/Pods/Charts/Source/Charts/Formatters/IndexAxisValueFormatter.swift: -------------------------------------------------------------------------------- 1 | // 2 | // IndexAxisValueFormatter.swift 3 | // Charts 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/Charts 10 | // 11 | 12 | import Foundation 13 | 14 | /// This formatter is used for passing an array of x-axis labels, on whole x steps. 15 | @objc(ChartIndexAxisValueFormatter) 16 | open class IndexAxisValueFormatter: NSObject, IAxisValueFormatter 17 | { 18 | private var _values: [String] = [String]() 19 | private var _valueCount: Int = 0 20 | 21 | @objc public var values: [String] 22 | { 23 | get 24 | { 25 | return _values 26 | } 27 | set 28 | { 29 | _values = newValue 30 | _valueCount = _values.count 31 | } 32 | } 33 | 34 | public override init() 35 | { 36 | super.init() 37 | 38 | } 39 | 40 | @objc public init(values: [String]) 41 | { 42 | super.init() 43 | 44 | self.values = values 45 | } 46 | 47 | @objc public static func with(values: [String]) -> IndexAxisValueFormatter? 48 | { 49 | return IndexAxisValueFormatter(values: values) 50 | } 51 | 52 | open func stringForValue(_ value: Double, 53 | axis: AxisBase?) -> String 54 | { 55 | let index = Int(value.rounded()) 56 | guard values.indices.contains(index), index == Int(value) else { return "" } 57 | return _values[index] 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /mac/keyrace-mac/ContentView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ContentView.swift 3 | // keyrace-mac 4 | // 5 | // Created by Jessie Frazelle on 2/21/21. 6 | // 7 | 8 | import Foundation 9 | import SwiftUI 10 | 11 | struct ContentView: View { 12 | @ObservedObject var keyTap: KeyTap 13 | @ObservedObject var gitHub: GitHub 14 | 15 | var body: some View { 16 | Section { 17 | TypingChart(typingCount: keyTap.minutesChart, color: [255, 253, 86], granularity: 3, 18 | valueFormatter: MinAxisValueFormatter(), labelCount: 0) 19 | .frame(width: 350, height: 100, alignment: .center) 20 | TypingChart(typingCount: keyTap.hoursChart, color: [255, 0, 0], granularity: 3, 21 | valueFormatter: HourAxisValueFormatter(), labelCount: 0 ) 22 | .frame(width: 350, height: 100, alignment: .center) 23 | TypingChart(typingCount: keyTap.keysChart, color: [0, 255, 255], granularity: 1, 24 | valueFormatter: KeyAxisValueFormatter(), labelCount: 25) 25 | .frame(width: 350, height: 100, alignment: .center) 26 | TypingChart(typingCount: keyTap.symbolsChart, color: [0, 255, 255], granularity: 1, 27 | valueFormatter: SymbolAxisValueFormatter(), labelCount: 25) 28 | .frame(width: 350, height: 100, alignment: .center) 29 | .padding(.bottom, 10) 30 | } 31 | Section { 32 | KeyboardView(keyTap: keyTap) 33 | } 34 | Section { 35 | LeaderboardView(keyTap: keyTap, gitHub: gitHub) 36 | } 37 | Section { 38 | SettingsView(keyTap: keyTap, gitHub: gitHub) 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /mac/Pods/Charts/Source/Charts/Formatters/DefaultFillFormatter.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DefaultFillFormatter.swift 3 | // Charts 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/Charts 10 | // 11 | 12 | import Foundation 13 | import CoreGraphics 14 | 15 | /// Default formatter that calculates the position of the filled line. 16 | @objc(ChartDefaultFillFormatter) 17 | open class DefaultFillFormatter: NSObject, IFillFormatter 18 | { 19 | public typealias Block = ( 20 | _ dataSet: ILineChartDataSet, 21 | _ dataProvider: LineChartDataProvider) -> CGFloat 22 | 23 | @objc open var block: Block? 24 | 25 | public override init() { } 26 | 27 | @objc public init(block: @escaping Block) 28 | { 29 | self.block = block 30 | } 31 | 32 | @objc public static func with(block: @escaping Block) -> DefaultFillFormatter? 33 | { 34 | return DefaultFillFormatter(block: block) 35 | } 36 | 37 | open func getFillLinePosition( 38 | dataSet: ILineChartDataSet, 39 | dataProvider: LineChartDataProvider) -> CGFloat 40 | { 41 | guard block == nil else { return block!(dataSet, dataProvider) } 42 | var fillMin: CGFloat = 0.0 43 | 44 | if dataSet.yMax > 0.0 && dataSet.yMin < 0.0 45 | { 46 | fillMin = 0.0 47 | } 48 | else if let data = dataProvider.data 49 | { 50 | let max = data.yMax > 0.0 ? 0.0 : dataProvider.chartYMax 51 | let min = data.yMin < 0.0 ? 0.0 : dataProvider.chartYMin 52 | 53 | fillMin = CGFloat(dataSet.yMin >= 0.0 ? min : max) 54 | } 55 | 56 | return fillMin 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /mac/Pods/Charts/Source/Charts/Renderers/LineRadarRenderer.swift: -------------------------------------------------------------------------------- 1 | // 2 | // LineRadarRenderer.swift 3 | // Charts 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/Charts 10 | // 11 | 12 | import Foundation 13 | import CoreGraphics 14 | 15 | @objc(LineRadarChartRenderer) 16 | open class LineRadarRenderer: LineScatterCandleRadarRenderer 17 | { 18 | public override init(animator: Animator, viewPortHandler: ViewPortHandler) 19 | { 20 | super.init(animator: animator, viewPortHandler: viewPortHandler) 21 | } 22 | 23 | /// Draws the provided path in filled mode with the provided drawable. 24 | @objc open func drawFilledPath(context: CGContext, path: CGPath, fill: Fill, fillAlpha: CGFloat) 25 | { 26 | 27 | context.saveGState() 28 | context.beginPath() 29 | context.addPath(path) 30 | 31 | // filled is usually drawn with less alpha 32 | context.setAlpha(fillAlpha) 33 | 34 | fill.fillPath(context: context, rect: viewPortHandler.contentRect) 35 | 36 | context.restoreGState() 37 | } 38 | 39 | /// Draws the provided path in filled mode with the provided color and alpha. 40 | @objc open func drawFilledPath(context: CGContext, path: CGPath, fillColor: NSUIColor, fillAlpha: CGFloat) 41 | { 42 | context.saveGState() 43 | context.beginPath() 44 | context.addPath(path) 45 | 46 | // filled is usually drawn with less alpha 47 | context.setAlpha(fillAlpha) 48 | 49 | context.setFillColor(fillColor.cgColor) 50 | context.fillPath() 51 | 52 | context.restoreGState() 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /mac/Pods/Charts/Source/Charts/Data/Implementations/Standard/BubbleChartDataSet.swift: -------------------------------------------------------------------------------- 1 | // 2 | // BubbleChartDataSet.swift 3 | // Charts 4 | // 5 | // Bubble chart implementation: 6 | // Copyright 2015 Pierre-Marc Airoldi 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/Charts 10 | // 11 | 12 | import Foundation 13 | import CoreGraphics 14 | 15 | 16 | open class BubbleChartDataSet: BarLineScatterCandleBubbleChartDataSet, IBubbleChartDataSet 17 | { 18 | // MARK: - Data functions and accessors 19 | 20 | internal var _maxSize = CGFloat(0.0) 21 | 22 | open var maxSize: CGFloat { return _maxSize } 23 | @objc open var normalizeSizeEnabled: Bool = true 24 | open var isNormalizeSizeEnabled: Bool { return normalizeSizeEnabled } 25 | 26 | open override func calcMinMax(entry e: ChartDataEntry) 27 | { 28 | guard let e = e as? BubbleChartDataEntry 29 | else { return } 30 | 31 | super.calcMinMax(entry: e) 32 | 33 | let size = e.size 34 | 35 | if size > _maxSize 36 | { 37 | _maxSize = size 38 | } 39 | } 40 | 41 | // MARK: - Styling functions and accessors 42 | 43 | /// Sets/gets the width of the circle that surrounds the bubble when highlighted 44 | open var highlightCircleWidth: CGFloat = 2.5 45 | 46 | // MARK: - NSCopying 47 | 48 | open override func copy(with zone: NSZone? = nil) -> Any 49 | { 50 | let copy = super.copy(with: zone) as! BubbleChartDataSet 51 | copy._xMin = _xMin 52 | copy._xMax = _xMax 53 | copy._maxSize = _maxSize 54 | copy.normalizeSizeEnabled = normalizeSizeEnabled 55 | copy.highlightCircleWidth = highlightCircleWidth 56 | return copy 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /mac/Pods/Charts/Source/Charts/Renderers/LineScatterCandleRadarRenderer.swift: -------------------------------------------------------------------------------- 1 | // 2 | // LineScatterCandleRadarRenderer.swift 3 | // Charts 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/Charts 10 | // 11 | 12 | import Foundation 13 | import CoreGraphics 14 | 15 | @objc(LineScatterCandleRadarChartRenderer) 16 | open class LineScatterCandleRadarRenderer: BarLineScatterCandleBubbleRenderer 17 | { 18 | public override init(animator: Animator, viewPortHandler: ViewPortHandler) 19 | { 20 | super.init(animator: animator, viewPortHandler: viewPortHandler) 21 | } 22 | 23 | /// Draws vertical & horizontal highlight-lines if enabled. 24 | /// :param: context 25 | /// :param: points 26 | /// :param: horizontal 27 | /// :param: vertical 28 | @objc open func drawHighlightLines(context: CGContext, point: CGPoint, set: ILineScatterCandleRadarChartDataSet) 29 | { 30 | 31 | // draw vertical highlight lines 32 | if set.isVerticalHighlightIndicatorEnabled 33 | { 34 | context.beginPath() 35 | context.move(to: CGPoint(x: point.x, y: viewPortHandler.contentTop)) 36 | context.addLine(to: CGPoint(x: point.x, y: viewPortHandler.contentBottom)) 37 | context.strokePath() 38 | } 39 | 40 | // draw horizontal highlight lines 41 | if set.isHorizontalHighlightIndicatorEnabled 42 | { 43 | context.beginPath() 44 | context.move(to: CGPoint(x: viewPortHandler.contentLeft, y: point.y)) 45 | context.addLine(to: CGPoint(x: viewPortHandler.contentRight, y: point.y)) 46 | context.strokePath() 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /mac/Pods/Charts/Source/Charts/Data/Implementations/Standard/RadarChartDataSet.swift: -------------------------------------------------------------------------------- 1 | // 2 | // RadarChartDataSet.swift 3 | // Charts 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/Charts 10 | // 11 | 12 | import Foundation 13 | import CoreGraphics 14 | 15 | 16 | open class RadarChartDataSet: LineRadarChartDataSet, IRadarChartDataSet 17 | { 18 | private func initialize() 19 | { 20 | self.valueFont = NSUIFont.systemFont(ofSize: 13.0) 21 | } 22 | 23 | public required init() 24 | { 25 | super.init() 26 | initialize() 27 | } 28 | 29 | public required override init(entries: [ChartDataEntry]?, label: String?) 30 | { 31 | super.init(entries: entries, label: label) 32 | initialize() 33 | } 34 | 35 | // MARK: - Data functions and accessors 36 | 37 | // MARK: - Styling functions and accessors 38 | 39 | /// flag indicating whether highlight circle should be drawn or not 40 | /// **default**: false 41 | open var drawHighlightCircleEnabled: Bool = false 42 | 43 | /// `true` if highlight circle should be drawn, `false` ifnot 44 | open var isDrawHighlightCircleEnabled: Bool { return drawHighlightCircleEnabled } 45 | 46 | open var highlightCircleFillColor: NSUIColor? = NSUIColor.white 47 | 48 | /// The stroke color for highlight circle. 49 | /// If `nil`, the color of the dataset is taken. 50 | open var highlightCircleStrokeColor: NSUIColor? 51 | 52 | open var highlightCircleStrokeAlpha: CGFloat = 0.3 53 | 54 | open var highlightCircleInnerRadius: CGFloat = 3.0 55 | 56 | open var highlightCircleOuterRadius: CGFloat = 4.0 57 | 58 | open var highlightCircleStrokeWidth: CGFloat = 2.0 59 | } 60 | -------------------------------------------------------------------------------- /mac/Pods/Charts/Source/Charts/Components/IMarker.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ChartMarker.swift 3 | // Charts 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/Charts 10 | // 11 | 12 | import Foundation 13 | import CoreGraphics 14 | 15 | @objc(IChartMarker) 16 | public protocol IMarker: class 17 | { 18 | /// - Returns: The desired (general) offset you wish the IMarker to have on the x-axis. 19 | /// By returning x: -(width / 2) you will center the IMarker horizontally. 20 | /// By returning y: -(height / 2) you will center the IMarker vertically. 21 | var offset: CGPoint { get } 22 | 23 | /// - Parameters: 24 | /// - point: This is the point at which the marker wants to be drawn. You can adjust the offset conditionally based on this argument. 25 | /// - Returns: The offset for drawing at the specific `point`. 26 | /// This allows conditional adjusting of the Marker position. 27 | /// If you have no adjustments to make, return self.offset(). 28 | func offsetForDrawing(atPoint: CGPoint) -> CGPoint 29 | 30 | /// This method enables a custom IMarker to update it's content every time the IMarker is redrawn according to the data entry it points to. 31 | /// 32 | /// - Parameters: 33 | /// - entry: The Entry the IMarker belongs to. This can also be any subclass of Entry, like BarEntry or CandleEntry, simply cast it at runtime. 34 | /// - highlight: The highlight object contains information about the highlighted value such as it's dataset-index, the selected range or stack-index (only stacked bar entries). 35 | func refreshContent(entry: ChartDataEntry, highlight: Highlight) 36 | 37 | /// Draws the IMarker on the given position on the given context 38 | func draw(context: CGContext, point: CGPoint) 39 | } 40 | -------------------------------------------------------------------------------- /mac/Pods/Charts/Source/Charts/Highlight/PieRadarHighlighter.swift: -------------------------------------------------------------------------------- 1 | // 2 | // PieRadarHighlighter.swift 3 | // Charts 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/Charts 10 | // 11 | 12 | import Foundation 13 | import CoreGraphics 14 | 15 | @objc(PieRadarChartHighlighter) 16 | open class PieRadarHighlighter: ChartHighlighter 17 | { 18 | open override func getHighlight(x: CGFloat, y: CGFloat) -> Highlight? 19 | { 20 | guard let chart = self.chart as? PieRadarChartViewBase else { return nil } 21 | 22 | let touchDistanceToCenter = chart.distanceToCenter(x: x, y: y) 23 | 24 | // check if a slice was touched 25 | guard touchDistanceToCenter <= chart.radius else 26 | { 27 | // if no slice was touched, highlight nothing 28 | return nil 29 | } 30 | 31 | var angle = chart.angleForPoint(x: x ,y: y) 32 | 33 | if chart is PieChartView 34 | { 35 | angle /= CGFloat(chart.chartAnimator.phaseY) 36 | } 37 | 38 | let index = chart.indexForAngle(angle) 39 | 40 | // check if the index could be found 41 | if index < 0 || index >= chart.data?.maxEntryCountSet?.entryCount ?? 0 42 | { 43 | return nil 44 | } 45 | else 46 | { 47 | return closestHighlight(index: index, x: x, y: y) 48 | } 49 | 50 | } 51 | 52 | /// - Parameters: 53 | /// - index: 54 | /// - x: 55 | /// - y: 56 | /// - Returns: The closest Highlight object of the given objects based on the touch position inside the chart. 57 | @objc open func closestHighlight(index: Int, x: CGFloat, y: CGFloat) -> Highlight? 58 | { 59 | fatalError("closestHighlight(index, x, y) cannot be called on PieRadarChartHighlighter") 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /mac/Pods/Charts/Source/Charts/Data/Interfaces/ICandleChartDataSet.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ICandleChartDataSet.swift 3 | // Charts 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/Charts 10 | // 11 | 12 | import Foundation 13 | import CoreGraphics 14 | 15 | @objc 16 | public protocol ICandleChartDataSet: ILineScatterCandleRadarChartDataSet 17 | { 18 | // MARK: - Data functions and accessors 19 | 20 | // MARK: - Styling functions and accessors 21 | 22 | /// the space that is left out on the left and right side of each candle, 23 | /// **default**: 0.1 (10%), max 0.45, min 0.0 24 | var barSpace: CGFloat { get set } 25 | 26 | /// should the candle bars show? 27 | /// when false, only "ticks" will show 28 | /// 29 | /// **default**: true 30 | var showCandleBar: Bool { get set } 31 | 32 | /// the width of the candle-shadow-line in pixels. 33 | /// 34 | /// **default**: 3.0 35 | var shadowWidth: CGFloat { get set } 36 | 37 | /// the color of the shadow line 38 | var shadowColor: NSUIColor? { get set } 39 | 40 | /// use candle color for the shadow 41 | var shadowColorSameAsCandle: Bool { get set } 42 | 43 | /// Is the shadow color same as the candle color? 44 | var isShadowColorSameAsCandle: Bool { get } 45 | 46 | /// color for open == close 47 | var neutralColor: NSUIColor? { get set } 48 | 49 | /// color for open > close 50 | var increasingColor: NSUIColor? { get set } 51 | 52 | /// color for open < close 53 | var decreasingColor: NSUIColor? { get set } 54 | 55 | /// Are increasing values drawn as filled? 56 | var increasingFilled: Bool { get set } 57 | 58 | /// Are increasing values drawn as filled? 59 | var isIncreasingFilled: Bool { get } 60 | 61 | /// Are decreasing values drawn as filled? 62 | var decreasingFilled: Bool { get set } 63 | 64 | /// Are decreasing values drawn as filled? 65 | var isDecreasingFilled: Bool { get } 66 | } 67 | -------------------------------------------------------------------------------- /mac/Pods/Charts/Source/Charts/Data/Implementations/Standard/LineScatterCandleRadarChartDataSet.swift: -------------------------------------------------------------------------------- 1 | // 2 | // LineScatterCandleRadarChartDataSet.swift 3 | // Charts 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/Charts 10 | // 11 | 12 | import Foundation 13 | 14 | 15 | open class LineScatterCandleRadarChartDataSet: BarLineScatterCandleBubbleChartDataSet, ILineScatterCandleRadarChartDataSet 16 | { 17 | // MARK: - Data functions and accessors 18 | 19 | // MARK: - Styling functions and accessors 20 | 21 | /// Enables / disables the horizontal highlight-indicator. If disabled, the indicator is not drawn. 22 | open var drawHorizontalHighlightIndicatorEnabled = true 23 | 24 | /// Enables / disables the vertical highlight-indicator. If disabled, the indicator is not drawn. 25 | open var drawVerticalHighlightIndicatorEnabled = true 26 | 27 | /// `true` if horizontal highlight indicator lines are enabled (drawn) 28 | open var isHorizontalHighlightIndicatorEnabled: Bool { return drawHorizontalHighlightIndicatorEnabled } 29 | 30 | /// `true` if vertical highlight indicator lines are enabled (drawn) 31 | open var isVerticalHighlightIndicatorEnabled: Bool { return drawVerticalHighlightIndicatorEnabled } 32 | 33 | /// Enables / disables both vertical and horizontal highlight-indicators. 34 | /// :param: enabled 35 | open func setDrawHighlightIndicators(_ enabled: Bool) 36 | { 37 | drawHorizontalHighlightIndicatorEnabled = enabled 38 | drawVerticalHighlightIndicatorEnabled = enabled 39 | } 40 | 41 | // MARK: NSCopying 42 | 43 | open override func copy(with zone: NSZone? = nil) -> Any 44 | { 45 | let copy = super.copy(with: zone) as! LineScatterCandleRadarChartDataSet 46 | copy.drawHorizontalHighlightIndicatorEnabled = drawHorizontalHighlightIndicatorEnabled 47 | copy.drawVerticalHighlightIndicatorEnabled = drawVerticalHighlightIndicatorEnabled 48 | return copy 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /mac/Pods/Charts/Source/Charts/Components/ChartLimitLine.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ChartLimitLine.swift 3 | // Charts 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/Charts 10 | // 11 | 12 | import Foundation 13 | import CoreGraphics 14 | 15 | 16 | /// The limit line is an additional feature for all Line, Bar and ScatterCharts. 17 | /// It allows the displaying of an additional line in the chart that marks a certain maximum / limit on the specified axis (x- or y-axis). 18 | open class ChartLimitLine: ComponentBase 19 | { 20 | @objc(ChartLimitLabelPosition) 21 | public enum LabelPosition: Int 22 | { 23 | case topLeft 24 | case topRight 25 | case bottomLeft 26 | case bottomRight 27 | } 28 | 29 | /// limit / maximum (the y-value or xIndex) 30 | @objc open var limit = Double(0.0) 31 | 32 | private var _lineWidth = CGFloat(2.0) 33 | @objc open var lineColor = NSUIColor(red: 237.0/255.0, green: 91.0/255.0, blue: 91.0/255.0, alpha: 1.0) 34 | @objc open var lineDashPhase = CGFloat(0.0) 35 | @objc open var lineDashLengths: [CGFloat]? 36 | 37 | @objc open var valueTextColor = NSUIColor.labelOrBlack 38 | @objc open var valueFont = NSUIFont.systemFont(ofSize: 13.0) 39 | 40 | @objc open var drawLabelEnabled = true 41 | @objc open var label = "" 42 | @objc open var labelPosition = LabelPosition.topRight 43 | 44 | public override init() 45 | { 46 | super.init() 47 | } 48 | 49 | @objc public init(limit: Double) 50 | { 51 | super.init() 52 | self.limit = limit 53 | } 54 | 55 | @objc public init(limit: Double, label: String) 56 | { 57 | super.init() 58 | self.limit = limit 59 | self.label = label 60 | } 61 | 62 | /// set the line width of the chart (min = 0.2, max = 12); default 2 63 | @objc open var lineWidth: CGFloat 64 | { 65 | get 66 | { 67 | return _lineWidth 68 | } 69 | set 70 | { 71 | _lineWidth = newValue.clamped(to: 0.2...12) 72 | } 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /mac/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Charts.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 44 | 50 | 51 | 53 | 54 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /mac/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-keyrace-mac.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 44 | 50 | 51 | 53 | 54 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /mac/Pods/Charts/Source/Charts/Jobs/ZoomViewJob.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ZoomViewJob.swift 3 | // Charts 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/Charts 10 | // 11 | 12 | import Foundation 13 | import CoreGraphics 14 | 15 | @objc(ZoomChartViewJob) 16 | open class ZoomViewJob: ViewPortJob 17 | { 18 | internal var scaleX: CGFloat = 0.0 19 | internal var scaleY: CGFloat = 0.0 20 | internal var axisDependency: YAxis.AxisDependency = .left 21 | 22 | @objc public init( 23 | viewPortHandler: ViewPortHandler, 24 | scaleX: CGFloat, 25 | scaleY: CGFloat, 26 | xValue: Double, 27 | yValue: Double, 28 | transformer: Transformer, 29 | axis: YAxis.AxisDependency, 30 | view: ChartViewBase) 31 | { 32 | super.init( 33 | viewPortHandler: viewPortHandler, 34 | xValue: xValue, 35 | yValue: yValue, 36 | transformer: transformer, 37 | view: view) 38 | 39 | self.scaleX = scaleX 40 | self.scaleY = scaleY 41 | self.axisDependency = axis 42 | } 43 | 44 | open override func doJob() 45 | { 46 | guard 47 | let viewPortHandler = viewPortHandler, 48 | let transformer = transformer, 49 | let view = view 50 | else { return } 51 | 52 | var matrix = viewPortHandler.setZoom(scaleX: scaleX, scaleY: scaleY) 53 | viewPortHandler.refresh(newMatrix: matrix, chart: view, invalidate: false) 54 | 55 | let yValsInView = (view as! BarLineChartViewBase).getAxis(axisDependency).axisRange / Double(viewPortHandler.scaleY) 56 | let xValsInView = (view as! BarLineChartViewBase).xAxis.axisRange / Double(viewPortHandler.scaleX) 57 | 58 | var pt = CGPoint( 59 | x: CGFloat(xValue - xValsInView / 2.0), 60 | y: CGFloat(yValue + yValsInView / 2.0) 61 | ) 62 | 63 | transformer.pointValueToPixel(&pt) 64 | 65 | matrix = viewPortHandler.translate(pt: pt) 66 | viewPortHandler.refresh(newMatrix: matrix, chart: view, invalidate: false) 67 | 68 | (view as! BarLineChartViewBase).calculateOffsets() 69 | view.setNeedsDisplay() 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /mac/Pods/Charts/Source/Charts/Highlight/HorizontalBarHighlighter.swift: -------------------------------------------------------------------------------- 1 | // 2 | // HorizontalBarHighlighter.swift 3 | // Charts 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/Charts 10 | // 11 | 12 | import Foundation 13 | import CoreGraphics 14 | 15 | @objc(HorizontalBarChartHighlighter) 16 | open class HorizontalBarHighlighter: BarHighlighter 17 | { 18 | open override func getHighlight(x: CGFloat, y: CGFloat) -> Highlight? 19 | { 20 | guard let barData = self.chart?.data as? BarChartData else { return nil } 21 | 22 | let pos = getValsForTouch(x: y, y: x) 23 | guard let high = getHighlight(xValue: Double(pos.y), x: y, y: x) else { return nil } 24 | 25 | if let set = barData.getDataSetByIndex(high.dataSetIndex) as? IBarChartDataSet, 26 | set.isStacked 27 | { 28 | return getStackedHighlight(high: high, 29 | set: set, 30 | xValue: Double(pos.y), 31 | yValue: Double(pos.x)) 32 | } 33 | 34 | return high 35 | } 36 | 37 | internal override func buildHighlights( 38 | dataSet set: IChartDataSet, 39 | dataSetIndex: Int, 40 | xValue: Double, 41 | rounding: ChartDataSetRounding) -> [Highlight] 42 | { 43 | guard let chart = self.chart as? BarLineScatterCandleBubbleChartDataProvider else { return [] } 44 | 45 | var entries = set.entriesForXValue(xValue) 46 | if entries.count == 0, let closest = set.entryForXValue(xValue, closestToY: .nan, rounding: rounding) 47 | { 48 | // Try to find closest x-value and take all entries for that x-value 49 | entries = set.entriesForXValue(closest.x) 50 | } 51 | 52 | return entries.map { e in 53 | let px = chart.getTransformer(forAxis: set.axisDependency) 54 | .pixelForValues(x: e.y, y: e.x) 55 | return Highlight(x: e.x, y: e.y, xPx: px.x, yPx: px.y, dataSetIndex: dataSetIndex, axis: set.axisDependency) 56 | } 57 | } 58 | 59 | internal override func getDistance(x1: CGFloat, y1: CGFloat, x2: CGFloat, y2: CGFloat) -> CGFloat 60 | { 61 | return abs(y1 - y2) 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /mac/Pods/Charts/Source/Charts/Renderers/Scatter/SquareShapeRenderer.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SquareShapeRenderer.swift 3 | // Charts 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/Charts 10 | // 11 | import Foundation 12 | import CoreGraphics 13 | 14 | open class SquareShapeRenderer : NSObject, IShapeRenderer 15 | { 16 | open func renderShape( 17 | context: CGContext, 18 | dataSet: IScatterChartDataSet, 19 | viewPortHandler: ViewPortHandler, 20 | point: CGPoint, 21 | color: NSUIColor) 22 | { 23 | let shapeSize = dataSet.scatterShapeSize 24 | let shapeHalf = shapeSize / 2.0 25 | let shapeHoleSizeHalf = dataSet.scatterShapeHoleRadius 26 | let shapeHoleSize = shapeHoleSizeHalf * 2.0 27 | let shapeHoleColor = dataSet.scatterShapeHoleColor 28 | let shapeStrokeSize = (shapeSize - shapeHoleSize) / 2.0 29 | let shapeStrokeSizeHalf = shapeStrokeSize / 2.0 30 | 31 | if shapeHoleSize > 0.0 32 | { 33 | context.setStrokeColor(color.cgColor) 34 | context.setLineWidth(shapeStrokeSize) 35 | var rect = CGRect() 36 | rect.origin.x = point.x - shapeHoleSizeHalf - shapeStrokeSizeHalf 37 | rect.origin.y = point.y - shapeHoleSizeHalf - shapeStrokeSizeHalf 38 | rect.size.width = shapeHoleSize + shapeStrokeSize 39 | rect.size.height = shapeHoleSize + shapeStrokeSize 40 | context.stroke(rect) 41 | 42 | if let shapeHoleColor = shapeHoleColor 43 | { 44 | context.setFillColor(shapeHoleColor.cgColor) 45 | rect.origin.x = point.x - shapeHoleSizeHalf 46 | rect.origin.y = point.y - shapeHoleSizeHalf 47 | rect.size.width = shapeHoleSize 48 | rect.size.height = shapeHoleSize 49 | context.fill(rect) 50 | } 51 | } 52 | else 53 | { 54 | context.setFillColor(color.cgColor) 55 | var rect = CGRect() 56 | rect.origin.x = point.x - shapeHalf 57 | rect.origin.y = point.y - shapeHalf 58 | rect.size.width = shapeSize 59 | rect.size.height = shapeSize 60 | context.fill(rect) 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /mac/Pods/Charts/Source/Charts/Data/Interfaces/IPieChartDataSet.swift: -------------------------------------------------------------------------------- 1 | // 2 | // IPieChartDataSet.swift 3 | // Charts 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/Charts 10 | // 11 | 12 | import Foundation 13 | import CoreGraphics 14 | 15 | @objc 16 | public protocol IPieChartDataSet: IChartDataSet 17 | { 18 | // MARK: - Styling functions and accessors 19 | 20 | /// the space in pixels between the pie-slices 21 | /// **default**: 0 22 | /// **maximum**: 20 23 | var sliceSpace: CGFloat { get set } 24 | 25 | /// When enabled, slice spacing will be 0.0 when the smallest value is going to be smaller than the slice spacing itself. 26 | var automaticallyDisableSliceSpacing: Bool { get set } 27 | 28 | /// indicates the selection distance of a pie slice 29 | var selectionShift: CGFloat { get set } 30 | 31 | var xValuePosition: PieChartDataSet.ValuePosition { get set } 32 | var yValuePosition: PieChartDataSet.ValuePosition { get set } 33 | 34 | /// When valuePosition is OutsideSlice, indicates line color 35 | var valueLineColor: NSUIColor? { get set } 36 | 37 | /// When valuePosition is OutsideSlice and enabled, line will have the same color as the slice 38 | var useValueColorForLine: Bool { get set } 39 | 40 | /// When valuePosition is OutsideSlice, indicates line width 41 | var valueLineWidth: CGFloat { get set } 42 | 43 | /// When valuePosition is OutsideSlice, indicates offset as percentage out of the slice size 44 | var valueLinePart1OffsetPercentage: CGFloat { get set } 45 | 46 | /// When valuePosition is OutsideSlice, indicates length of first half of the line 47 | var valueLinePart1Length: CGFloat { get set } 48 | 49 | /// When valuePosition is OutsideSlice, indicates length of second half of the line 50 | var valueLinePart2Length: CGFloat { get set } 51 | 52 | /// When valuePosition is OutsideSlice, this allows variable line length 53 | var valueLineVariableLength: Bool { get set } 54 | 55 | /// the font for the slice-text labels 56 | var entryLabelFont: NSUIFont? { get set } 57 | 58 | /// the color for the slice-text labels 59 | var entryLabelColor: NSUIColor? { get set } 60 | 61 | /// get/sets the color for the highlighted sector 62 | var highlightColor: NSUIColor? { get set } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /mac/Pods/Charts/Source/Charts/Renderers/Scatter/CircleShapeRenderer.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CircleShapeRenderer.swift 3 | // Charts 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/Charts 10 | // 11 | import Foundation 12 | import CoreGraphics 13 | 14 | open class CircleShapeRenderer : NSObject, IShapeRenderer 15 | { 16 | open func renderShape( 17 | context: CGContext, 18 | dataSet: IScatterChartDataSet, 19 | viewPortHandler: ViewPortHandler, 20 | point: CGPoint, 21 | color: NSUIColor) 22 | { 23 | let shapeSize = dataSet.scatterShapeSize 24 | let shapeHalf = shapeSize / 2.0 25 | let shapeHoleSizeHalf = dataSet.scatterShapeHoleRadius 26 | let shapeHoleSize = shapeHoleSizeHalf * 2.0 27 | let shapeHoleColor = dataSet.scatterShapeHoleColor 28 | let shapeStrokeSize = (shapeSize - shapeHoleSize) / 2.0 29 | let shapeStrokeSizeHalf = shapeStrokeSize / 2.0 30 | 31 | if shapeHoleSize > 0.0 32 | { 33 | context.setStrokeColor(color.cgColor) 34 | context.setLineWidth(shapeStrokeSize) 35 | var rect = CGRect() 36 | rect.origin.x = point.x - shapeHoleSizeHalf - shapeStrokeSizeHalf 37 | rect.origin.y = point.y - shapeHoleSizeHalf - shapeStrokeSizeHalf 38 | rect.size.width = shapeHoleSize + shapeStrokeSize 39 | rect.size.height = shapeHoleSize + shapeStrokeSize 40 | context.strokeEllipse(in: rect) 41 | 42 | if let shapeHoleColor = shapeHoleColor 43 | { 44 | context.setFillColor(shapeHoleColor.cgColor) 45 | rect.origin.x = point.x - shapeHoleSizeHalf 46 | rect.origin.y = point.y - shapeHoleSizeHalf 47 | rect.size.width = shapeHoleSize 48 | rect.size.height = shapeHoleSize 49 | context.fillEllipse(in: rect) 50 | } 51 | } 52 | else 53 | { 54 | context.setFillColor(color.cgColor) 55 | var rect = CGRect() 56 | rect.origin.x = point.x - shapeHalf 57 | rect.origin.y = point.y - shapeHalf 58 | rect.size.width = shapeSize 59 | rect.size.height = shapeSize 60 | context.fillEllipse(in: rect) 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /mac/Pods/Charts/Source/Charts/Data/Implementations/Standard/BubbleChartDataEntry.swift: -------------------------------------------------------------------------------- 1 | // 2 | // BubbleDataEntry.swift 3 | // Charts 4 | // 5 | // Bubble chart implementation: 6 | // Copyright 2015 Pierre-Marc Airoldi 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/Charts 10 | // 11 | 12 | import Foundation 13 | import CoreGraphics 14 | 15 | open class BubbleChartDataEntry: ChartDataEntry 16 | { 17 | /// The size of the bubble. 18 | @objc open var size = CGFloat(0.0) 19 | 20 | public required init() 21 | { 22 | super.init() 23 | } 24 | 25 | /// - Parameters: 26 | /// - x: The index on the x-axis. 27 | /// - y: The value on the y-axis. 28 | /// - size: The size of the bubble. 29 | @objc public init(x: Double, y: Double, size: CGFloat) 30 | { 31 | super.init(x: x, y: y) 32 | 33 | self.size = size 34 | } 35 | 36 | /// - Parameters: 37 | /// - x: The index on the x-axis. 38 | /// - y: The value on the y-axis. 39 | /// - size: The size of the bubble. 40 | /// - data: Spot for additional data this Entry represents. 41 | @objc public convenience init(x: Double, y: Double, size: CGFloat, data: Any?) 42 | { 43 | self.init(x: x, y: y, size: size) 44 | self.data = data 45 | } 46 | 47 | /// - Parameters: 48 | /// - x: The index on the x-axis. 49 | /// - y: The value on the y-axis. 50 | /// - size: The size of the bubble. 51 | /// - icon: icon image 52 | @objc public convenience init(x: Double, y: Double, size: CGFloat, icon: NSUIImage?) 53 | { 54 | self.init(x: x, y: y, size: size) 55 | self.icon = icon 56 | } 57 | 58 | /// - Parameters: 59 | /// - x: The index on the x-axis. 60 | /// - y: The value on the y-axis. 61 | /// - size: The size of the bubble. 62 | /// - icon: icon image 63 | /// - data: Spot for additional data this Entry represents. 64 | @objc public convenience init(x: Double, y: Double, size: CGFloat, icon: NSUIImage?, data: Any?) 65 | { 66 | self.init(x: x, y: y, size: size) 67 | self.icon = icon 68 | self.data = data 69 | } 70 | 71 | // MARK: NSCopying 72 | 73 | open override func copy(with zone: NSZone? = nil) -> Any 74 | { 75 | let copy = super.copy(with: zone) as! BubbleChartDataEntry 76 | copy.size = size 77 | return copy 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /mac/Pods/Charts/Source/Charts/Highlight/CombinedHighlighter.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CombinedHighlighter.swift 3 | // Charts 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/Charts 10 | // 11 | 12 | import Foundation 13 | import CoreGraphics 14 | 15 | @objc(CombinedChartHighlighter) 16 | open class CombinedHighlighter: ChartHighlighter 17 | { 18 | /// bar highlighter for supporting stacked highlighting 19 | private var barHighlighter: BarHighlighter? 20 | 21 | @objc public init(chart: CombinedChartDataProvider, barDataProvider: BarChartDataProvider) 22 | { 23 | super.init(chart: chart) 24 | 25 | // if there is BarData, create a BarHighlighter 26 | self.barHighlighter = barDataProvider.barData == nil ? nil : BarHighlighter(chart: barDataProvider) 27 | } 28 | 29 | open override func getHighlights(xValue: Double, x: CGFloat, y: CGFloat) -> [Highlight] 30 | { 31 | var vals = [Highlight]() 32 | 33 | guard 34 | let chart = self.chart as? CombinedChartDataProvider, 35 | let dataObjects = chart.combinedData?.allData 36 | else { return vals } 37 | 38 | for i in 0.. Bool { 87 | guard let object = object as? ChartDataEntryBase else { return false } 88 | 89 | if self === object 90 | { 91 | return true 92 | } 93 | 94 | return y == object.y 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /mac/keyrace-mac/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // keyrace-mac 3 | // 4 | // Created by Nat Friedman on 1/2/21. 5 | // 6 | 7 | import Cocoa 8 | import Foundation 9 | import SwiftUI 10 | 11 | @available(OSX 11.0, *) 12 | @main 13 | struct MenuBarPopoverApp: App { 14 | @NSApplicationDelegateAdaptor(AppDelegate.self) var appDelegate 15 | var body: some Scene { 16 | Settings{ 17 | EmptyView() 18 | } 19 | } 20 | } 21 | 22 | class AppDelegate: NSObject, NSApplicationDelegate { 23 | var popover: NSPopover! 24 | var statusBarItem: NSStatusItem! 25 | var keyTap : KeyTap? 26 | var gitHub : GitHub? 27 | 28 | func applicationDidFinishLaunching(_ aNotification: Notification) { 29 | // Create the status item. 30 | self.statusBarItem = NSStatusBar.system.statusItem(withLength: CGFloat(NSStatusItem.variableLength)) 31 | if let button = self.statusBarItem.button { 32 | button.title = "Setup Keyrace" 33 | let clickGesture = NSClickGestureRecognizer(target: self, action: #selector(togglePopover)) 34 | button.addGestureRecognizer(clickGesture) 35 | } 36 | 37 | // Initialize these things so we can pass them to the ContentView(). 38 | gitHub = GitHub() 39 | keyTap = KeyTap(self) 40 | 41 | keyTap!.getAccessibilityPermissions() 42 | 43 | // Create the SwiftUI view that provides the window contents. 44 | let contentView = ContentView(keyTap: keyTap!, gitHub: gitHub!) 45 | 46 | // Create the popover 47 | let popover = NSPopover() 48 | popover.contentSize = NSSize(width: 350, height: 1000) 49 | popover.behavior = .transient 50 | popover.contentViewController = NSHostingController(rootView: contentView) 51 | self.popover = popover 52 | 53 | NSApp.activate(ignoringOtherApps: true) 54 | } 55 | 56 | @objc func togglePopover(_ sender: AnyObject?) { 57 | if let button = self.statusBarItem.button { 58 | if self.popover.isShown { 59 | self.popover.performClose(sender) 60 | } else { 61 | let sizeThatFits = (self.popover.contentViewController as? NSHostingController)?.sizeThatFits(in: CGSize(width: 350, height: 0)) 62 | if sizeThatFits != nil { 63 | self.popover.contentSize = sizeThatFits! 64 | } 65 | 66 | self.popover.show(relativeTo: button.bounds, of: button, preferredEdge: NSRectEdge.minY) 67 | } 68 | } 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /mac/Pods/Charts/Source/Charts/Data/Implementations/Standard/LineRadarChartDataSet.swift: -------------------------------------------------------------------------------- 1 | // 2 | // LineRadarChartDataSet.swift 3 | // Charts 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/Charts 10 | // 11 | 12 | import Foundation 13 | import CoreGraphics 14 | 15 | 16 | open class LineRadarChartDataSet: LineScatterCandleRadarChartDataSet, ILineRadarChartDataSet 17 | { 18 | // MARK: - Data functions and accessors 19 | 20 | // MARK: - Styling functions and accessors 21 | 22 | /// The color that is used for filling the line surface area. 23 | private var _fillColor = NSUIColor(red: 140.0/255.0, green: 234.0/255.0, blue: 255.0/255.0, alpha: 1.0) 24 | 25 | /// The color that is used for filling the line surface area. 26 | open var fillColor: NSUIColor 27 | { 28 | get { return _fillColor } 29 | set 30 | { 31 | _fillColor = newValue 32 | fill = nil 33 | } 34 | } 35 | 36 | /// The object that is used for filling the area below the line. 37 | /// **default**: nil 38 | open var fill: Fill? 39 | 40 | /// The alpha value that is used for filling the line surface, 41 | /// **default**: 0.33 42 | open var fillAlpha = CGFloat(0.33) 43 | 44 | private var _lineWidth = CGFloat(1.0) 45 | 46 | /// line width of the chart (min = 0.0, max = 10) 47 | /// 48 | /// **default**: 1 49 | open var lineWidth: CGFloat 50 | { 51 | get 52 | { 53 | return _lineWidth 54 | } 55 | set 56 | { 57 | _lineWidth = newValue.clamped(to: 0...10) 58 | } 59 | } 60 | 61 | /// Set to `true` if the DataSet should be drawn filled (surface), and not just as a line. 62 | /// Disabling this will give great performance boost. 63 | /// Please note that this method uses the path clipping for drawing the filled area (with images, gradients and layers). 64 | open var drawFilledEnabled = false 65 | 66 | /// `true` if filled drawing is enabled, `false` ifnot 67 | open var isDrawFilledEnabled: Bool 68 | { 69 | return drawFilledEnabled 70 | } 71 | 72 | // MARK: NSCopying 73 | 74 | open override func copy(with zone: NSZone? = nil) -> Any 75 | { 76 | let copy = super.copy(with: zone) as! LineRadarChartDataSet 77 | copy.fill = fill 78 | copy.fillAlpha = fillAlpha 79 | copy._fillColor = _fillColor 80 | copy._lineWidth = _lineWidth 81 | copy.drawFilledEnabled = drawFilledEnabled 82 | return copy 83 | } 84 | 85 | } 86 | -------------------------------------------------------------------------------- /mac/Pods/Charts/Source/Charts/Highlight/RadarHighlighter.swift: -------------------------------------------------------------------------------- 1 | // 2 | // RadarHighlighter.swift 3 | // Charts 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/Charts 10 | // 11 | 12 | import Foundation 13 | import CoreGraphics 14 | 15 | @objc(RadarChartHighlighter) 16 | open class RadarHighlighter: PieRadarHighlighter 17 | { 18 | open override func closestHighlight(index: Int, x: CGFloat, y: CGFloat) -> Highlight? 19 | { 20 | guard let chart = self.chart as? RadarChartView else { return nil } 21 | 22 | let highlights = getHighlights(forIndex: index) 23 | 24 | let distanceToCenter = Double(chart.distanceToCenter(x: x, y: y) / chart.factor) 25 | 26 | var closest: Highlight? 27 | var distance = Double.greatestFiniteMagnitude 28 | 29 | for high in highlights 30 | { 31 | let cdistance = abs(high.y - distanceToCenter) 32 | if cdistance < distance 33 | { 34 | closest = high 35 | distance = cdistance 36 | } 37 | } 38 | 39 | return closest 40 | } 41 | 42 | /// - Parameters: 43 | /// - index: 44 | /// - Returns: An array of Highlight objects for the given index. 45 | /// The Highlight objects give information about the value at the selected index and DataSet it belongs to. 46 | internal func getHighlights(forIndex index: Int) -> [Highlight] 47 | { 48 | var vals = [Highlight]() 49 | 50 | guard 51 | let chart = self.chart as? RadarChartView, 52 | let chartData = chart.data 53 | else { return vals } 54 | 55 | let phaseX = chart.chartAnimator.phaseX 56 | let phaseY = chart.chartAnimator.phaseY 57 | let sliceangle = chart.sliceAngle 58 | let factor = chart.factor 59 | 60 | for i in chartData.dataSets.indices 61 | { 62 | guard 63 | let dataSet = chartData.getDataSetByIndex(i), 64 | let entry = dataSet.entryForIndex(index) 65 | else { continue } 66 | 67 | let y = (entry.y - chart.chartYMin) 68 | 69 | let p = chart.centerOffsets.moving(distance: CGFloat(y) * factor * CGFloat(phaseY), 70 | atAngle: sliceangle * CGFloat(index) * CGFloat(phaseX) + chart.rotationAngle) 71 | 72 | let highlight = Highlight(x: Double(index), y: entry.y, xPx: p.x, yPx: p.y, dataSetIndex: i, axis: dataSet.axisDependency) 73 | vals.append(highlight) 74 | } 75 | 76 | return vals 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /mac/Pods/Charts/Source/Charts/Components/XAxis.swift: -------------------------------------------------------------------------------- 1 | // 2 | // XAxis.swift 3 | // Charts 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/Charts 10 | // 11 | 12 | import Foundation 13 | import CoreGraphics 14 | 15 | @objc(ChartXAxis) 16 | open class XAxis: AxisBase 17 | { 18 | @objc(XAxisLabelPosition) 19 | public enum LabelPosition: Int 20 | { 21 | case top 22 | case bottom 23 | case bothSided 24 | case topInside 25 | case bottomInside 26 | } 27 | 28 | /// width of the x-axis labels in pixels - this is automatically calculated by the `computeSize()` methods in the renderers 29 | @objc open var labelWidth = CGFloat(1.0) 30 | 31 | /// height of the x-axis labels in pixels - this is automatically calculated by the `computeSize()` methods in the renderers 32 | @objc open var labelHeight = CGFloat(1.0) 33 | 34 | /// width of the (rotated) x-axis labels in pixels - this is automatically calculated by the `computeSize()` methods in the renderers 35 | @objc open var labelRotatedWidth = CGFloat(1.0) 36 | 37 | /// height of the (rotated) x-axis labels in pixels - this is automatically calculated by the `computeSize()` methods in the renderers 38 | @objc open var labelRotatedHeight = CGFloat(1.0) 39 | 40 | /// This is the angle for drawing the X axis labels (in degrees) 41 | @objc open var labelRotationAngle = CGFloat(0.0) 42 | 43 | /// if set to true, the chart will avoid that the first and last label entry in the chart "clip" off the edge of the chart 44 | @objc open var avoidFirstLastClippingEnabled = false 45 | 46 | /// the position of the x-labels relative to the chart 47 | @objc open var labelPosition = LabelPosition.top 48 | 49 | /// if set to true, word wrapping the labels will be enabled. 50 | /// word wrapping is done using `(value width * labelRotatedWidth)` 51 | /// 52 | /// - Note: currently supports all charts except pie/radar/horizontal-bar* 53 | @objc open var wordWrapEnabled = false 54 | 55 | /// `true` if word wrapping the labels is enabled 56 | @objc open var isWordWrapEnabled: Bool { return wordWrapEnabled } 57 | 58 | /// the width for wrapping the labels, as percentage out of one value width. 59 | /// used only when isWordWrapEnabled = true. 60 | /// 61 | /// **default**: 1.0 62 | @objc open var wordWrapWidthPercent: CGFloat = 1.0 63 | 64 | public override init() 65 | { 66 | super.init() 67 | 68 | self.yOffset = 4.0 69 | } 70 | 71 | @objc open var isAvoidFirstLastClippingEnabled: Bool 72 | { 73 | return avoidFirstLastClippingEnabled 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /mac/Pods/Charts/Source/Charts/Data/Implementations/Standard/ScatterChartDataSet.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ScatterChartDataSet.swift 3 | // Charts 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/Charts 10 | // 11 | 12 | import Foundation 13 | import CoreGraphics 14 | 15 | open class ScatterChartDataSet: LineScatterCandleRadarChartDataSet, IScatterChartDataSet 16 | { 17 | 18 | @objc(ScatterShape) 19 | public enum Shape: Int 20 | { 21 | case square 22 | case circle 23 | case triangle 24 | case cross 25 | case x 26 | case chevronUp 27 | case chevronDown 28 | } 29 | 30 | /// The size the scatter shape will have 31 | open var scatterShapeSize = CGFloat(10.0) 32 | 33 | /// The radius of the hole in the shape (applies to Square, Circle and Triangle) 34 | /// **default**: 0.0 35 | open var scatterShapeHoleRadius: CGFloat = 0.0 36 | 37 | /// Color for the hole in the shape. Setting to `nil` will behave as transparent. 38 | /// **default**: nil 39 | open var scatterShapeHoleColor: NSUIColor? = nil 40 | 41 | /// Sets the ScatterShape this DataSet should be drawn with. 42 | /// This will search for an available IShapeRenderer and set this renderer for the DataSet 43 | @objc open func setScatterShape(_ shape: Shape) 44 | { 45 | self.shapeRenderer = ScatterChartDataSet.renderer(forShape: shape) 46 | } 47 | 48 | /// The IShapeRenderer responsible for rendering this DataSet. 49 | /// This can also be used to set a custom IShapeRenderer aside from the default ones. 50 | /// **default**: `SquareShapeRenderer` 51 | open var shapeRenderer: IShapeRenderer? = SquareShapeRenderer() 52 | 53 | @objc open class func renderer(forShape shape: Shape) -> IShapeRenderer 54 | { 55 | switch shape 56 | { 57 | case .square: return SquareShapeRenderer() 58 | case .circle: return CircleShapeRenderer() 59 | case .triangle: return TriangleShapeRenderer() 60 | case .cross: return CrossShapeRenderer() 61 | case .x: return XShapeRenderer() 62 | case .chevronUp: return ChevronUpShapeRenderer() 63 | case .chevronDown: return ChevronDownShapeRenderer() 64 | } 65 | } 66 | 67 | // MARK: NSCopying 68 | 69 | open override func copy(with zone: NSZone? = nil) -> Any 70 | { 71 | let copy = super.copy(with: zone) as! ScatterChartDataSet 72 | copy.scatterShapeSize = scatterShapeSize 73 | copy.scatterShapeHoleRadius = scatterShapeHoleRadius 74 | copy.scatterShapeHoleColor = scatterShapeHoleColor 75 | copy.shapeRenderer = shapeRenderer 76 | return copy 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /mac/Pods/Charts/Source/Charts/Renderers/Scatter/TriangleShapeRenderer.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TriangleShapeRenderer.swift 3 | // Charts 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/Charts 10 | // 11 | import Foundation 12 | import CoreGraphics 13 | 14 | open class TriangleShapeRenderer : NSObject, IShapeRenderer 15 | { 16 | open func renderShape( 17 | context: CGContext, 18 | dataSet: IScatterChartDataSet, 19 | viewPortHandler: ViewPortHandler, 20 | point: CGPoint, 21 | color: NSUIColor) 22 | { 23 | let shapeSize = dataSet.scatterShapeSize 24 | let shapeHalf = shapeSize / 2.0 25 | let shapeHoleSizeHalf = dataSet.scatterShapeHoleRadius 26 | let shapeHoleSize = shapeHoleSizeHalf * 2.0 27 | let shapeHoleColor = dataSet.scatterShapeHoleColor 28 | let shapeStrokeSize = (shapeSize - shapeHoleSize) / 2.0 29 | 30 | context.setFillColor(color.cgColor) 31 | 32 | // create a triangle path 33 | context.beginPath() 34 | context.move(to: CGPoint(x: point.x, y: point.y - shapeHalf)) 35 | context.addLine(to: CGPoint(x: point.x + shapeHalf, y: point.y + shapeHalf)) 36 | context.addLine(to: CGPoint(x: point.x - shapeHalf, y: point.y + shapeHalf)) 37 | 38 | if shapeHoleSize > 0.0 39 | { 40 | context.addLine(to: CGPoint(x: point.x, y: point.y - shapeHalf)) 41 | 42 | context.move(to: CGPoint(x: point.x - shapeHalf + shapeStrokeSize, y: point.y + shapeHalf - shapeStrokeSize)) 43 | context.addLine(to: CGPoint(x: point.x + shapeHalf - shapeStrokeSize, y: point.y + shapeHalf - shapeStrokeSize)) 44 | context.addLine(to: CGPoint(x: point.x, y: point.y - shapeHalf + shapeStrokeSize)) 45 | context.addLine(to: CGPoint(x: point.x - shapeHalf + shapeStrokeSize, y: point.y + shapeHalf - shapeStrokeSize)) 46 | } 47 | 48 | context.closePath() 49 | 50 | context.fillPath() 51 | 52 | if shapeHoleSize > 0.0 && shapeHoleColor != nil 53 | { 54 | context.setFillColor(shapeHoleColor!.cgColor) 55 | 56 | // create a triangle path 57 | context.beginPath() 58 | context.move(to: CGPoint(x: point.x, y: point.y - shapeHalf + shapeStrokeSize)) 59 | context.addLine(to: CGPoint(x: point.x + shapeHalf - shapeStrokeSize, y: point.y + shapeHalf - shapeStrokeSize)) 60 | context.addLine(to: CGPoint(x: point.x - shapeHalf + shapeStrokeSize, y: point.y + shapeHalf - shapeStrokeSize)) 61 | context.closePath() 62 | 63 | context.fillPath() 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /mac/Pods/Charts/Source/Charts/Formatters/DefaultAxisValueFormatter.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DefaultAxisValueFormatter.swift 3 | // Charts 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/Charts 10 | // 11 | 12 | import Foundation 13 | 14 | @objc(ChartDefaultAxisValueFormatter) 15 | open class DefaultAxisValueFormatter: NSObject, IAxisValueFormatter 16 | { 17 | public typealias Block = ( 18 | _ value: Double, 19 | _ axis: AxisBase?) -> String 20 | 21 | @objc open var block: Block? 22 | 23 | @objc open var hasAutoDecimals: Bool = false 24 | 25 | private var _formatter: NumberFormatter? 26 | @objc open var formatter: NumberFormatter? 27 | { 28 | get { return _formatter } 29 | set 30 | { 31 | hasAutoDecimals = false 32 | _formatter = newValue 33 | } 34 | } 35 | 36 | // TODO: Documentation. Especially the nil case 37 | private var _decimals: Int? 38 | open var decimals: Int? 39 | { 40 | get { return _decimals } 41 | set 42 | { 43 | _decimals = newValue 44 | 45 | if let digits = newValue 46 | { 47 | self.formatter?.minimumFractionDigits = digits 48 | self.formatter?.maximumFractionDigits = digits 49 | self.formatter?.usesGroupingSeparator = true 50 | } 51 | } 52 | } 53 | 54 | public override init() 55 | { 56 | super.init() 57 | 58 | self.formatter = NumberFormatter() 59 | hasAutoDecimals = true 60 | } 61 | 62 | @objc public init(formatter: NumberFormatter) 63 | { 64 | super.init() 65 | 66 | self.formatter = formatter 67 | } 68 | 69 | @objc public init(decimals: Int) 70 | { 71 | super.init() 72 | 73 | self.formatter = NumberFormatter() 74 | self.formatter?.usesGroupingSeparator = true 75 | self.decimals = decimals 76 | hasAutoDecimals = true 77 | } 78 | 79 | @objc public init(block: @escaping Block) 80 | { 81 | super.init() 82 | 83 | self.block = block 84 | } 85 | 86 | @objc public static func with(block: @escaping Block) -> DefaultAxisValueFormatter? 87 | { 88 | return DefaultAxisValueFormatter(block: block) 89 | } 90 | 91 | open func stringForValue(_ value: Double, 92 | axis: AxisBase?) -> String 93 | { 94 | if let block = block { 95 | return block(value, axis) 96 | } else { 97 | return formatter?.string(from: NSNumber(floatLiteral: value)) ?? "" 98 | } 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /mac/Pods/Charts/Source/Charts/Data/Implementations/Standard/CandleChartDataEntry.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CandleChartDataEntry.swift 3 | // Charts 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/Charts 10 | // 11 | 12 | import Foundation 13 | 14 | open class CandleChartDataEntry: ChartDataEntry 15 | { 16 | /// shadow-high value 17 | @objc open var high = Double(0.0) 18 | 19 | /// shadow-low value 20 | @objc open var low = Double(0.0) 21 | 22 | /// close value 23 | @objc open var close = Double(0.0) 24 | 25 | /// open value 26 | @objc open var open = Double(0.0) 27 | 28 | public required init() 29 | { 30 | super.init() 31 | } 32 | 33 | @objc public init(x: Double, shadowH: Double, shadowL: Double, open: Double, close: Double) 34 | { 35 | super.init(x: x, y: (shadowH + shadowL) / 2.0) 36 | 37 | self.high = shadowH 38 | self.low = shadowL 39 | self.open = open 40 | self.close = close 41 | } 42 | 43 | @objc public convenience init(x: Double, shadowH: Double, shadowL: Double, open: Double, close: Double, icon: NSUIImage?) 44 | { 45 | self.init(x: x, shadowH: shadowH, shadowL: shadowL, open: open, close: close) 46 | self.icon = icon 47 | } 48 | 49 | @objc public convenience init(x: Double, shadowH: Double, shadowL: Double, open: Double, close: Double, data: Any?) 50 | { 51 | self.init(x: x, shadowH: shadowH, shadowL: shadowL, open: open, close: close) 52 | self.data = data 53 | } 54 | 55 | @objc public convenience init(x: Double, shadowH: Double, shadowL: Double, open: Double, close: Double, icon: NSUIImage?, data: Any?) 56 | { 57 | self.init(x: x, shadowH: shadowH, shadowL: shadowL, open: open, close: close) 58 | self.icon = icon 59 | self.data = data 60 | } 61 | 62 | /// The overall range (difference) between shadow-high and shadow-low. 63 | @objc open var shadowRange: Double 64 | { 65 | return abs(high - low) 66 | } 67 | 68 | /// The body size (difference between open and close). 69 | @objc open var bodyRange: Double 70 | { 71 | return abs(open - close) 72 | } 73 | 74 | /// the center value of the candle. (Middle value between high and low) 75 | open override var y: Double 76 | { 77 | get 78 | { 79 | return super.y 80 | } 81 | set 82 | { 83 | super.y = (high + low) / 2.0 84 | } 85 | } 86 | 87 | // MARK: NSCopying 88 | 89 | open override func copy(with zone: NSZone? = nil) -> Any 90 | { 91 | let copy = super.copy(with: zone) as! CandleChartDataEntry 92 | copy.high = high 93 | copy.low = low 94 | copy.open = open 95 | copy.close = close 96 | return copy 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /mac/Pods/Charts/Source/Charts/Data/Interfaces/ILineChartDataSet.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ILineChartDataSet.swift 3 | // Charts 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/Charts 10 | // 11 | 12 | import Foundation 13 | import CoreGraphics 14 | 15 | 16 | @objc 17 | public protocol ILineChartDataSet: ILineRadarChartDataSet 18 | { 19 | // MARK: - Data functions and accessors 20 | 21 | // MARK: - Styling functions and accessors 22 | 23 | /// The drawing mode for this line dataset 24 | /// 25 | /// **default**: Linear 26 | var mode: LineChartDataSet.Mode { get set } 27 | 28 | /// Intensity for cubic lines (min = 0.05, max = 1) 29 | /// 30 | /// **default**: 0.2 31 | var cubicIntensity: CGFloat { get set } 32 | 33 | /// The radius of the drawn circles. 34 | var circleRadius: CGFloat { get set } 35 | 36 | /// The hole radius of the drawn circles. 37 | var circleHoleRadius: CGFloat { get set } 38 | 39 | var circleColors: [NSUIColor] { get set } 40 | 41 | /// - Returns: The color at the given index of the DataSet's circle-color array. 42 | /// Performs a IndexOutOfBounds check by modulus. 43 | func getCircleColor(atIndex: Int) -> NSUIColor? 44 | 45 | /// Sets the one and ONLY color that should be used for this DataSet. 46 | /// Internally, this recreates the colors array and adds the specified color. 47 | func setCircleColor(_ color: NSUIColor) 48 | 49 | /// Resets the circle-colors array and creates a new one 50 | func resetCircleColors(_ index: Int) 51 | 52 | /// If true, drawing circles is enabled 53 | var drawCirclesEnabled: Bool { get set } 54 | 55 | /// `true` if drawing circles for this DataSet is enabled, `false` ifnot 56 | var isDrawCirclesEnabled: Bool { get } 57 | 58 | /// The color of the inner circle (the circle-hole). 59 | var circleHoleColor: NSUIColor? { get set } 60 | 61 | /// `true` if drawing circles for this DataSet is enabled, `false` ifnot 62 | var drawCircleHoleEnabled: Bool { get set } 63 | 64 | /// `true` if drawing the circle-holes is enabled, `false` ifnot. 65 | var isDrawCircleHoleEnabled: Bool { get } 66 | 67 | /// This is how much (in pixels) into the dash pattern are we starting from. 68 | var lineDashPhase: CGFloat { get } 69 | 70 | /// This is the actual dash pattern. 71 | /// I.e. [2, 3] will paint [-- -- ] 72 | /// [1, 3, 4, 2] will paint [- ---- - ---- ] 73 | var lineDashLengths: [CGFloat]? { get set } 74 | 75 | /// Line cap type, default is CGLineCap.Butt 76 | var lineCapType: CGLineCap { get set } 77 | 78 | /// Sets a custom IFillFormatter to the chart that handles the position of the filled-line for each DataSet. Set this to null to use the default logic. 79 | var fillFormatter: IFillFormatter? { get set } 80 | } 81 | -------------------------------------------------------------------------------- /mac/keyrace-mac/SettingsView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SettingsView.swift 3 | // keyrace-mac 4 | // 5 | // Created by Jessie Frazelle on 2/16/21. 6 | // 7 | 8 | import Foundation 9 | import SwiftUI 10 | 11 | struct SettingsView: View { 12 | @ObservedObject var keyTap: KeyTap 13 | @ObservedObject var gitHub: GitHub 14 | @AppStorage("onlyShowFollows") private var onlyShowFollows = UserDefaults.standard.onlyShowFollows 15 | 16 | var body: some View { 17 | Menu("Settings") { 18 | if !gitHub.username.isEmpty { 19 | Toggle("Only show users I follow", isOn: $onlyShowFollows) 20 | Text("Logged in as @" + gitHub.username) 21 | Button("Logout") { 22 | logout() 23 | } 24 | } else { 25 | Button("Login with GitHub") { 26 | login() 27 | } 28 | } 29 | 30 | Button("Quit") { 31 | quit() 32 | } 33 | } 34 | .menuStyle(BorderlessButtonMenuStyle()) 35 | .padding(.leading, 10) 36 | .padding(.trailing, 10) 37 | .padding(.bottom, 10) 38 | } 39 | 40 | func logout() { 41 | // Nullify the githubUsername and githubToken. 42 | UserDefaults.standard.githubUsername = "" 43 | UserDefaults.standard.githubToken = "" 44 | } 45 | 46 | func login() { 47 | if !gitHub.token.isEmpty { 48 | gitHub.getUserName() 49 | return 50 | } 51 | 52 | let alert = NSAlert() 53 | alert.messageText = "Login with GitHub" 54 | 55 | DispatchQueue.global(qos: .background).async { 56 | let (userCode, verificationUri) = self.gitHub.startDeviceAuth(clientId: "a945f87ad537bfddb109", scope: "") 57 | 58 | if (userCode == "") { 59 | alert.informativeText = "Could not contact GitHub. Try again later." 60 | alert.addButton(withTitle: "Ok") 61 | alert.runModal() 62 | return 63 | } 64 | 65 | DispatchQueue.main.async { 66 | alert.informativeText = "Your GitHub device code is \(userCode)" 67 | alert.addButton(withTitle: "Copy device code and open browser") 68 | alert.addButton(withTitle: "Cancel") 69 | 70 | let modalResult = alert.runModal() 71 | switch modalResult { 72 | case .alertFirstButtonReturn: 73 | let pasteboard = NSPasteboard.general 74 | pasteboard.clearContents() 75 | pasteboard.setString(userCode, forType: .string) 76 | let url = URL(string: verificationUri)! 77 | NSWorkspace.shared.open(url) 78 | default: 79 | return 80 | } 81 | } 82 | } 83 | } 84 | 85 | func quit() { 86 | print("quitting") 87 | exit(0) 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /mac/Pods/Charts/Source/Charts/Components/MarkerView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ChartMarkerView.swift 3 | // Charts 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/Charts 10 | // 11 | 12 | import Foundation 13 | import CoreGraphics 14 | 15 | #if canImport(AppKit) 16 | import AppKit 17 | #endif 18 | 19 | @objc(ChartMarkerView) 20 | open class MarkerView: NSUIView, IMarker 21 | { 22 | open var offset: CGPoint = CGPoint() 23 | 24 | @objc open weak var chartView: ChartViewBase? 25 | 26 | open func offsetForDrawing(atPoint point: CGPoint) -> CGPoint 27 | { 28 | guard let chart = chartView else { return self.offset } 29 | 30 | var offset = self.offset 31 | 32 | let width = self.bounds.size.width 33 | let height = self.bounds.size.height 34 | 35 | if point.x + offset.x < 0.0 36 | { 37 | offset.x = -point.x 38 | } 39 | else if point.x + width + offset.x > chart.bounds.size.width 40 | { 41 | offset.x = chart.bounds.size.width - point.x - width 42 | } 43 | 44 | if point.y + offset.y < 0 45 | { 46 | offset.y = -point.y 47 | } 48 | else if point.y + height + offset.y > chart.bounds.size.height 49 | { 50 | offset.y = chart.bounds.size.height - point.y - height 51 | } 52 | 53 | return offset 54 | } 55 | 56 | open func refreshContent(entry: ChartDataEntry, highlight: Highlight) 57 | { 58 | // Do nothing here... 59 | } 60 | 61 | open func draw(context: CGContext, point: CGPoint) 62 | { 63 | let offset = self.offsetForDrawing(atPoint: point) 64 | 65 | context.saveGState() 66 | context.translateBy(x: point.x + offset.x, 67 | y: point.y + offset.y) 68 | NSUIGraphicsPushContext(context) 69 | self.nsuiLayer?.render(in: context) 70 | NSUIGraphicsPopContext() 71 | context.restoreGState() 72 | } 73 | 74 | @objc 75 | open class func viewFromXib(in bundle: Bundle = .main) -> MarkerView? 76 | { 77 | #if !os(OSX) 78 | 79 | return bundle.loadNibNamed( 80 | String(describing: self), 81 | owner: nil, 82 | options: nil)?[0] as? MarkerView 83 | #else 84 | 85 | var loadedObjects = NSArray() 86 | let loadedObjectsPointer = AutoreleasingUnsafeMutablePointer(&loadedObjects) 87 | 88 | if bundle.loadNibNamed( 89 | NSNib.Name(String(describing: self)), 90 | owner: nil, 91 | topLevelObjects: loadedObjectsPointer) 92 | { 93 | return loadedObjects[0] as? MarkerView 94 | } 95 | 96 | return nil 97 | #endif 98 | } 99 | 100 | } 101 | -------------------------------------------------------------------------------- /mac/Pods/Charts/Source/Charts/Formatters/DefaultValueFormatter.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DefaultValueFormatter.swift 3 | // Charts 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/Charts 10 | // 11 | 12 | import Foundation 13 | 14 | @objc(ChartDefaultValueFormatter) 15 | open class DefaultValueFormatter: NSObject, IValueFormatter 16 | { 17 | public typealias Block = ( 18 | _ value: Double, 19 | _ entry: ChartDataEntry, 20 | _ dataSetIndex: Int, 21 | _ viewPortHandler: ViewPortHandler?) -> String 22 | 23 | @objc open var block: Block? 24 | 25 | @objc open var hasAutoDecimals: Bool = false 26 | 27 | private var _formatter: NumberFormatter? 28 | @objc open var formatter: NumberFormatter? 29 | { 30 | get { return _formatter } 31 | set 32 | { 33 | hasAutoDecimals = false 34 | _formatter = newValue 35 | } 36 | } 37 | 38 | private var _decimals: Int? 39 | open var decimals: Int? 40 | { 41 | get { return _decimals } 42 | set 43 | { 44 | _decimals = newValue 45 | 46 | if let digits = newValue 47 | { 48 | self.formatter?.minimumFractionDigits = digits 49 | self.formatter?.maximumFractionDigits = digits 50 | self.formatter?.usesGroupingSeparator = true 51 | } 52 | } 53 | } 54 | 55 | public override init() 56 | { 57 | super.init() 58 | 59 | self.formatter = NumberFormatter() 60 | hasAutoDecimals = true 61 | } 62 | 63 | @objc public init(formatter: NumberFormatter) 64 | { 65 | super.init() 66 | 67 | self.formatter = formatter 68 | } 69 | 70 | @objc public init(decimals: Int) 71 | { 72 | super.init() 73 | 74 | self.formatter = NumberFormatter() 75 | self.formatter?.usesGroupingSeparator = true 76 | self.decimals = decimals 77 | hasAutoDecimals = true 78 | } 79 | 80 | @objc public init(block: @escaping Block) 81 | { 82 | super.init() 83 | 84 | self.block = block 85 | } 86 | 87 | @objc public static func with(block: @escaping Block) -> DefaultValueFormatter? 88 | { 89 | return DefaultValueFormatter(block: block) 90 | } 91 | 92 | open func stringForValue(_ value: Double, 93 | entry: ChartDataEntry, 94 | dataSetIndex: Int, 95 | viewPortHandler: ViewPortHandler?) -> String 96 | { 97 | if let block = block { 98 | return block(value, entry, dataSetIndex, viewPortHandler) 99 | } else { 100 | return formatter?.string(from: NSNumber(floatLiteral: value)) ?? "" 101 | } 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /mac/Pods/Charts/Source/Charts/Components/MarkerImage.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ChartMarkerImage.swift 3 | // Charts 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/Charts 10 | // 11 | 12 | import Foundation 13 | import CoreGraphics 14 | 15 | @objc(ChartMarkerImage) 16 | open class MarkerImage: NSObject, IMarker 17 | { 18 | /// The marker image to render 19 | @objc open var image: NSUIImage? 20 | 21 | open var offset: CGPoint = CGPoint() 22 | 23 | @objc open weak var chartView: ChartViewBase? 24 | 25 | /// As long as size is 0.0/0.0 - it will default to the image's size 26 | @objc open var size: CGSize = CGSize() 27 | 28 | public override init() 29 | { 30 | super.init() 31 | } 32 | 33 | open func offsetForDrawing(atPoint point: CGPoint) -> CGPoint 34 | { 35 | var offset = self.offset 36 | 37 | let chart = self.chartView 38 | 39 | var size = self.size 40 | 41 | if size.width == 0.0 && image != nil 42 | { 43 | size.width = image?.size.width ?? 0.0 44 | } 45 | if size.height == 0.0 && image != nil 46 | { 47 | size.height = image?.size.height ?? 0.0 48 | } 49 | 50 | let width = size.width 51 | let height = size.height 52 | 53 | if point.x + offset.x < 0.0 54 | { 55 | offset.x = -point.x 56 | } 57 | else if chart != nil && point.x + width + offset.x > chart!.bounds.size.width 58 | { 59 | offset.x = chart!.bounds.size.width - point.x - width 60 | } 61 | 62 | if point.y + offset.y < 0 63 | { 64 | offset.y = -point.y 65 | } 66 | else if chart != nil && point.y + height + offset.y > chart!.bounds.size.height 67 | { 68 | offset.y = chart!.bounds.size.height - point.y - height 69 | } 70 | 71 | return offset 72 | } 73 | 74 | open func refreshContent(entry: ChartDataEntry, highlight: Highlight) 75 | { 76 | // Do nothing here... 77 | } 78 | 79 | open func draw(context: CGContext, point: CGPoint) 80 | { 81 | guard let image = image else { return } 82 | 83 | let offset = offsetForDrawing(atPoint: point) 84 | 85 | var size = self.size 86 | 87 | if size.width == 0.0 88 | { 89 | size.width = image.size.width 90 | } 91 | if size.height == 0.0 92 | { 93 | size.height = image.size.height 94 | } 95 | 96 | let rect = CGRect( 97 | x: point.x + offset.x, 98 | y: point.y + offset.y, 99 | width: size.width, 100 | height: size.height) 101 | 102 | NSUIGraphicsPushContext(context) 103 | image.draw(in: rect) 104 | NSUIGraphicsPopContext() 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /mac/keyrace-mac.xcodeproj/xcshareddata/xcschemes/keyrace-mac.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 45 | 51 | 52 | 53 | 54 | 60 | 62 | 68 | 69 | 70 | 71 | 73 | 74 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /mac/Pods/Charts/Source/Charts/Data/Implementations/Standard/ChartDataEntry.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ChartDataEntry.swift 3 | // Charts 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/Charts 10 | // 11 | 12 | import Foundation 13 | 14 | open class ChartDataEntry: ChartDataEntryBase, NSCopying 15 | { 16 | /// the x value 17 | @objc open var x = 0.0 18 | 19 | public required init() 20 | { 21 | super.init() 22 | } 23 | 24 | /// An Entry represents one single entry in the chart. 25 | /// 26 | /// - Parameters: 27 | /// - x: the x value 28 | /// - y: the y value (the actual value of the entry) 29 | @objc public init(x: Double, y: Double) 30 | { 31 | super.init(y: y) 32 | self.x = x 33 | } 34 | 35 | /// An Entry represents one single entry in the chart. 36 | /// 37 | /// - Parameters: 38 | /// - x: the x value 39 | /// - y: the y value (the actual value of the entry) 40 | /// - data: Space for additional data this Entry represents. 41 | 42 | @objc public convenience init(x: Double, y: Double, data: Any?) 43 | { 44 | self.init(x: x, y: y) 45 | self.data = data 46 | } 47 | 48 | /// An Entry represents one single entry in the chart. 49 | /// 50 | /// - Parameters: 51 | /// - x: the x value 52 | /// - y: the y value (the actual value of the entry) 53 | /// - icon: icon image 54 | 55 | @objc public convenience init(x: Double, y: Double, icon: NSUIImage?) 56 | { 57 | self.init(x: x, y: y) 58 | self.icon = icon 59 | } 60 | 61 | /// An Entry represents one single entry in the chart. 62 | /// 63 | /// - Parameters: 64 | /// - x: the x value 65 | /// - y: the y value (the actual value of the entry) 66 | /// - icon: icon image 67 | /// - data: Space for additional data this Entry represents. 68 | 69 | @objc public convenience init(x: Double, y: Double, icon: NSUIImage?, data: Any?) 70 | { 71 | self.init(x: x, y: y) 72 | self.icon = icon 73 | self.data = data 74 | } 75 | 76 | // MARK: NSObject 77 | 78 | open override var description: String 79 | { 80 | return "ChartDataEntry, x: \(x), y \(y)" 81 | } 82 | 83 | // MARK: NSCopying 84 | 85 | open func copy(with zone: NSZone? = nil) -> Any 86 | { 87 | let copy = type(of: self).init() 88 | 89 | copy.x = x 90 | copy.y = y 91 | copy.data = data 92 | 93 | return copy 94 | } 95 | } 96 | 97 | // MARK: Equatable 98 | extension ChartDataEntry/*: Equatable*/ { 99 | open override func isEqual(_ object: Any?) -> Bool { 100 | guard let object = object as? ChartDataEntry else { return false } 101 | 102 | if self === object 103 | { 104 | return true 105 | } 106 | 107 | return y == object.y 108 | && x == object.x 109 | } 110 | } 111 | -------------------------------------------------------------------------------- /mac/Pods/Charts/Source/Charts/Renderers/XAxisRendererRadarChart.swift: -------------------------------------------------------------------------------- 1 | // 2 | // XAxisRendererRadarChart.swift 3 | // Charts 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/Charts 10 | // 11 | 12 | import Foundation 13 | import CoreGraphics 14 | 15 | open class XAxisRendererRadarChart: XAxisRenderer 16 | { 17 | @objc open weak var chart: RadarChartView? 18 | 19 | @objc public init(viewPortHandler: ViewPortHandler, xAxis: XAxis?, chart: RadarChartView) 20 | { 21 | super.init(viewPortHandler: viewPortHandler, xAxis: xAxis, transformer: nil) 22 | 23 | self.chart = chart 24 | } 25 | 26 | open override func renderAxisLabels(context: CGContext) 27 | { 28 | guard let 29 | xAxis = axis as? XAxis, 30 | let chart = chart 31 | else { return } 32 | 33 | if !xAxis.isEnabled || !xAxis.isDrawLabelsEnabled 34 | { 35 | return 36 | } 37 | 38 | let labelFont = xAxis.labelFont 39 | let labelTextColor = xAxis.labelTextColor 40 | let labelRotationAngleRadians = xAxis.labelRotationAngle.RAD2DEG 41 | let drawLabelAnchor = CGPoint(x: 0.5, y: 0.25) 42 | 43 | let sliceangle = chart.sliceAngle 44 | 45 | // calculate the factor that is needed for transforming the value to pixels 46 | let factor = chart.factor 47 | 48 | let center = chart.centerOffsets 49 | 50 | for i in stride(from: 0, to: chart.data?.maxEntryCountSet?.entryCount ?? 0, by: 1) 51 | { 52 | 53 | let label = xAxis.valueFormatter?.stringForValue(Double(i), axis: xAxis) ?? "" 54 | 55 | let angle = (sliceangle * CGFloat(i) + chart.rotationAngle).truncatingRemainder(dividingBy: 360.0) 56 | 57 | let p = center.moving(distance: CGFloat(chart.yRange) * factor + xAxis.labelRotatedWidth / 2.0, atAngle: angle) 58 | 59 | drawLabel(context: context, 60 | formattedLabel: label, 61 | x: p.x, 62 | y: p.y - xAxis.labelRotatedHeight / 2.0, 63 | attributes: [NSAttributedString.Key.font: labelFont, NSAttributedString.Key.foregroundColor: labelTextColor], 64 | anchor: drawLabelAnchor, 65 | angleRadians: labelRotationAngleRadians) 66 | } 67 | } 68 | 69 | @objc open func drawLabel( 70 | context: CGContext, 71 | formattedLabel: String, 72 | x: CGFloat, 73 | y: CGFloat, 74 | attributes: [NSAttributedString.Key : Any], 75 | anchor: CGPoint, 76 | angleRadians: CGFloat) 77 | { 78 | ChartUtils.drawText( 79 | context: context, 80 | text: formattedLabel, 81 | point: CGPoint(x: x, y: y), 82 | attributes: attributes, 83 | anchor: anchor, 84 | angleRadians: angleRadians) 85 | } 86 | 87 | open override func renderLimitLines(context: CGContext) 88 | { 89 | /// XAxis LimitLines on RadarChart not yet supported. 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /mac/Pods/Charts/Source/Charts/Components/LegendEntry.swift: -------------------------------------------------------------------------------- 1 | // 2 | // LegendEntry.swift 3 | // Charts 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/Charts 10 | // 11 | 12 | import Foundation 13 | import CoreGraphics 14 | 15 | @objc(ChartLegendEntry) 16 | open class LegendEntry: NSObject 17 | { 18 | public override init() 19 | { 20 | super.init() 21 | } 22 | 23 | /// - Parameters: 24 | /// - label: The legend entry text. 25 | /// A `nil` label will start a group. 26 | /// - form: The form to draw for this entry. 27 | /// - formSize: Set to NaN to use the legend's default. 28 | /// - formLineWidth: Set to NaN to use the legend's default. 29 | /// - formLineDashPhase: Line dash configuration. 30 | /// - formLineDashLengths: Line dash configurationas NaN to use the legend's default. 31 | /// - formColor: The color for drawing the form. 32 | @objc public init(label: String?, 33 | form: Legend.Form, 34 | formSize: CGFloat, 35 | formLineWidth: CGFloat, 36 | formLineDashPhase: CGFloat, 37 | formLineDashLengths: [CGFloat]?, 38 | formColor: NSUIColor?) 39 | { 40 | self.label = label 41 | self.form = form 42 | self.formSize = formSize 43 | self.formLineWidth = formLineWidth 44 | self.formLineDashPhase = formLineDashPhase 45 | self.formLineDashLengths = formLineDashLengths 46 | self.formColor = formColor 47 | } 48 | 49 | /// The legend entry text. 50 | /// A `nil` label will start a group. 51 | @objc open var label: String? 52 | 53 | /// The form to draw for this entry. 54 | /// 55 | /// `None` will avoid drawing a form, and any related space. 56 | /// `Empty` will avoid drawing a form, but keep its space. 57 | /// `Default` will use the Legend's default. 58 | @objc open var form: Legend.Form = .default 59 | 60 | /// Form size will be considered except for when .None is used 61 | /// 62 | /// Set as NaN to use the legend's default 63 | @objc open var formSize: CGFloat = CGFloat.nan 64 | 65 | /// Line width used for shapes that consist of lines. 66 | /// 67 | /// Set to NaN to use the legend's default. 68 | @objc open var formLineWidth: CGFloat = CGFloat.nan 69 | 70 | /// Line dash configuration for shapes that consist of lines. 71 | /// 72 | /// This is how much (in pixels) into the dash pattern are we starting from. 73 | /// 74 | /// Set to NaN to use the legend's default. 75 | @objc open var formLineDashPhase: CGFloat = 0.0 76 | 77 | /// Line dash configuration for shapes that consist of lines. 78 | /// 79 | /// This is the actual dash pattern. 80 | /// I.e. [2, 3] will paint [-- -- ] 81 | /// [1, 3, 4, 2] will paint [- ---- - ---- ] 82 | /// 83 | /// Set to nil to use the legend's default. 84 | @objc open var formLineDashLengths: [CGFloat]? 85 | 86 | /// The color for drawing the form 87 | @objc open var formColor: NSUIColor? 88 | } 89 | -------------------------------------------------------------------------------- /mac/Pods/Charts/Source/Charts/Jobs/AnimatedZoomViewJob.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AnimatedZoomViewJob.swift 3 | // Charts 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/Charts 10 | // 11 | 12 | import Foundation 13 | import CoreGraphics 14 | 15 | open class AnimatedZoomViewJob: AnimatedViewPortJob 16 | { 17 | internal var yAxis: YAxis? 18 | internal var xAxisRange: Double = 0.0 19 | internal var scaleX: CGFloat = 0.0 20 | internal var scaleY: CGFloat = 0.0 21 | internal var zoomOriginX: CGFloat = 0.0 22 | internal var zoomOriginY: CGFloat = 0.0 23 | internal var zoomCenterX: CGFloat = 0.0 24 | internal var zoomCenterY: CGFloat = 0.0 25 | 26 | @objc public init( 27 | viewPortHandler: ViewPortHandler, 28 | transformer: Transformer, 29 | view: ChartViewBase, 30 | yAxis: YAxis, 31 | xAxisRange: Double, 32 | scaleX: CGFloat, 33 | scaleY: CGFloat, 34 | xOrigin: CGFloat, 35 | yOrigin: CGFloat, 36 | zoomCenterX: CGFloat, 37 | zoomCenterY: CGFloat, 38 | zoomOriginX: CGFloat, 39 | zoomOriginY: CGFloat, 40 | duration: TimeInterval, 41 | easing: ChartEasingFunctionBlock?) 42 | { 43 | super.init(viewPortHandler: viewPortHandler, 44 | xValue: 0.0, 45 | yValue: 0.0, 46 | transformer: transformer, 47 | view: view, 48 | xOrigin: xOrigin, 49 | yOrigin: yOrigin, 50 | duration: duration, 51 | easing: easing) 52 | 53 | self.yAxis = yAxis 54 | self.xAxisRange = xAxisRange 55 | self.scaleX = scaleX 56 | self.scaleY = scaleY 57 | self.zoomCenterX = zoomCenterX 58 | self.zoomCenterY = zoomCenterY 59 | self.zoomOriginX = zoomOriginX 60 | self.zoomOriginY = zoomOriginY 61 | } 62 | 63 | internal override func animationUpdate() 64 | { 65 | guard 66 | let viewPortHandler = viewPortHandler, 67 | let transformer = transformer, 68 | let view = view 69 | else { return } 70 | 71 | let scaleX = xOrigin + (self.scaleX - xOrigin) * phase 72 | let scaleY = yOrigin + (self.scaleY - yOrigin) * phase 73 | 74 | var matrix = viewPortHandler.setZoom(scaleX: scaleX, scaleY: scaleY) 75 | viewPortHandler.refresh(newMatrix: matrix, chart: view, invalidate: false) 76 | 77 | let valsInView = CGFloat(yAxis?.axisRange ?? 0.0) / viewPortHandler.scaleY 78 | let xsInView = CGFloat(xAxisRange) / viewPortHandler.scaleX 79 | 80 | var pt = CGPoint( 81 | x: zoomOriginX + ((zoomCenterX - xsInView / 2.0) - zoomOriginX) * phase, 82 | y: zoomOriginY + ((zoomCenterY + valsInView / 2.0) - zoomOriginY) * phase 83 | ) 84 | 85 | transformer.pointValueToPixel(&pt) 86 | 87 | matrix = viewPortHandler.translate(pt: pt) 88 | viewPortHandler.refresh(newMatrix: matrix, chart: view, invalidate: true) 89 | } 90 | 91 | internal override func animationEnd() 92 | { 93 | (view as? BarLineChartViewBase)?.calculateOffsets() 94 | view?.setNeedsDisplay() 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /mac/Pods/Charts/Source/Charts/Data/Implementations/Standard/PieChartData.swift: -------------------------------------------------------------------------------- 1 | // 2 | // PieData.swift 3 | // Charts 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/Charts 10 | // 11 | 12 | import Foundation 13 | 14 | open class PieChartData: ChartData 15 | { 16 | public override init() 17 | { 18 | super.init() 19 | } 20 | 21 | public override init(dataSets: [IChartDataSet]?) 22 | { 23 | super.init(dataSets: dataSets) 24 | } 25 | 26 | /// All DataSet objects this ChartData object holds. 27 | @objc open override var dataSets: [IChartDataSet] 28 | { 29 | get 30 | { 31 | assert(super.dataSets.count <= 1, "Found multiple data sets while pie chart only allows one") 32 | return super.dataSets 33 | } 34 | set 35 | { 36 | super.dataSets = newValue 37 | } 38 | } 39 | 40 | @objc var dataSet: IPieChartDataSet? 41 | { 42 | get 43 | { 44 | return dataSets.count > 0 ? dataSets[0] as? IPieChartDataSet : nil 45 | } 46 | set 47 | { 48 | if let newValue = newValue 49 | { 50 | dataSets = [newValue] 51 | } 52 | else 53 | { 54 | dataSets = [] 55 | } 56 | } 57 | } 58 | 59 | open override func getDataSetByIndex(_ index: Int) -> IChartDataSet? 60 | { 61 | if index != 0 62 | { 63 | return nil 64 | } 65 | return super.getDataSetByIndex(index) 66 | } 67 | 68 | open override func getDataSetByLabel(_ label: String, ignorecase: Bool) -> IChartDataSet? 69 | { 70 | if dataSets.count == 0 || dataSets[0].label == nil 71 | { 72 | return nil 73 | } 74 | 75 | if ignorecase 76 | { 77 | if let label = dataSets[0].label, label.caseInsensitiveCompare(label) == .orderedSame 78 | { 79 | return dataSets[0] 80 | } 81 | } 82 | else 83 | { 84 | if label == dataSets[0].label 85 | { 86 | return dataSets[0] 87 | } 88 | } 89 | return nil 90 | } 91 | 92 | open override func entryForHighlight(_ highlight: Highlight) -> ChartDataEntry? 93 | { 94 | return dataSet?.entryForIndex(Int(highlight.x)) 95 | } 96 | 97 | open override func addDataSet(_ d: IChartDataSet!) 98 | { 99 | super.addDataSet(d) 100 | } 101 | 102 | /// Removes the DataSet at the given index in the DataSet array from the data object. 103 | /// Also recalculates all minimum and maximum values. 104 | /// 105 | /// - Returns: `true` if a DataSet was removed, `false` ifno DataSet could be removed. 106 | open override func removeDataSetByIndex(_ index: Int) -> Bool 107 | { 108 | if index >= _dataSets.count || index < 0 109 | { 110 | return false 111 | } 112 | 113 | return false 114 | } 115 | 116 | /// The total y-value sum across all DataSet objects the this object represents. 117 | @objc open var yValueSum: Double 118 | { 119 | guard let dataSet = dataSet else { return 0.0 } 120 | return (0.. _endTime ? _endTime : _endTime 67 | 68 | updateAnimationPhase(_startTime) 69 | 70 | _displayLink = NSUIDisplayLink(target: self, selector: #selector(animationLoop)) 71 | _displayLink.add(to: .main, forMode: RunLoop.Mode.common) 72 | } 73 | 74 | @objc open func stop(finish: Bool) 75 | { 76 | guard _displayLink != nil else { return } 77 | 78 | _displayLink.remove(from: .main, forMode: RunLoop.Mode.common) 79 | _displayLink = nil 80 | 81 | if finish 82 | { 83 | if phase != 1.0 84 | { 85 | phase = 1.0 86 | animationUpdate() 87 | } 88 | 89 | animationEnd() 90 | } 91 | } 92 | 93 | private func updateAnimationPhase(_ currentTime: TimeInterval) 94 | { 95 | let elapsedTime = currentTime - _startTime 96 | let duration = _duration 97 | var elapsed = elapsedTime 98 | 99 | elapsed = min(elapsed, duration) 100 | 101 | phase = CGFloat(_easing?(elapsed, duration) ?? elapsed / duration) 102 | } 103 | 104 | @objc private func animationLoop() 105 | { 106 | let currentTime: TimeInterval = CACurrentMediaTime() 107 | 108 | updateAnimationPhase(currentTime) 109 | 110 | animationUpdate() 111 | 112 | if currentTime >= _endTime 113 | { 114 | stop(finish: true) 115 | } 116 | } 117 | 118 | internal func animationUpdate() 119 | { 120 | // Override this 121 | } 122 | 123 | internal func animationEnd() 124 | { 125 | // Override this 126 | } 127 | } 128 | -------------------------------------------------------------------------------- /mac/Pods/Charts/Source/Charts/Data/Implementations/Standard/PieChartDataEntry.swift: -------------------------------------------------------------------------------- 1 | // 2 | // PieChartDataEntry.swift 3 | // Charts 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/Charts 10 | // 11 | 12 | import Foundation 13 | import CoreGraphics 14 | 15 | open class PieChartDataEntry: ChartDataEntry 16 | { 17 | public required init() 18 | { 19 | super.init() 20 | } 21 | 22 | 23 | /// - Parameters: 24 | /// - value: The value on the y-axis 25 | @objc public init(value: Double) 26 | { 27 | super.init(x: .nan, y: value) 28 | } 29 | 30 | /// - Parameters: 31 | /// - value: The value on the y-axis 32 | /// - label: The label for the x-axis 33 | @objc public convenience init(value: Double, label: String?) 34 | { 35 | self.init(value: value) 36 | self.label = label 37 | } 38 | 39 | /// - Parameters: 40 | /// - value: The value on the y-axis 41 | /// - label: The label for the x-axis 42 | /// - data: Spot for additional data this Entry represents 43 | @objc public convenience init(value: Double, label: String?, data: Any?) 44 | { 45 | self.init(value: value, label: label, icon: nil, data: data) 46 | } 47 | 48 | /// - Parameters: 49 | /// - value: The value on the y-axis 50 | /// - label: The label for the x-axis 51 | /// - icon: icon image 52 | @objc public convenience init(value: Double, label: String?, icon: NSUIImage?) 53 | { 54 | self.init(value: value) 55 | self.label = label 56 | self.icon = icon 57 | } 58 | 59 | /// - Parameters: 60 | /// - value: The value on the y-axis 61 | /// - label: The label for the x-axis 62 | /// - icon: icon image 63 | /// - data: Spot for additional data this Entry represents 64 | @objc public convenience init(value: Double, label: String?, icon: NSUIImage?, data: Any?) 65 | { 66 | self.init(value: value) 67 | self.label = label 68 | self.icon = icon 69 | self.data = data 70 | } 71 | 72 | /// - Parameters: 73 | /// - value: The value on the y-axis 74 | /// - data: Spot for additional data this Entry represents 75 | @objc public convenience init(value: Double, data: Any?) 76 | { 77 | self.init(value: value) 78 | self.data = data 79 | } 80 | 81 | /// - Parameters: 82 | /// - value: The value on the y-axis 83 | /// - icon: icon image 84 | @objc public convenience init(value: Double, icon: NSUIImage?) 85 | { 86 | self.init(value: value) 87 | self.icon = icon 88 | } 89 | 90 | /// - Parameters: 91 | /// - value: The value on the y-axis 92 | /// - icon: icon image 93 | /// - data: Spot for additional data this Entry represents 94 | @objc public convenience init(value: Double, icon: NSUIImage?, data: Any?) 95 | { 96 | self.init(value: value) 97 | self.icon = icon 98 | self.data = data 99 | } 100 | 101 | // MARK: Data property accessors 102 | 103 | @objc open var label: String? 104 | 105 | @objc open var value: Double 106 | { 107 | get { return y } 108 | set { y = newValue } 109 | } 110 | 111 | // MARK: NSCopying 112 | 113 | open override func copy(with zone: NSZone? = nil) -> Any 114 | { 115 | let copy = super.copy(with: zone) as! PieChartDataEntry 116 | copy.label = label 117 | return copy 118 | } 119 | } 120 | -------------------------------------------------------------------------------- /mac/Pods/Charts/Source/Charts/Filters/DataApproximator.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DataApproximator.swift 3 | // Charts 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/Charts 10 | // 11 | 12 | import Foundation 13 | import CoreGraphics 14 | 15 | @objc(ChartDataApproximator) 16 | open class DataApproximator: NSObject 17 | { 18 | /// uses the douglas peuker algorithm to reduce the given arraylist of entries 19 | @objc open class func reduceWithDouglasPeuker(_ points: [CGPoint], tolerance: CGFloat) -> [CGPoint] 20 | { 21 | // if a shape has 2 or less points it cannot be reduced 22 | if tolerance <= 0 || points.count < 3 23 | { 24 | return points 25 | } 26 | 27 | var keep = [Bool](repeating: false, count: points.count) 28 | 29 | // first and last always stay 30 | keep[0] = true 31 | keep[points.count - 1] = true 32 | 33 | // first and last entry are entry point to recursion 34 | reduceWithDouglasPeuker(points: points, 35 | tolerance: tolerance, 36 | start: 0, 37 | end: points.count - 1, 38 | keep: &keep) 39 | 40 | // create a new array with series, only take the kept ones 41 | return zip(keep, points).compactMap { $0 ? nil : $1 } 42 | } 43 | 44 | /// apply the Douglas-Peucker-Reduction to an array of `CGPoint`s with a given tolerance 45 | /// 46 | /// - Parameters: 47 | /// - points: 48 | /// - tolerance: 49 | /// - start: 50 | /// - end: 51 | open class func reduceWithDouglasPeuker( 52 | points: [CGPoint], 53 | tolerance: CGFloat, 54 | start: Int, 55 | end: Int, 56 | keep: inout [Bool]) 57 | { 58 | if end <= start + 1 59 | { 60 | // recursion finished 61 | return 62 | } 63 | 64 | var greatestIndex = Int(0) 65 | var greatestDistance = CGFloat(0.0) 66 | 67 | let line = Line(pt1: points[start], pt2: points[end]) 68 | 69 | for i in start + 1 ..< end 70 | { 71 | let distance = line.distance(toPoint: points[i]) 72 | 73 | if distance > greatestDistance 74 | { 75 | greatestDistance = distance 76 | greatestIndex = i 77 | } 78 | } 79 | 80 | if greatestDistance > tolerance 81 | { 82 | // keep max dist point 83 | keep[greatestIndex] = true 84 | 85 | // recursive call 86 | reduceWithDouglasPeuker(points: points, tolerance: tolerance, start: start, end: greatestIndex, keep: &keep) 87 | reduceWithDouglasPeuker(points: points, tolerance: tolerance, start: greatestIndex, end: end, keep: &keep) 88 | } // else don't keep the point... 89 | } 90 | 91 | private class Line 92 | { 93 | var sxey: CGFloat 94 | var exsy: CGFloat 95 | 96 | var dx: CGFloat 97 | var dy: CGFloat 98 | 99 | var length: CGFloat 100 | 101 | init(pt1: CGPoint, pt2: CGPoint) 102 | { 103 | dx = pt1.x - pt2.x 104 | dy = pt1.y - pt2.y 105 | sxey = pt1.x * pt2.y 106 | exsy = pt2.x * pt1.y 107 | length = sqrt(dx * dx + dy * dy) 108 | } 109 | 110 | func distance(toPoint pt: CGPoint) -> CGFloat 111 | { 112 | return abs(dy * pt.x - dx * pt.y + sxey - exsy) / length 113 | } 114 | } 115 | } 116 | -------------------------------------------------------------------------------- /mac/Pods/Charts/Source/Charts/Data/Implementations/Standard/BarChartData.swift: -------------------------------------------------------------------------------- 1 | // 2 | // BarChartData.swift 3 | // Charts 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/Charts 10 | // 11 | 12 | import Foundation 13 | import CoreGraphics 14 | 15 | open class BarChartData: BarLineScatterCandleBubbleChartData 16 | { 17 | public override init() 18 | { 19 | super.init() 20 | } 21 | 22 | public override init(dataSets: [IChartDataSet]?) 23 | { 24 | super.init(dataSets: dataSets) 25 | } 26 | 27 | /// The width of the bars on the x-axis, in values (not pixels) 28 | /// 29 | /// **default**: 0.85 30 | @objc open var barWidth = Double(0.85) 31 | 32 | /// Groups all BarDataSet objects this data object holds together by modifying the x-value of their entries. 33 | /// Previously set x-values of entries will be overwritten. Leaves space between bars and groups as specified by the parameters. 34 | /// Do not forget to call notifyDataSetChanged() on your BarChart object after calling this method. 35 | /// 36 | /// - Parameters: 37 | /// - fromX: the starting point on the x-axis where the grouping should begin 38 | /// - groupSpace: The space between groups of bars in values (not pixels) e.g. 0.8f for bar width 1f 39 | /// - barSpace: The space between individual bars in values (not pixels) e.g. 0.1f for bar width 1f 40 | @objc open func groupBars(fromX: Double, groupSpace: Double, barSpace: Double) 41 | { 42 | let setCount = _dataSets.count 43 | if setCount <= 1 44 | { 45 | print("BarData needs to hold at least 2 BarDataSets to allow grouping.", terminator: "\n") 46 | return 47 | } 48 | 49 | let max = maxEntryCountSet 50 | let maxEntryCount = max?.entryCount ?? 0 51 | 52 | let groupSpaceWidthHalf = groupSpace / 2.0 53 | let barSpaceHalf = barSpace / 2.0 54 | let barWidthHalf = self.barWidth / 2.0 55 | 56 | var fromX = fromX 57 | 58 | let interval = groupWidth(groupSpace: groupSpace, barSpace: barSpace) 59 | 60 | for i in stride(from: 0, to: maxEntryCount, by: 1) 61 | { 62 | let start = fromX 63 | fromX += groupSpaceWidthHalf 64 | 65 | (_dataSets as? [IBarChartDataSet])?.forEach { set in 66 | fromX += barSpaceHalf 67 | fromX += barWidthHalf 68 | 69 | if i < set.entryCount 70 | { 71 | if let entry = set.entryForIndex(i) 72 | { 73 | entry.x = fromX 74 | } 75 | } 76 | 77 | fromX += barWidthHalf 78 | fromX += barSpaceHalf 79 | } 80 | 81 | fromX += groupSpaceWidthHalf 82 | let end = fromX 83 | let innerInterval = end - start 84 | let diff = interval - innerInterval 85 | 86 | // correct rounding errors 87 | if diff > 0 || diff < 0 88 | { 89 | fromX += diff 90 | } 91 | 92 | } 93 | 94 | notifyDataChanged() 95 | } 96 | 97 | /// In case of grouped bars, this method returns the space an individual group of bar needs on the x-axis. 98 | /// 99 | /// - Parameters: 100 | /// - groupSpace: 101 | /// - barSpace: 102 | @objc open func groupWidth(groupSpace: Double, barSpace: Double) -> Double 103 | { 104 | return Double(_dataSets.count) * (self.barWidth + barSpace) + groupSpace 105 | } 106 | 107 | } 108 | -------------------------------------------------------------------------------- /mac/Pods/Charts/Source/Charts/Highlight/BarHighlighter.swift: -------------------------------------------------------------------------------- 1 | // 2 | // BarHighlighter.swift 3 | // Charts 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/Charts 10 | // 11 | 12 | import Foundation 13 | import CoreGraphics 14 | 15 | @objc(BarChartHighlighter) 16 | open class BarHighlighter: ChartHighlighter 17 | { 18 | open override func getHighlight(x: CGFloat, y: CGFloat) -> Highlight? 19 | { 20 | guard 21 | let barData = (self.chart as? BarChartDataProvider)?.barData, 22 | let high = super.getHighlight(x: x, y: y) 23 | else { return nil } 24 | 25 | let pos = getValsForTouch(x: x, y: y) 26 | 27 | if let set = barData.getDataSetByIndex(high.dataSetIndex) as? IBarChartDataSet, 28 | set.isStacked 29 | { 30 | return getStackedHighlight(high: high, 31 | set: set, 32 | xValue: Double(pos.x), 33 | yValue: Double(pos.y)) 34 | } 35 | else 36 | { 37 | return high 38 | } 39 | } 40 | 41 | internal override func getDistance(x1: CGFloat, y1: CGFloat, x2: CGFloat, y2: CGFloat) -> CGFloat 42 | { 43 | return abs(x1 - x2) 44 | } 45 | 46 | internal override var data: ChartData? 47 | { 48 | return (chart as? BarChartDataProvider)?.barData 49 | } 50 | 51 | /// This method creates the Highlight object that also indicates which value of a stacked BarEntry has been selected. 52 | /// 53 | /// - Parameters: 54 | /// - high: the Highlight to work with looking for stacked values 55 | /// - set: 56 | /// - xIndex: 57 | /// - yValue: 58 | /// - Returns: 59 | @objc open func getStackedHighlight(high: Highlight, 60 | set: IBarChartDataSet, 61 | xValue: Double, 62 | yValue: Double) -> Highlight? 63 | { 64 | guard 65 | let chart = self.chart as? BarLineScatterCandleBubbleChartDataProvider, 66 | let entry = set.entryForXValue(xValue, closestToY: yValue) as? BarChartDataEntry 67 | else { return nil } 68 | 69 | // Not stacked 70 | if entry.yValues == nil 71 | { 72 | return high 73 | } 74 | 75 | guard 76 | let ranges = entry.ranges, 77 | ranges.count > 0 78 | else { return nil } 79 | 80 | let stackIndex = getClosestStackIndex(ranges: ranges, value: yValue) 81 | let pixel = chart 82 | .getTransformer(forAxis: set.axisDependency) 83 | .pixelForValues(x: high.x, y: ranges[stackIndex].to) 84 | 85 | return Highlight(x: entry.x, 86 | y: entry.y, 87 | xPx: pixel.x, 88 | yPx: pixel.y, 89 | dataSetIndex: high.dataSetIndex, 90 | stackIndex: stackIndex, 91 | axis: high.axis) 92 | } 93 | 94 | /// - Parameters: 95 | /// - entry: 96 | /// - value: 97 | /// - Returns: The index of the closest value inside the values array / ranges (stacked barchart) to the value given as a parameter. 98 | @objc open func getClosestStackIndex(ranges: [Range]?, value: Double) -> Int 99 | { 100 | guard let ranges = ranges else { return 0 } 101 | if let stackIndex = ranges.firstIndex(where: { $0.contains(value) }) { 102 | return stackIndex 103 | } else { 104 | let length = max(ranges.count - 1, 0) 105 | return (value > ranges[length].to) ? length : 0 106 | } 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /mac/Pods/Charts/Source/Charts/Data/Implementations/Standard/CandleChartDataSet.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CandleChartDataSet.swift 3 | // Charts 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/Charts 10 | // 11 | 12 | import Foundation 13 | import CoreGraphics 14 | 15 | 16 | open class CandleChartDataSet: LineScatterCandleRadarChartDataSet, ICandleChartDataSet 17 | { 18 | 19 | public required init() 20 | { 21 | super.init() 22 | } 23 | 24 | public override init(entries: [ChartDataEntry]?, label: String?) 25 | { 26 | super.init(entries: entries, label: label) 27 | } 28 | 29 | // MARK: - Data functions and accessors 30 | 31 | open override func calcMinMax(entry e: ChartDataEntry) 32 | { 33 | guard let e = e as? CandleChartDataEntry 34 | else { return } 35 | 36 | if e.low < _yMin 37 | { 38 | _yMin = e.low 39 | } 40 | 41 | if e.high > _yMax 42 | { 43 | _yMax = e.high 44 | } 45 | 46 | calcMinMaxX(entry: e) 47 | } 48 | 49 | open override func calcMinMaxY(entry e: ChartDataEntry) 50 | { 51 | guard let e = e as? CandleChartDataEntry 52 | else { return } 53 | 54 | if e.high < _yMin 55 | { 56 | _yMin = e.high 57 | } 58 | if e.high > _yMax 59 | { 60 | _yMax = e.high 61 | } 62 | 63 | if e.low < _yMin 64 | { 65 | _yMin = e.low 66 | } 67 | if e.low > _yMax 68 | { 69 | _yMax = e.low 70 | } 71 | } 72 | 73 | // MARK: - Styling functions and accessors 74 | 75 | /// the space between the candle entries 76 | /// 77 | /// **default**: 0.1 (10%) 78 | private var _barSpace = CGFloat(0.1) 79 | 80 | /// the space that is left out on the left and right side of each candle, 81 | /// **default**: 0.1 (10%), max 0.45, min 0.0 82 | open var barSpace: CGFloat 83 | { 84 | get 85 | { 86 | return _barSpace 87 | } 88 | set 89 | { 90 | _barSpace = newValue.clamped(to: 0...0.45) 91 | } 92 | } 93 | 94 | /// should the candle bars show? 95 | /// when false, only "ticks" will show 96 | /// 97 | /// **default**: true 98 | open var showCandleBar: Bool = true 99 | 100 | /// the width of the candle-shadow-line in pixels. 101 | /// 102 | /// **default**: 1.5 103 | open var shadowWidth = CGFloat(1.5) 104 | 105 | /// the color of the shadow line 106 | open var shadowColor: NSUIColor? 107 | 108 | /// use candle color for the shadow 109 | open var shadowColorSameAsCandle = false 110 | 111 | /// Is the shadow color same as the candle color? 112 | open var isShadowColorSameAsCandle: Bool { return shadowColorSameAsCandle } 113 | 114 | /// color for open == close 115 | open var neutralColor: NSUIColor? 116 | 117 | /// color for open > close 118 | open var increasingColor: NSUIColor? 119 | 120 | /// color for open < close 121 | open var decreasingColor: NSUIColor? 122 | 123 | /// Are increasing values drawn as filled? 124 | /// increasing candlesticks are traditionally hollow 125 | open var increasingFilled = false 126 | 127 | /// Are increasing values drawn as filled? 128 | open var isIncreasingFilled: Bool { return increasingFilled } 129 | 130 | /// Are decreasing values drawn as filled? 131 | /// descreasing candlesticks are traditionally filled 132 | open var decreasingFilled = true 133 | 134 | /// Are decreasing values drawn as filled? 135 | open var isDecreasingFilled: Bool { return decreasingFilled } 136 | } 137 | -------------------------------------------------------------------------------- /mac/Pods/Charts/Source/Charts/Utils/Platform+Touch Handling.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Platform+Touch Handling.swift 3 | // Charts 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/Charts 10 | // 11 | 12 | #if canImport(UIKit) 13 | import UIKit 14 | 15 | public typealias NSUIEvent = UIEvent 16 | public typealias NSUITouch = UITouch 17 | 18 | @objc 19 | extension NSUIView { 20 | public final override func touchesBegan(_ touches: Set, with event: NSUIEvent?) 21 | { 22 | self.nsuiTouchesBegan(touches, withEvent: event) 23 | } 24 | 25 | public final override func touchesMoved(_ touches: Set, with event: NSUIEvent?) 26 | { 27 | self.nsuiTouchesMoved(touches, withEvent: event) 28 | } 29 | 30 | public final override func touchesEnded(_ touches: Set, with event: NSUIEvent?) 31 | { 32 | self.nsuiTouchesEnded(touches, withEvent: event) 33 | } 34 | 35 | public final override func touchesCancelled(_ touches: Set, with event: NSUIEvent?) 36 | { 37 | self.nsuiTouchesCancelled(touches, withEvent: event) 38 | } 39 | 40 | open func nsuiTouchesBegan(_ touches: Set, withEvent event: NSUIEvent?) 41 | { 42 | super.touchesBegan(touches, with: event!) 43 | } 44 | 45 | open func nsuiTouchesMoved(_ touches: Set, withEvent event: NSUIEvent?) 46 | { 47 | super.touchesMoved(touches, with: event!) 48 | } 49 | 50 | open func nsuiTouchesEnded(_ touches: Set, withEvent event: NSUIEvent?) 51 | { 52 | super.touchesEnded(touches, with: event!) 53 | } 54 | 55 | open func nsuiTouchesCancelled(_ touches: Set?, withEvent event: NSUIEvent?) 56 | { 57 | super.touchesCancelled(touches!, with: event!) 58 | } 59 | } 60 | 61 | extension UIView 62 | { 63 | @objc final var nsuiGestureRecognizers: [NSUIGestureRecognizer]? 64 | { 65 | return self.gestureRecognizers 66 | } 67 | } 68 | #endif 69 | 70 | 71 | #if canImport(AppKit) && !targetEnvironment(macCatalyst) 72 | import AppKit 73 | 74 | public typealias NSUIEvent = NSEvent 75 | public typealias NSUITouch = NSTouch 76 | 77 | @objc 78 | extension NSUIView 79 | { 80 | public final override func touchesBegan(with event: NSEvent) 81 | { 82 | self.nsuiTouchesBegan(event.touches(matching: .any, in: self), withEvent: event) 83 | } 84 | 85 | public final override func touchesEnded(with event: NSEvent) 86 | { 87 | self.nsuiTouchesEnded(event.touches(matching: .any, in: self), withEvent: event) 88 | } 89 | 90 | public final override func touchesMoved(with event: NSEvent) 91 | { 92 | self.nsuiTouchesMoved(event.touches(matching: .any, in: self), withEvent: event) 93 | } 94 | 95 | open override func touchesCancelled(with event: NSEvent) 96 | { 97 | self.nsuiTouchesCancelled(event.touches(matching: .any, in: self), withEvent: event) 98 | } 99 | 100 | open func nsuiTouchesBegan(_ touches: Set, withEvent event: NSUIEvent?) 101 | { 102 | super.touchesBegan(with: event!) 103 | } 104 | 105 | open func nsuiTouchesMoved(_ touches: Set, withEvent event: NSUIEvent?) 106 | { 107 | super.touchesMoved(with: event!) 108 | } 109 | 110 | open func nsuiTouchesEnded(_ touches: Set, withEvent event: NSUIEvent?) 111 | { 112 | super.touchesEnded(with: event!) 113 | } 114 | 115 | open func nsuiTouchesCancelled(_ touches: Set?, withEvent event: NSUIEvent?) 116 | { 117 | super.touchesCancelled(with: event!) 118 | } 119 | } 120 | 121 | extension NSTouch 122 | { 123 | /** Touch locations on OS X are relative to the trackpad, whereas on iOS they are actually *on* the view. */ 124 | func locationInView(view: NSView) -> NSPoint 125 | { 126 | let n = self.normalizedPosition 127 | let b = view.bounds 128 | return NSPoint( 129 | x: b.origin.x + b.size.width * n.x, 130 | y: b.origin.y + b.size.height * n.y 131 | ) 132 | } 133 | } 134 | #endif 135 | -------------------------------------------------------------------------------- /mac/Pods/Charts/Source/Charts/Renderers/ChartDataRendererBase.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DataRenderer.swift 3 | // Charts 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/Charts 10 | // 11 | 12 | import Foundation 13 | import CoreGraphics 14 | 15 | #if canImport(UIKit) 16 | import UIKit 17 | #endif 18 | 19 | #if canImport(Cocoa) 20 | import Cocoa 21 | #endif 22 | 23 | @objc(ChartDataRendererBase) 24 | open class DataRenderer: Renderer 25 | { 26 | /// An array of accessibility elements that are presented to the ChartViewBase accessibility methods. 27 | /// 28 | /// Note that the order of elements in this array determines the order in which they are presented and navigated by 29 | /// Accessibility clients such as VoiceOver. 30 | /// 31 | /// Renderers should ensure that the order of elements makes sense to a client presenting an audio-only interface to a user. 32 | /// Subclasses should populate this array in drawData() or drawDataSet() to make the chart accessible. 33 | @objc final var accessibleChartElements: [NSUIAccessibilityElement] = [] 34 | 35 | @objc public let animator: Animator 36 | 37 | @objc public init(animator: Animator, viewPortHandler: ViewPortHandler) 38 | { 39 | self.animator = animator 40 | 41 | super.init(viewPortHandler: viewPortHandler) 42 | } 43 | 44 | @objc open func drawData(context: CGContext) 45 | { 46 | fatalError("drawData() cannot be called on DataRenderer") 47 | } 48 | 49 | @objc open func drawValues(context: CGContext) 50 | { 51 | fatalError("drawValues() cannot be called on DataRenderer") 52 | } 53 | 54 | @objc open func drawExtras(context: CGContext) 55 | { 56 | fatalError("drawExtras() cannot be called on DataRenderer") 57 | } 58 | 59 | /// Draws all highlight indicators for the values that are currently highlighted. 60 | /// 61 | /// - Parameters: 62 | /// - indices: the highlighted values 63 | @objc open func drawHighlighted(context: CGContext, indices: [Highlight]) 64 | { 65 | fatalError("drawHighlighted() cannot be called on DataRenderer") 66 | } 67 | 68 | /// An opportunity for initializing internal buffers used for rendering with a new size. 69 | /// Since this might do memory allocations, it should only be called if necessary. 70 | @objc open func initBuffers() { } 71 | 72 | @objc open func isDrawingValuesAllowed(dataProvider: ChartDataProvider?) -> Bool 73 | { 74 | guard let data = dataProvider?.data else { return false } 75 | return data.entryCount < Int(CGFloat(dataProvider?.maxVisibleCount ?? 0) * viewPortHandler.scaleX) 76 | } 77 | 78 | /// Creates an ```NSUIAccessibilityElement``` that acts as the first and primary header describing a chart view. 79 | /// 80 | /// - Parameters: 81 | /// - chart: The chartView object being described 82 | /// - data: A non optional data source about the chart 83 | /// - defaultDescription: A simple string describing the type/design of Chart. 84 | /// - Returns: A header ```NSUIAccessibilityElement``` that can be added to accessibleChartElements. 85 | @objc internal func createAccessibleHeader(usingChart chart: ChartViewBase, 86 | andData data: ChartData, 87 | withDefaultDescription defaultDescription: String = "Chart") -> NSUIAccessibilityElement 88 | { 89 | let chartDescriptionText = chart.chartDescription?.text ?? defaultDescription 90 | let dataSetDescriptions = data.dataSets.map { $0.label ?? "" } 91 | let dataSetDescriptionText = dataSetDescriptions.joined(separator: ", ") 92 | let dataSetCount = data.dataSets.count 93 | 94 | let 95 | element = NSUIAccessibilityElement(accessibilityContainer: chart) 96 | element.accessibilityLabel = chartDescriptionText + ". \(dataSetCount) dataset\(dataSetCount == 1 ? "" : "s"). \(dataSetDescriptionText)" 97 | element.accessibilityFrame = chart.bounds 98 | element.isHeader = true 99 | 100 | return element 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /mac/keyrace-mac/LeaderboardView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // LeaderboardView.swift 3 | // keyrace-mac 4 | // 5 | // Created by Jessie Frazelle on 2/20/21. 6 | // 7 | 8 | import Foundation 9 | import SwiftUI 10 | 11 | struct Player: Codable { 12 | var username: String 13 | var gravatar: String 14 | var score: Int 15 | } 16 | 17 | extension Player { 18 | // Turn the URL for the player's avatar into an NSImage. 19 | func avatar() -> NSImage { 20 | let url = URLComponents(string: self.gravatar)?.url 21 | if let data = try? Data.init(contentsOf: url!, options: []) { 22 | let avatar = NSImage(data: data)! 23 | avatar.size = NSSizeFromString("100,100") 24 | return avatar 25 | } 26 | return NSImage() 27 | } 28 | 29 | // Get the score string for the player 30 | func scoreString(index: Int) -> String { 31 | var format = "%d" 32 | if index == 0 { 33 | format += " 🎉" 34 | } 35 | return String(format: format, self.score) 36 | } 37 | 38 | // Get the link to the player's GitHub profile. 39 | func profileLink() -> String { 40 | return "https://github.com/" + self.username 41 | } 42 | } 43 | 44 | struct LeaderboardView: View { 45 | @ObservedObject var keyTap: KeyTap 46 | @ObservedObject var gitHub: GitHub 47 | @Environment(\.openURL) var openURL 48 | 49 | var body: some View { 50 | // This allows the leaderboard view to watch for when we login and update. 51 | if !gitHub.username.isEmpty { 52 | List(keyTap.players.indexed(), id: \.1.username) { index, player in 53 | // Create the profile image in a button so it is a link. 54 | Button(action: { 55 | openProfile(player) 56 | }) { 57 | Image(nsImage: player.avatar()) 58 | .resizable() 59 | .scaledToFit() 60 | .frame(width: 25, height: 25, alignment: .center) 61 | .clipShape(Circle()) 62 | .shadow(radius: 2) 63 | } 64 | .buttonStyle(PlainButtonStyle()) 65 | .padding(EdgeInsets(top: 2.5, leading: 2.5, bottom: 2.5, trailing: 0)) 66 | 67 | // Print the username as a link. 68 | Link("@" + player.username, 69 | destination: URL(string: "https://github.com/" + player.username)!) 70 | .foregroundColor(/*@START_MENU_TOKEN@*/.blue/*@END_MENU_TOKEN@*/) 71 | .font(.system(size: 12, weight: .medium, design: .monospaced)) 72 | .frame(width: 100, alignment: .leading) 73 | 74 | // Print the score. 75 | Text(player.scoreString(index: index)) 76 | .font(.system(size: 12, design: .monospaced)) 77 | } 78 | .listStyle(SidebarListStyle()) 79 | .frame(width: 350, height: (40 * CGFloat(keyTap.players.count)) + 20, alignment: .topLeading) 80 | } 81 | } 82 | 83 | func openProfile(_ player: Player) { 84 | guard let url = URL(string: player.profileLink()) else { 85 | return 86 | } 87 | openURL(url) 88 | } 89 | } 90 | 91 | // Make it so we can index our list of players for the leaderboard view. 92 | struct IndexedCollection: RandomAccessCollection { 93 | typealias Index = Base.Index 94 | typealias Element = (index: Index, element: Base.Element) 95 | 96 | let base: Base 97 | var startIndex: Index { base.startIndex } 98 | 99 | // corrected typo: base.endIndex, instead of base.startIndex 100 | var endIndex: Index { base.endIndex } 101 | 102 | func index(after i: Index) -> Index { 103 | base.index(after: i) 104 | } 105 | 106 | func index(before i: Index) -> Index { 107 | base.index(before: i) 108 | } 109 | 110 | func index(_ i: Index, offsetBy distance: Int) -> Index { 111 | base.index(i, offsetBy: distance) 112 | } 113 | 114 | subscript(position: Index) -> Element { 115 | (index: position, element: base[position]) 116 | } 117 | } 118 | 119 | extension RandomAccessCollection { 120 | func indexed() -> IndexedCollection { 121 | IndexedCollection(base: self) 122 | } 123 | } 124 | -------------------------------------------------------------------------------- /mac/keyrace-mac/TypingChart.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MenubarItem.swift 3 | // keyrace-mac 4 | // 5 | // Created by Nat Friedman on 1/3/21. 6 | // 7 | 8 | import Charts 9 | import Cocoa 10 | import Foundation 11 | import SwiftUI 12 | 13 | class ChartValueFormatter: NSObject, IValueFormatter { 14 | func stringForValue(_ value: Double, entry: ChartDataEntry, dataSetIndex: Int, viewPortHandler: ViewPortHandler?) -> String { 15 | if value == 0.0 { 16 | return "" 17 | } 18 | 19 | return String(Int(value)) 20 | } 21 | } 22 | 23 | public class MinAxisValueFormatter: NSObject, IAxisValueFormatter { 24 | public func stringForValue(_ value: Double, axis: AxisBase?) -> String { 25 | let date = Date() 26 | let calendar = Calendar.current 27 | let min = calendar.component(.minute, from: date) 28 | 29 | var m = min - 20 + Int(value) 30 | if m < 0 { 31 | m += 60 32 | } 33 | 34 | return String(format: ":%02d", m) 35 | } 36 | } 37 | 38 | public class HourAxisValueFormatter: NSObject, IAxisValueFormatter { 39 | public func stringForValue(_ value: Double, axis: AxisBase?) -> String { 40 | if (value == 12.0) { 41 | return "noon" 42 | } 43 | if (value == 0.0) { 44 | return "12am" 45 | } 46 | 47 | var str = "\(Int(value)%12)" 48 | 49 | if (value < 12.0) { 50 | str += "am" 51 | } else { 52 | str += "pm" 53 | } 54 | 55 | return str 56 | } 57 | } 58 | 59 | public class KeyAxisValueFormatter: NSObject, IAxisValueFormatter { 60 | public func stringForValue(_ value: Double, axis: AxisBase?) -> String { 61 | return "\(Character(UnicodeScalar(Int(97 + value))!))" // 97 is 'a' 62 | } 63 | } 64 | 65 | public class SymbolAxisValueFormatter: NSObject, IAxisValueFormatter { 66 | public func stringForValue(_ value: Double, axis: AxisBase?) -> String { 67 | return "\(Character(UnicodeScalar(Int(33 + value))!))" // 33 is '!' 68 | } 69 | } 70 | 71 | struct TypingChart: NSViewRepresentable { 72 | // TypingChart accepts a typingCount and a color. 73 | var typingCount: [Int] 74 | var color: [Int] = [255, 255, 0] 75 | var granularity: Double 76 | var valueFormatter: IAxisValueFormatter 77 | var labelCount: Int 78 | 79 | 80 | func makeNSView(context: Context) -> BarChartView { 81 | // Create the typing chart. 82 | let chart = BarChartView() 83 | 84 | chart.legend.enabled = false 85 | chart.leftAxis.drawGridLinesEnabled = false 86 | chart.leftAxis.drawAxisLineEnabled = false 87 | chart.leftAxis.drawLabelsEnabled = false 88 | chart.rightAxis.drawGridLinesEnabled = false 89 | chart.rightAxis.drawAxisLineEnabled = false 90 | chart.rightAxis.drawLabelsEnabled = false 91 | chart.xAxis.drawGridLinesEnabled = false 92 | chart.xAxis.drawAxisLineEnabled = false 93 | chart.xAxis.drawLabelsEnabled = false 94 | 95 | chart.xAxis.labelPosition = .bottom 96 | chart.xAxis.labelFont = .systemFont(ofSize: 7.0) 97 | chart.xAxis.drawLabelsEnabled = true 98 | chart.xAxis.granularity = granularity 99 | if labelCount > 0 { 100 | chart.xAxis.labelCount = labelCount 101 | } 102 | chart.xAxis.valueFormatter = valueFormatter 103 | 104 | chart.data = addData() 105 | 106 | return chart 107 | } 108 | 109 | func updateNSView(_ nsView: BarChartView, context: Context) { 110 | // When the typing count changes, change the view. 111 | nsView.data = addData() 112 | } 113 | 114 | typealias NSViewType = BarChartView 115 | 116 | func addData() -> BarChartData { 117 | let yse1 = typingCount.enumerated().map { x, y in return BarChartDataEntry(x: Double(x), y: Double(y)) } 118 | 119 | let data = BarChartData() 120 | let ds1 = BarChartDataSet(entries: yse1, label: "Hello") 121 | ds1.colors = [NSUIColor.init(srgbRed: CGFloat(color[0])/255.0, green: CGFloat(color[1])/255.0, blue: CGFloat(color[2])/255.0, alpha: 1.0)] 122 | data.addDataSet(ds1) 123 | data.barWidth = Double(0.5) 124 | 125 | data.setDrawValues(true) 126 | let valueFormatter = ChartValueFormatter() 127 | data.setValueFormatter(valueFormatter) 128 | 129 | return data 130 | } 131 | } 132 | --------------------------------------------------------------------------------