Skip to content

Commit

Permalink
no message
Browse files Browse the repository at this point in the history
  • Loading branch information
Ramiz69 committed Oct 15, 2023
1 parent d0aa52a commit 70f5643
Show file tree
Hide file tree
Showing 9 changed files with 132 additions and 5 deletions.
Binary file not shown.
78 changes: 78 additions & 0 deletions Slider.xcodeproj/xcshareddata/xcschemes/Slider_Example.xcscheme
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1400"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "4B2EB6E123C1E5AA00FB91AD"
BuildableName = "Slider_Example.app"
BlueprintName = "Slider_Example"
ReferencedContainer = "container:Slider.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
</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 = "4B2EB6E123C1E5AA00FB91AD"
BuildableName = "Slider_Example.app"
BlueprintName = "Slider_Example"
ReferencedContainer = "container:Slider.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "4B2EB6E123C1E5AA00FB91AD"
BuildableName = "Slider_Example.app"
BlueprintName = "Slider_Example"
ReferencedContainer = "container:Slider.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
9 changes: 9 additions & 0 deletions Slider/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.DS_Store
/.build
/Packages
/*.xcodeproj
xcuserdata/
DerivedData/
.swiftpm/config/registries.json
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
.netrc
23 changes: 23 additions & 0 deletions Slider/Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// swift-tools-version: 5.7

import PackageDescription

let package = Package(
name: "Slider",
platforms: [.iOS(.v13)],
products: [
.library(
name: "Slider",
targets: ["Slider"]),
],
dependencies: [],
targets: [
.target(
name: "Slider",
dependencies: []),
.testTarget(
name: "SliderTests",
dependencies: ["Slider"]),
],
swiftLanguageVersions: [.v5]
)
3 changes: 2 additions & 1 deletion Slider/Protocols/Protocols.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
//
import UIKit

@objc public protocol SliderDelegate: AnyObject {
@objc
public protocol SliderDelegate: AnyObject {
func slider(_ slider: Slider, displayTextForValue value: CGFloat) -> String
func didBeginTracking(_ slider: Slider)
func didContinueTracking(_ slider: Slider)
Expand Down
3 changes: 3 additions & 0 deletions Slider/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Slider

A description of this package.
9 changes: 5 additions & 4 deletions Slider/Slider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ open class Slider: UIControl {
final public var usableTrackingLength: CGFloat = .zero
private let trackMaskLayer = CAShapeLayer()

// MARK: - Life cycle
// MARK: - Initial methods

required public override init(frame: CGRect) {
super.init(frame: frame)
Expand All @@ -253,6 +253,8 @@ open class Slider: UIControl {
commonInit()
}

// MARK: - Life cycle

public override func layoutSubviews() {
super.layoutSubviews()

Expand All @@ -271,8 +273,7 @@ open class Slider: UIControl {
redrawLayers()
}

// MARK: - Custom methods
// MARK: Private methods
// MARK: - Private methods

private func initialControl() {
backgroundColor = .clear
Expand Down Expand Up @@ -347,7 +348,7 @@ open class Slider: UIControl {
translatesAutoresizingMaskIntoConstraints = false
}

// MARK: - Update methods
// MARK: Update methods

private func reinitComponentValues() {
trackLayer.minimumValue = minimum
Expand Down
4 changes: 4 additions & 0 deletions Slider/SliderTrackLayer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,17 @@ import UIKit

public final class SliderTrackLayer: CALayer {

// MARK: - Properties

public var value: CGFloat = .zero
public var minimumValue: CGFloat = .zero
public var maximumValue: CGFloat = 1
public var thumbWidth: CGFloat = .zero
public var trackMaxColor: UIColor!
public var trackMinColor: UIColor!

// MARK: - Life cycle

override public func draw(in ctx: CGContext) {
ctx.setFillColor(trackMaxColor.cgColor)
ctx.addPath(UIBezierPath(roundedRect: bounds, cornerRadius: cornerRadius).cgPath)
Expand Down
8 changes: 8 additions & 0 deletions Slider/Tests/SliderTests/SliderTests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import XCTest
@testable import Slider

final class SliderTests: XCTestCase {
func testExample() throws {
XCTAssertEqual(0, 0)
}
}

0 comments on commit 70f5643

Please sign in to comment.