Skip to content

Commit

Permalink
First commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Edgar Žigis committed Aug 23, 2019
1 parent 968697e commit a9a7538
Show file tree
Hide file tree
Showing 28 changed files with 2,103 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.DS_Store
664 changes: 664 additions & 0 deletions GaugeSlider.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
Binary file not shown.
99 changes: 99 additions & 0 deletions GaugeSlider.xcodeproj/xcshareddata/xcschemes/GaugeSlider.xcscheme
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1030"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C051384623106DF50055FD0B"
BuildableName = "GaugeSlider.framework"
BlueprintName = "GaugeSlider"
ReferencedContainer = "container:GaugeSlider.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C051384F23106DF50055FD0B"
BuildableName = "GaugeSliderTests.xctest"
BlueprintName = "GaugeSliderTests"
ReferencedContainer = "container:GaugeSlider.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C051384623106DF50055FD0B"
BuildableName = "GaugeSlider.framework"
BlueprintName = "GaugeSlider"
ReferencedContainer = "container:GaugeSlider.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C051384623106DF50055FD0B"
BuildableName = "GaugeSlider.framework"
BlueprintName = "GaugeSlider"
ReferencedContainer = "container:GaugeSlider.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C051384623106DF50055FD0B"
BuildableName = "GaugeSlider.framework"
BlueprintName = "GaugeSlider"
ReferencedContainer = "container:GaugeSlider.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1030"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C051386D231075790055FD0B"
BuildableName = "GaugeSliderTest.app"
BlueprintName = "GaugeSliderTest"
ReferencedContainer = "container:GaugeSlider.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C051386D231075790055FD0B"
BuildableName = "GaugeSliderTest.app"
BlueprintName = "GaugeSliderTest"
ReferencedContainer = "container:GaugeSlider.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C051386D231075790055FD0B"
BuildableName = "GaugeSliderTest.app"
BlueprintName = "GaugeSliderTest"
ReferencedContainer = "container:GaugeSlider.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C051386D231075790055FD0B"
BuildableName = "GaugeSliderTest.app"
BlueprintName = "GaugeSliderTest"
ReferencedContainer = "container:GaugeSlider.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>GaugeSlider.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
<key>GaugeSliderTest.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>1</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
<dict>
<key>C051384623106DF50055FD0B</key>
<dict>
<key>primary</key>
<true/>
</dict>
<key>C051384F23106DF50055FD0B</key>
<dict>
<key>primary</key>
<true/>
</dict>
<key>C051386D231075790055FD0B</key>
<dict>
<key>primary</key>
<true/>
</dict>
</dict>
</dict>
</plist>
22 changes: 22 additions & 0 deletions GaugeSlider/Common/CgPath+Elements.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//
// CgPath+Elements.swift
// GaugeSlider
//
// Created by Edgar Žigis on 23/08/2019.
// Copyright © 2019 Edgar Žigis. All rights reserved.
//

import UIKit

extension CGPath {

func forEach(body: @escaping @convention(block) (CGPathElement) -> Void) {
typealias Body = @convention(block) (CGPathElement) -> Void
func callback(info: UnsafeMutableRawPointer?, element: UnsafePointer<CGPathElement>) {
let body = unsafeBitCast(info, to: Body.self)
body(element.pointee)
}
let unsafeBody = unsafeBitCast(body, to: UnsafeMutableRawPointer.self)
self.apply(info: unsafeBody, function: callback)
}
}
44 changes: 44 additions & 0 deletions GaugeSlider/Common/ProgressCounter.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
//
// ProgressCounter.swift
// GaugeSlider
//
// Created by Edgar Žigis on 23/08/2019.
// Copyright © 2019 Edgar Žigis. All rights reserved.
//

import UIKit

let kCounterRate = Float(3.0)

public protocol ProgressCounter {
func update(_ t: CGFloat) -> CGFloat
}

public class ProgressCounterLinear: ProgressCounter {
public func update(_ t: CGFloat) -> CGFloat {
return t
}
}

public class ProgressCounterEaseIn: ProgressCounter {
public func update(_ t: CGFloat) -> CGFloat {
return CGFloat(powf(Float(t), kCounterRate))
}
}

public class ProgressCounterEaseOut: ProgressCounter {
public func update(_ t: CGFloat) -> CGFloat {
return CGFloat(1.0 - powf(Float(1.0 - t), kCounterRate))
}
}

public class ProgressCounterEaseInOut: ProgressCounter {
public func update(_ t: CGFloat) -> CGFloat {
let newt: CGFloat = 2 * t
if newt < 1 {
return CGFloat(0.5 * powf (Float(newt), kCounterRate))
} else {
return CGFloat(0.5 * (2.0 - powf(Float(2.0 - newt), kCounterRate)))
}
}
}
22 changes: 22 additions & 0 deletions GaugeSlider/Common/UIBezierPath+FirstPoint.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//
// UIBezierPath+FirstPoint.swift
// GaugeSlider
//
// Created by Edgar Žigis on 23/08/2019.
// Copyright © 2019 Edgar Žigis. All rights reserved.
//

import UIKit

extension UIBezierPath {

func firstPoint() -> CGPoint? {
var firstPoint: CGPoint? = nil
cgPath.forEach { element in
guard firstPoint == nil else { return }
assert(element.type == .moveToPoint, "Expected the first point to be a move")
firstPoint = element.points.pointee
}
return firstPoint
}
}
19 changes: 19 additions & 0 deletions GaugeSlider/GaugeSlider.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//
// GaugeSlider.h
// GaugeSlider
//
// Created by Edgar Žigis on 23/08/2019.
// Copyright © 2019 Edgar Žigis. All rights reserved.
//

#import <UIKit/UIKit.h>

//! Project version number for GaugeSlider.
FOUNDATION_EXPORT double GaugeSliderVersionNumber;

//! Project version string for GaugeSlider.
FOUNDATION_EXPORT const unsigned char GaugeSliderVersionString[];

// In this header, you should import all the public headers of your framework using statements like #import <GaugeSlider/PublicHeader.h>


Loading

0 comments on commit a9a7538

Please sign in to comment.