Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/chicio/RangeUISlider
Browse files Browse the repository at this point in the history
  • Loading branch information
chicio committed Dec 4, 2020
2 parents 26fba2c + 8286717 commit b57ce5d
Show file tree
Hide file tree
Showing 11 changed files with 157 additions and 23 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/build-ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,6 @@ jobs:
- name: Build iOS Demo
run: |
set -o pipefail && xcodebuild -project Demo.xcodeproj -scheme Demo-Release clean build CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO -destination 'platform=iOS Simulator,name=iPhone 8,OS=latest' | xcpretty
- name: Build SPM demo
run: |
set -o pipefail && xcodebuild -project DemoSPM.xcodeproj -scheme DemoSPM clean build CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO -destination 'platform=iOS Simulator,name=iPhone 8,OS=latest' | xcpretty
12 changes: 8 additions & 4 deletions Demo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
451E7846224FA103004C861F /* SliderInsideTableViewViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 451E7845224FA103004C861F /* SliderInsideTableViewViewController.swift */; };
451E7849224FA979004C861F /* CellWithSlider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 451E7848224FA979004C861F /* CellWithSlider.swift */; };
45BD66C7209B36F100A19D22 /* SetupProgrammaticViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 45BD66C6209B36F100A19D22 /* SetupProgrammaticViewController.swift */; };
45D4884B252DBBDC00FE51E3 /* ChangeProgrammaticViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 45D48849252DBBDC00FE51E3 /* ChangeProgrammaticViewController.swift */; };
45D4884B252DBBDC00FE51E3 /* ChangeKnobsProgrammaticViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 45D48849252DBBDC00FE51E3 /* ChangeKnobsProgrammaticViewController.swift */; };
45D8822E2577C74A00BBC241 /* ChangeScaleProgrammaticViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 45D8822C2577C74A00BBC241 /* ChangeScaleProgrammaticViewController.swift */; };
5F42D28F1E8FDF8F008F15CE /* GroupedFeaturesTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F42D28E1E8FDF8F008F15CE /* GroupedFeaturesTableViewController.swift */; };
5F9045671E913EE000607428 /* RangeUISlider.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5F42D28B1E8FB2F9008F15CE /* RangeUISlider.framework */; };
5F9045681E913EE000607428 /* RangeUISlider.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 5F42D28B1E8FB2F9008F15CE /* RangeUISlider.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
Expand Down Expand Up @@ -49,7 +50,8 @@
451E7845224FA103004C861F /* SliderInsideTableViewViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SliderInsideTableViewViewController.swift; sourceTree = "<group>"; };
451E7848224FA979004C861F /* CellWithSlider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CellWithSlider.swift; sourceTree = "<group>"; };
45BD66C6209B36F100A19D22 /* SetupProgrammaticViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SetupProgrammaticViewController.swift; sourceTree = "<group>"; };
45D48849252DBBDC00FE51E3 /* ChangeProgrammaticViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ChangeProgrammaticViewController.swift; sourceTree = "<group>"; };
45D48849252DBBDC00FE51E3 /* ChangeKnobsProgrammaticViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ChangeKnobsProgrammaticViewController.swift; sourceTree = "<group>"; };
45D8822C2577C74A00BBC241 /* ChangeScaleProgrammaticViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ChangeScaleProgrammaticViewController.swift; sourceTree = "<group>"; };
45E215441E8F064600F0B8B9 /* RangeUISlider.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; path = RangeUISlider.xcodeproj; sourceTree = "<group>"; };
5F42D28E1E8FDF8F008F15CE /* GroupedFeaturesTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GroupedFeaturesTableViewController.swift; sourceTree = "<group>"; };
5FCE8A2C1E79D1A400F888BC /* Demo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Demo.app; sourceTree = BUILT_PRODUCTS_DIR; };
Expand Down Expand Up @@ -104,7 +106,8 @@
5FCE8A2F1E79D1A400F888BC /* AppDelegate.swift */,
451E7848224FA979004C861F /* CellWithSlider.swift */,
5FCE8A311E79D1A400F888BC /* ViewController.swift */,
45D48849252DBBDC00FE51E3 /* ChangeProgrammaticViewController.swift */,
45D48849252DBBDC00FE51E3 /* ChangeKnobsProgrammaticViewController.swift */,
45D8822C2577C74A00BBC241 /* ChangeScaleProgrammaticViewController.swift */,
45BD66C6209B36F100A19D22 /* SetupProgrammaticViewController.swift */,
451E7845224FA103004C861F /* SliderInsideTableViewViewController.swift */,
5F42D28E1E8FDF8F008F15CE /* GroupedFeaturesTableViewController.swift */,
Expand Down Expand Up @@ -208,9 +211,10 @@
buildActionMask = 2147483647;
files = (
5F42D28F1E8FDF8F008F15CE /* GroupedFeaturesTableViewController.swift in Sources */,
45D8822E2577C74A00BBC241 /* ChangeScaleProgrammaticViewController.swift in Sources */,
5FCE8A321E79D1A400F888BC /* ViewController.swift in Sources */,
45BD66C7209B36F100A19D22 /* SetupProgrammaticViewController.swift in Sources */,
45D4884B252DBBDC00FE51E3 /* ChangeProgrammaticViewController.swift in Sources */,
45D4884B252DBBDC00FE51E3 /* ChangeKnobsProgrammaticViewController.swift in Sources */,
5FCE8A301E79D1A400F888BC /* AppDelegate.swift in Sources */,
451E7849224FA979004C861F /* CellWithSlider.swift in Sources */,
451E7846224FA103004C861F /* SliderInsideTableViewViewController.swift in Sources */,
Expand Down
2 changes: 1 addition & 1 deletion Demo.xcodeproj/xcshareddata/xcschemes/Demo-Debug.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1200"
LastUpgradeVersion = "1220"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1200"
LastUpgradeVersion = "1220"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
30 changes: 25 additions & 5 deletions Demo/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="17156" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="j89-zd-GID">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="17506" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="j89-zd-GID">
<device id="retina4_7" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17125"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17505"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
Expand Down Expand Up @@ -460,7 +460,8 @@
<segue destination="Tkx-hT-lmn" kind="show" identifier="showOnlyGradientsSegue" id="I2y-s7-KCo"/>
<segue destination="dWr-eS-hUn" kind="show" identifier="showProgrammaticSetupSegue" id="3bz-bm-ReS"/>
<segue destination="RLA-sf-Itw" kind="show" identifier="showTableViewSetupSegue" id="T5P-TY-50T"/>
<segue destination="HX8-Hb-IrR" kind="show" identifier="showChangeProgrammaticSegue" id="l5L-tk-hZo"/>
<segue destination="HX8-Hb-IrR" kind="show" identifier="showChangeKnobProgrammaticSegue" id="l5L-tk-hZo"/>
<segue destination="IzU-JN-Igw" kind="show" identifier="showChangeScaleProgrammaticSegue" id="rdG-zv-TLf"/>
</connections>
</tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="Z9F-n4-isO" userLabel="First Responder" sceneMemberID="firstResponder"/>
Expand Down Expand Up @@ -674,10 +675,10 @@
</objects>
<point key="canvasLocation" x="2553" y="609"/>
</scene>
<!--Change Programmatic View Controller-->
<!--Change Knobs Programmatic View Controller-->
<scene sceneID="MR2-3S-4kX">
<objects>
<viewController id="HX8-Hb-IrR" customClass="ChangeProgrammaticViewController" customModule="Demo" customModuleProvider="target" sceneMemberID="viewController">
<viewController id="HX8-Hb-IrR" customClass="ChangeKnobsProgrammaticViewController" customModule="Demo" customModuleProvider="target" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="Afg-58-x2W"/>
<viewControllerLayoutGuide type="bottom" id="RR1-Z8-gUs"/>
Expand Down Expand Up @@ -1028,6 +1029,25 @@
</objects>
<point key="canvasLocation" x="645.60000000000002" y="704.79760119940033"/>
</scene>
<!--Change Scale Programmatic View Controller-->
<scene sceneID="xgV-r8-PBM">
<objects>
<viewController id="IzU-JN-Igw" customClass="ChangeScaleProgrammaticViewController" customModule="Demo" customModuleProvider="target" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="zn7-71-4aA"/>
<viewControllerLayoutGuide type="bottom" id="cb5-Y6-Cum"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="cjF-c7-hUB">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
</view>
<navigationItem key="navigationItem" id="Xig-pF-h3p"/>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="NTR-oG-1dO" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="3697" y="1397"/>
</scene>
</scenes>
<resources>
<image name="knob" width="87" height="87"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// SetupProgrammaticViewController.swift
// ChangeKnobsProgrammaticViewController.swift
// Demo
//
// Created by Fabrizio Duroni on 03/05/2018.
Expand All @@ -9,7 +9,7 @@
import UIKit
import RangeUISlider

class ChangeProgrammaticViewController: UIViewController, RangeUISliderDelegate {
class ChangeKnobsProgrammaticViewController: UIViewController, RangeUISliderDelegate {
private var rangeSlider: RangeUISlider!

override func viewDidLoad() {
Expand Down
89 changes: 89 additions & 0 deletions Demo/ChangeScaleProgrammaticViewController.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
//
// ChangeScaleProgrammaticViewController.swift
// Demo
//
// Created by Fabrizio Duroni on 03/05/2018.
// 2018 Fabrizio Duroni.
//

import UIKit
import RangeUISlider

class ChangeScaleProgrammaticViewController: UIViewController, RangeUISliderDelegate {
private var rangeSlider: RangeUISlider!

override func viewDidLoad() {
super.viewDidLoad()
rangeSlider = RangeUISlider(frame: CGRect(origin: CGPoint(x: 20, y: 20), size: CGSize(width: 100, height: 50)))
rangeSlider.translatesAutoresizingMaskIntoConstraints = false
rangeSlider.delegate = self
rangeSlider.scaleMinValue = 0 //If you don't set any value the default is 0
rangeSlider.scaleMaxValue = 100 //If you don't set any value the default is 1
rangeSlider.defaultValueLeftKnob = 10 //If the scale is the default one insert a value between 0 and 1
rangeSlider.defaultValueRightKnob = 75 //If the scale is the default one insert a value between 0 and 1
rangeSlider.rangeSelectedGradientColor1 = #colorLiteral(red: 0.4745098054, green: 0.8392156959, blue: 0.9764705896, alpha: 1)
rangeSlider.rangeSelectedGradientColor2 = #colorLiteral(red: 0.2392156869, green: 0.6745098233, blue: 0.9686274529, alpha: 1)
rangeSlider.rangeSelectedGradientStartPoint = CGPoint(x: 0, y: 0.5)
rangeSlider.rangeSelectedGradientEndPoint = CGPoint(x: 0, y: 1)
rangeSlider.rangeNotSelectedGradientColor1 = #colorLiteral(red: 0.2196078449, green: 0.007843137719, blue: 0.8549019694, alpha: 1)
rangeSlider.rangeNotSelectedGradientColor2 = #colorLiteral(red: 0.09019608051, green: 0, blue: 0.3019607961, alpha: 1)
rangeSlider.rangeNotSelectedGradientStartPoint = CGPoint(x: 0, y: 0.5)
rangeSlider.rangeNotSelectedGradientEndPoint = CGPoint(x: 0, y: 1)
rangeSlider.barHeight = 20
rangeSlider.barCorners = 10
rangeSlider.leftKnobColor = #colorLiteral(red: 0.5725490451, green: 0, blue: 0.2313725501, alpha: 1)
rangeSlider.leftKnobWidth = 40
rangeSlider.leftKnobHeight = 40
rangeSlider.leftKnobCorners = 20
rangeSlider.rightKnobColor = #colorLiteral(red: 0.5725490451, green: 0, blue: 0.2313725501, alpha: 1)
rangeSlider.rightKnobWidth = 40
rangeSlider.rightKnobHeight = 40
rangeSlider.rightKnobCorners = 20
self.view.addSubview(rangeSlider)

//Setup slide with programmatic autolayout.
NSLayoutConstraint.activate([
NSLayoutConstraint(item: rangeSlider!,
attribute: .leading,
relatedBy: .equal,
toItem: self.view,
attribute: .leading,
multiplier: 1.0,
constant: 20),
NSLayoutConstraint(item: rangeSlider!,
attribute: .trailing,
relatedBy: .equal,
toItem: self.view,
attribute: .trailing,
multiplier: 1.0,
constant: -20),
NSLayoutConstraint(item: rangeSlider!,
attribute: .top,
relatedBy: .equal,
toItem: self.view,
attribute: .top,
multiplier: 1.0,
constant: 100),
NSLayoutConstraint(item: rangeSlider!,
attribute: .height,
relatedBy: .equal,
toItem: nil,
attribute: .notAnAttribute,
multiplier: 1.0,
constant: 50)
])

DispatchQueue.main.asyncAfter(deadline: .now() + 5) {
self.rangeSlider.scaleMinValue = 50
self.rangeSlider.scaleMaxValue = 200
}
}

func rangeChangeFinished(minValueSelected: CGFloat, maxValueSelected: CGFloat, slider: RangeUISlider) {
print("FINISH min: \(minValueSelected) - max: \(maxValueSelected) - identifier: \(slider.identifier)")
}

func rangeIsChanging(minValueSelected: CGFloat, maxValueSelected: CGFloat, slider: RangeUISlider) {
print("min: \(minValueSelected) - max: \(maxValueSelected) - identifier: \(slider.identifier)")
}
}
3 changes: 2 additions & 1 deletion Demo/GroupedFeaturesTableViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ class GroupedFeaturesTableViewController: UITableViewController {
GroupedFeaturesViewControllerData(description: "Only gradients", segueIdentifier: "showOnlyGradientsSegue"),
GroupedFeaturesViewControllerData(description: "Programmatic setup", segueIdentifier: "showProgrammaticSetupSegue"),
GroupedFeaturesViewControllerData(description: "Inside UITableView", segueIdentifier: "showTableViewSetupSegue"),
GroupedFeaturesViewControllerData(description: "Programmatic change", segueIdentifier: "showChangeProgrammaticSegue")
GroupedFeaturesViewControllerData(description: "Programmatic knob change", segueIdentifier: "showChangeKnobProgrammaticSegue"),
GroupedFeaturesViewControllerData(description: "Programmatic scale change", segueIdentifier: "showChangeScaleProgrammaticSegue")
]

override func numberOfSections(in tableView: UITableView) -> Int {
Expand Down
4 changes: 3 additions & 1 deletion RangeUISlider.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
45BD66D1209B60D900A19D22 /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
45BD66D2209B60DA00A19D22 /* CHANGELOG.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = CHANGELOG.md; sourceTree = "<group>"; };
45BD66D3209B60DA00A19D22 /* LICENSE.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = LICENSE.md; sourceTree = "<group>"; };
45D8822F2577CA0E00BBC241 /* build-ios.yml */ = {isa = PBXFileReference; lastKnownFileType = text.yaml; name = "build-ios.yml"; path = ".github/workflows/build-ios.yml"; sourceTree = "<group>"; };
45E215241E8E812E00F0B8B9 /* RangeUISlider.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = RangeUISlider.framework; sourceTree = BUILT_PRODUCTS_DIR; };
45E215271E8E812E00F0B8B9 /* RangeUISlider.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RangeUISlider.h; sourceTree = "<group>"; };
45E215281E8E812E00F0B8B9 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
Expand Down Expand Up @@ -63,6 +64,7 @@
45BD66D2209B60DA00A19D22 /* CHANGELOG.md */,
45BD66D3209B60DA00A19D22 /* LICENSE.md */,
45BD66D1209B60D900A19D22 /* README.md */,
45D8822F2577CA0E00BBC241 /* build-ios.yml */,
4548B54D252DE5720068E389 /* generate_docs */,
458E1B90257A9CC800165AA7 /* RangeUISlider.podspec */,
45E603C4233A432C00E7465D /* Package.swift */,
Expand Down Expand Up @@ -134,7 +136,7 @@
45E2151B1E8E812E00F0B8B9 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1200;
LastUpgradeCheck = 1220;
ORGANIZATIONNAME = "Fabrizio Duroni";
TargetAttributes = {
45E215231E8E812E00F0B8B9 = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1200"
LastUpgradeVersion = "1220"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Loading

0 comments on commit b57ce5d

Please sign in to comment.