Skip to content

Various fixes and improvements #16

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: swift3
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .swift-version

This file was deleted.

3 changes: 2 additions & 1 deletion Example/Podfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
platform :ios, '9.0'
platform :ios, '10.0'

source 'https://github.com/CocoaPods/Specs.git'
use_frameworks!

def shared_pods
pod 'DynamicColor', '~> 3.1'
pod 'StyledLabel', '~> 2.0'
end

target 'SnappingStepper' do
Expand Down
2 changes: 1 addition & 1 deletion Example/SnappingStepper/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>2.3.1</string>
<string>3.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down
180 changes: 77 additions & 103 deletions Example/SnappingStepperExample.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

25 changes: 17 additions & 8 deletions Example/SnappingStepperExample/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11201" systemVersion="15G1004" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12120" systemVersion="16E195" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11161"/>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12088"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
Expand All @@ -18,6 +22,7 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<navigationBar contentMode="scaleToFill" translucent="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Jbl-la-odc">
<rect key="frame" x="0.0" y="20" width="375" height="44"/>
<constraints>
<constraint firstAttribute="height" constant="44" id="vQ2-5k-C4k"/>
</constraints>
Expand All @@ -26,8 +31,10 @@
</items>
</navigationBar>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Ix2-NP-H0n">
<rect key="frame" x="62.5" y="205.5" width="250" height="336"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="0.0" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="QWu-3t-c5V">
<rect key="frame" x="65" y="248" width="120" height="40"/>
<constraints>
<constraint firstAttribute="height" constant="40" id="ad0-m7-UQg"/>
<constraint firstAttribute="width" constant="120" id="nWk-ft-6Nw"/>
Expand All @@ -37,6 +44,7 @@
<nil key="highlightedColor"/>
</label>
<segmentedControl opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="top" segmentControlStyle="plain" selectedSegmentIndex="0" translatesAutoresizingMaskIntoConstraints="NO" id="ziz-Bb-wQ4">
<rect key="frame" x="20.5" y="296" width="209" height="29"/>
<constraints>
<constraint firstAttribute="height" constant="28" id="6yV-rm-FDw"/>
<constraint firstAttribute="width" constant="209" id="wcW-bI-hBy"/>
Expand All @@ -51,9 +59,10 @@
</connections>
</segmentedControl>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="sP4-mS-aEz">
<rect key="frame" x="16.5" y="16" width="217" height="224"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="p4I-GE-yJd" customClass="SnappingStepper" customModule="SnappingStepperExample" customModuleProvider="target">
<color key="backgroundColor" red="0.0" green="0.54268962144851685" blue="0.54826736450195312" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<rect key="frame" x="8" y="164" width="201" height="40"/>
<constraints>
<constraint firstAttribute="height" constant="40" id="vys-bF-8tL"/>
</constraints>
Expand All @@ -67,7 +76,7 @@
</connections>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="PCK-qc-iIc" customClass="SnappingStepper" customModule="SnappingStepperExample" customModuleProvider="target">
<color key="backgroundColor" red="0.0" green="0.54268962144851685" blue="0.54826736450195312" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<rect key="frame" x="8" y="68" width="153" height="40"/>
<constraints>
<constraint firstAttribute="height" constant="40" id="lDF-7o-LxK"/>
</constraints>
Expand All @@ -81,7 +90,7 @@
</connections>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="vQ2-aN-ZzV" customClass="SnappingStepper" customModule="SnappingStepperExample" customModuleProvider="target">
<color key="backgroundColor" red="0.0" green="0.54268962144851685" blue="0.54826736450195312" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<rect key="frame" x="8" y="20" width="201" height="40"/>
<constraints>
<constraint firstAttribute="height" constant="40" id="iX3-pt-Zhj"/>
</constraints>
Expand All @@ -95,7 +104,7 @@
</connections>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="aSQ-lY-OYI" customClass="SnappingStepper" customModule="SnappingStepperExample" customModuleProvider="target">
<color key="backgroundColor" red="0.0" green="0.54268962144851685" blue="0.54826736450195312" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<rect key="frame" x="169" y="68" width="40" height="88"/>
<constraints>
<constraint firstAttribute="width" constant="40" id="Ey0-ER-exA"/>
</constraints>
Expand All @@ -109,7 +118,7 @@
</connections>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Yv1-gG-72y" customClass="SnappingStepper" customModule="SnappingStepperExample" customModuleProvider="target">
<color key="backgroundColor" red="0.0" green="0.54268962144851685" blue="0.54826736450195312" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<rect key="frame" x="8" y="116" width="153" height="40"/>
<constraints>
<constraint firstAttribute="height" constant="40" id="dFm-bb-A27"/>
</constraints>
Expand Down
2 changes: 1 addition & 1 deletion Example/SnappingStepperExample/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>2.3.1</string>
<string>3.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down
19 changes: 12 additions & 7 deletions Example/SnappingStepperExample/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,27 @@ class ViewController: UIViewController {
assignStepperDefaultSettings(tubeStepper)
tubeStepper.style = .tube
tubeStepper.thumbStyle = .tube
tubeStepper.backgroundColor = UIColor(hex: 0xB2DFDB)
tubeStepper.styleColor = UIColor(hex: 0xB2DFDB)
tubeStepper.thumbBackgroundColor = UIColor(hex: 0x009688)
tubeStepper.hintStyle = .box

assignStepperDefaultSettings(roundedStepper)
roundedStepper.style = .rounded
roundedStepper.thumbStyle = .rounded
roundedStepper.backgroundColor = .clear
roundedStepper.styleColor = .clear
roundedStepper.thumbBackgroundColor = UIColor(hex: 0xFFC107)
roundedStepper.borderColor = UIColor(hex: 0xFFC107)
roundedStepper.borderWidth = 0.5
roundedStepper.hintStyle = .thumb
roundedStepper.hintStyle = .rounded
roundedStepper.thumbTextFormatString = "%0.2f"
roundedStepper.maximumValue = 1
roundedStepper.stepValue = 0.1
roundedStepper.stepFactor = 25

assignStepperDefaultSettings(customStepper)
customStepper.style = .custom(path: customDoubleArrowPath())
customStepper.thumbStyle = .thumb
customStepper.backgroundColor = .clear
customStepper.styleColor = .clear
customStepper.borderColor = UIColor(hex: 0x607D8B)
customStepper.thumbBackgroundColor = UIColor(hex: 0x607D8B)
customStepper.borderWidth = 0.5
Expand All @@ -51,18 +55,18 @@ class ViewController: UIViewController {
assignStepperDefaultSettings(verticalRoundedStepper)
verticalRoundedStepper.style = .rounded
verticalRoundedStepper.thumbStyle = .rounded
verticalRoundedStepper.backgroundColor = .clear
verticalRoundedStepper.styleColor = UIColor(hex: 0xFFC107).lighter().lighter()
verticalRoundedStepper.thumbBackgroundColor = UIColor(hex: 0xFFC107)
verticalRoundedStepper.borderColor = UIColor(hex: 0xFFC107)
verticalRoundedStepper.borderWidth = 0.5
verticalRoundedStepper.hintStyle = .thumb
verticalRoundedStepper.hintStyle = .rounded
verticalRoundedStepper.direction = .vertical
}

func assignStepperDefaultSettings(_ snappingStepper: SnappingStepper) {
snappingStepper.symbolFont = UIFont(name: "TrebuchetMS-Bold", size: 20)
snappingStepper.symbolFontColor = .black
snappingStepper.backgroundColor = UIColor(hex: 0xc0392b)
snappingStepper.styleColor = UIColor(hex: 0xc0392b)
snappingStepper.thumbWidthRatio = 0.4
snappingStepper.thumbText = nil
snappingStepper.thumbFont = UIFont(name: "TrebuchetMS-Bold", size: 18)
Expand All @@ -75,6 +79,7 @@ class ViewController: UIViewController {
snappingStepper.minimumValue = 0
snappingStepper.maximumValue = 1000
snappingStepper.stepValue = 1
snappingStepper.thumbTextFormatString = "%0.f"
}

func customDoubleArrowPath() -> UIBezierPath {
Expand Down
5 changes: 3 additions & 2 deletions SnappingStepper.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'SnappingStepper'
s.version = '2.4.0'
s.version = '3.0'
s.license = 'MIT'
s.summary = 'An elegant alternative to the UIStepper written in Swift'
s.homepage = 'https://github.com/yannickl/SnappingStepper.git'
Expand All @@ -9,9 +9,10 @@ Pod::Spec.new do |s|
s.source = { :git => 'https://github.com/yannickl/SnappingStepper.git', :tag => s.version }
s.screenshot = 'http://yannickloriot.com/resources/snappingstepper-screenshot.png'

s.ios.deployment_target = '8.0'
s.ios.deployment_target = '10.0'

s.dependency 'DynamicColor', '~> 3.1'
s.dependency 'StyledLabel', '~> 2.0'

s.framework = 'UIKit'
s.source_files = 'Sources/*.swift'
Expand Down
117 changes: 0 additions & 117 deletions Sources/CustomShapeLayer.swift

This file was deleted.

48 changes: 0 additions & 48 deletions Sources/ShapeStyle.swift

This file was deleted.

Loading