Skip to content

Commit 1417a12

Browse files
committed
Improve documentation primarily around pointer support
1 parent 63a8336 commit 1417a12

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,18 @@ A slider control designed to be easy to grab and use because it can be dragged o
1717
- Supports light & dark appearance using semantic system colors by default (iOS 13+)
1818
- Adjustable haptic feedback (iOS 10+)
1919
- VoiceOver support
20+
- Supports pointer (e.g. trackpad or mouse) based scrolling on iPadOS (iOS 13.4+)
2021

2122
## Example
2223

2324
To run the example project, clone the repo, and run `pod install` from the Example directory first.
2425

2526
## Requirements
2627

27-
iOS 8.0+ (iOS 10.0+ required for haptic feedback)
28+
iOS 8.0+
29+
30+
- iOS 10.0+ required for haptic feedback
31+
- iPadOS 13.4+ required for pointer use
2832

2933
## Installation
3034

@@ -59,7 +63,8 @@ slider.reverseValueAxis = true
5963
```swift
6064
slider.isContinuous = false
6165
slider.enableTapping = false // allow or disallow tapping anywhere on the slider track to instantly set a value
62-
slider.scaleUpWhenInUse = true // make the slider puff up slightly while being dragged
66+
slider.feedbackStyle = .medium // customize haptic feedback
67+
slider.isScrollingEnabled = false // allow or disallow scrolling to adjust the slider using a connected pointing device on iPadOS
6368
```
6469

6570
### Changing colors and appearance
@@ -68,6 +73,7 @@ slider.scaleUpWhenInUse = true // make the slider puff up slightly while being d
6873
slider.trackBackground = UIColor.black.withAlpha(0.8) // use translucent black for the slider track
6974
slider.tintColor = UIColor.systemGreen // use dynamic green for the slider thumb
7075
slider.cornerRadius = 12
76+
slider.isPointerInteractionEnabled = true // display a hover effect when under the pointer on iPadOS
7177
```
7278

7379
### Interface Builder

TactileSlider/Classes/TactileSlider.swift

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ import UIKit
108108
/// If true, the slider can be adjusted by scrolling with a pointing device (e.g. two-finger scrolling with a trackpad or scrolling a mouse wheel).
109109
///
110110
/// - Requires: iOS 13.4
111+
///
112+
/// This setting only affects iPadOS with a connected pointing device.
111113
@IBInspectable open var isScrollingEnabled: Bool = true {
112114
didSet {
113115
if #available(iOS 13.4, *) {
@@ -116,12 +118,16 @@ import UIKit
116118
}
117119
}
118120

119-
/// If true, the slider will use a hover effect as the pointer hovers over it.
121+
/// If true, the slider will display a hover effect as the pointer hovers over it.
120122
///
121123
/// Override the `pointerStyle(with:)` method to customize the effect.
122124
///
125+
/// - Note: Enabling this option is intended to communicate to the user that they can easily perform an action using the pointer. Enabling `isScrollingEnabled`, `enableTapping`, __and__ allowing at least indirect touches using `allowedTapTypes` is recommended if this option is enabled.
126+
///
123127
/// - Requires: iOS 13.4
124-
@IBInspectable open var isPointerInteractionEnabled: Bool = true
128+
///
129+
/// This setting only affects iPadOS with a connected pointing device.
130+
@IBInspectable open var isPointerInteractionEnabled: Bool = false
125131

126132
/// If true, the slider will animate its scale when it is being dragged
127133
///
@@ -130,7 +136,7 @@ import UIKit
130136

131137
/// The color of the track the slider slides along
132138
///
133-
/// - Note: By default, this is set to `tertiarySystemFill`, which the [documentation](https://developer.apple.com/documentation/uikit/uicolor/ui_element_colors) specifies is for filling large shapes. Be sure to use an appropriate fill color for the size of the control.
139+
/// - Note: By default, this is set to `tertiarySystemFill`, which is intended for filling large shapes. Be sure to [choose an appropriate fill color](https://developer.apple.com/documentation/uikit/uicolor/ui_element_colors) for the size of the control.
134140
///
135141
/// - Important: On iOS versions prior to iOS 13 that do not support dynamic system colors, this defaults to `lightGray`.
136142
@IBInspectable open var trackBackground: UIColor = {

0 commit comments

Comments
 (0)