Skip to content

Commit

Permalink
Example with ScrollView for Swiftui 💡
Browse files Browse the repository at this point in the history
  • Loading branch information
chicio committed Nov 25, 2023
1 parent e249f32 commit 77dc262
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 15 deletions.
31 changes: 16 additions & 15 deletions RangeUISliderDemo/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="17701" 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="22155" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="j89-zd-GID">
<device id="retina4_7" orientation="portrait" appearance="light"/>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17703"/>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22131"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
Expand All @@ -20,11 +21,11 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="6Mr-cc-gmO" userLabel="End Marker">
<rect key="frame" x="309" y="20" width="6" height="627"/>
<rect key="frame" x="309" y="40" width="6" height="587"/>
<accessibility key="accessibilityConfiguration" identifier="endMarker"/>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="hrj-qG-B2M" userLabel="Start Marker">
<rect key="frame" x="60" y="20" width="6" height="627"/>
<rect key="frame" x="60" y="40" width="6" height="587"/>
<accessibility key="accessibilityConfiguration" identifier="startMarker"/>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Qlf-kb-ke1" userLabel="Middle Marker">
Expand Down Expand Up @@ -399,7 +400,7 @@
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Min Value" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="eyz-uQ-FCa">
<rect key="frame" x="24" y="33" width="74" height="21"/>
<rect key="frame" x="24" y="53" width="74" height="21"/>
<color key="backgroundColor" red="0.91779082700000003" green="1" blue="0.90423119389999995" alpha="1" colorSpace="custom" customColorSpace="displayP3"/>
<constraints>
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="74" id="cuq-OS-ExI"/>
Expand All @@ -409,7 +410,7 @@
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text=" " textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="z5i-lw-uPj">
<rect key="frame" x="127" y="33" width="95" height="21"/>
<rect key="frame" x="127" y="53" width="95" height="21"/>
<color key="backgroundColor" red="0.91779082700000003" green="1" blue="0.90423119389999995" alpha="1" colorSpace="custom" customColorSpace="displayP3"/>
<accessibility key="accessibilityConfiguration" identifier="minValueSelectedLabel"/>
<constraints>
Expand All @@ -420,7 +421,7 @@
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text=" " textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="EpL-Zo-8qW">
<rect key="frame" x="127" y="62" width="95" height="21"/>
<rect key="frame" x="127" y="82" width="95" height="21"/>
<color key="backgroundColor" red="0.91779082700000003" green="1" blue="0.90423119389999995" alpha="1" colorSpace="custom" customColorSpace="displayP3"/>
<accessibility key="accessibilityConfiguration" identifier="maxValueSelectedLabel"/>
<constraints>
Expand All @@ -431,7 +432,7 @@
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Max Value" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ef1-J9-uze">
<rect key="frame" x="24" y="62" width="78" height="21"/>
<rect key="frame" x="24" y="82" width="78" height="21"/>
<color key="backgroundColor" red="0.91779082700000003" green="1" blue="0.90423119389999995" alpha="1" colorSpace="custom" customColorSpace="displayP3"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
Expand Down Expand Up @@ -525,14 +526,14 @@
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" accessoryType="detailDisclosureButton" indentationWidth="10" reuseIdentifier="GroupedFeaturesCell" textLabel="wjV-jt-TfT" style="IBUITableViewCellStyleDefault" id="1N5-sd-erk">
<rect key="frame" x="0.0" y="28" width="375" height="44"/>
<rect key="frame" x="0.0" y="50" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="1N5-sd-erk" id="QOo-eX-JJN">
<rect key="frame" x="0.0" y="0.0" width="316" height="44"/>
<rect key="frame" x="0.0" y="0.0" width="316.5" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="wjV-jt-TfT">
<rect key="frame" x="16" y="0.0" width="292" height="44"/>
<rect key="frame" x="16" y="0.0" width="292.5" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
Expand Down Expand Up @@ -830,7 +831,7 @@
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="none" indentationWidth="10" reuseIdentifier="CellWithSlider" rowHeight="100" id="ewv-mI-oXT" customClass="CellWithSlider" customModule="RangeUISliderDemo" customModuleProvider="target">
<rect key="frame" x="0.0" y="28" width="375" height="100"/>
<rect key="frame" x="0.0" y="50" width="375" height="100"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="ewv-mI-oXT" id="k2a-7i-CaJ">
<rect key="frame" x="0.0" y="0.0" width="375" height="100"/>
Expand Down Expand Up @@ -1166,7 +1167,7 @@
</tabBarItem>
<toolbarItems/>
<navigationBar key="navigationBar" contentMode="scaleToFill" id="JGV-6H-Ukh">
<rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
<rect key="frame" x="0.0" y="20" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
<nil name="viewControllers"/>
Expand Down Expand Up @@ -1205,7 +1206,7 @@
</hostingController>
<placeholder placeholderIdentifier="IBFirstResponder" id="ElY-kc-aj6" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="3551" y="624"/>
<point key="canvasLocation" x="3497" y="643"/>
</scene>
<!--Change Default Knobs Values Programmatic View Controller-->
<scene sceneID="XG0-tI-pEg">
Expand Down Expand Up @@ -1246,7 +1247,7 @@
<color red="1" green="0.23137254901960785" blue="0.18823529411764706" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</systemColor>
<systemColor name="systemTealColor">
<color red="0.35294117647058826" green="0.78431372549019607" blue="0.98039215686274506" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color red="0.18823529411764706" green="0.69019607843137254" blue="0.7803921568627451" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</systemColor>
</resources>
</document>
35 changes: 35 additions & 0 deletions RangeUISliderDemo/SwiftUIHostingViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,41 @@ struct SwiftUIHostingView: View {
.rightKnobCorners(17.5)
.showKnobsLabels(true)
.knobsLabelTopPosition(false)

VStack{
ScrollView {
Text("Example inside ScrollView")
RangeSlider(minValueSelected: self.$minValueSelected, maxValueSelected: self.$maxValueSelected)
.scaleMinValue(5)
.scaleMaxValue(80)
.defaultValueLeftKnob(10)
.defaultValueRightKnob(40)
.rangeSelectedGradientColor1(Color(#colorLiteral(red: 0.4745098054, green: 0.8392156959, blue: 0.9764705896, alpha: 1)))
.rangeSelectedGradientColor2(Color(#colorLiteral(red: 0.2392156869, green: 0.6745098233, blue: 0.9686274529, alpha: 1)))
.rangeSelectedGradientStartPoint(CGPoint(x: 0, y: 0.5))
.rangeSelectedGradientEndPoint(CGPoint(x: 0, y: 1))
.rangeNotSelectedGradientColor1(Color(#colorLiteral(red: 0.2196078449, green: 0.007843137719, blue: 0.8549019694, alpha: 1)))
.rangeNotSelectedGradientColor2(Color(#colorLiteral(red: 0.09019608051, green: 0, blue: 0.3019607961, alpha: 1)))
.rangeNotSelectedGradientStartPoint(CGPoint(x: 0, y: 0.5))
.rangeNotSelectedGradientEndPoint(CGPoint(x: 0, y: 1))
.barHeight(20)
.barCorners(10)
.leftKnobColor(Color(#colorLiteral(red: 0.5725490451, green: 0, blue: 0.2313725501, alpha: 1)))
.leftKnobWidth(40)
.leftKnobHeight(40)
.leftKnobCorners(20)
.rightKnobColor(Color(#colorLiteral(red: 0.5725490451, green: 0, blue: 0.2313725501, alpha: 1)))
.rightKnobWidth(40)
.rightKnobHeight(40)
.rightKnobCorners(20)
.showKnobsLabels(true)
.knobsLabelFontSize(18)
.knobsLabelFontColor(Color(.red))
.knobsLabelNumberOfDecimal(1)
.accessibility(identifier: "RangeUISliderStandard")
.frame(maxWidth: .infinity, minHeight: 100)
}
}
Spacer()
}.padding(30)
}
Expand Down

0 comments on commit 77dc262

Please sign in to comment.