Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Speaker Deck
PRO
Sign in
Sign up
for free
Force Touch APIs in OS X
cockscomb
July 11, 2015
Programming
0
580
Force Touch APIs in OS X
Presented at Cocoa勉強会関西62
cockscomb
July 11, 2015
Tweet
Share
More Decks by cockscomb
See All by cockscomb
cockscomb
0
150
cockscomb
5
1.1k
cockscomb
10
9k
cockscomb
2
6.4k
cockscomb
1
6.1k
cockscomb
7
1.5k
cockscomb
5
6.6k
cockscomb
0
2.4k
cockscomb
0
2.1k
Other Decks in Programming
See All in Programming
mizdra
7
4.8k
itosho525
0
130
anchorcable
1
120
line_developers_tw
0
370
rishitdagli
0
170
cwozaki
1
1.6k
supikiti
3
1.2k
line_developers_tw
1
340
jun0
3
630
zsmb
1
120
masayaaoyama
4
530
nauleyco
0
200
Featured
See All Featured
jlugia
216
16k
samanthasiow
56
6.3k
kastner
54
1.9k
edds
56
9.3k
sugarenia
233
830k
aarron
258
36k
sachag
267
17k
smashingmag
283
47k
searls
204
35k
dougneiner
55
5.4k
addyosmani
1348
190k
holman
288
130k
Transcript
Force Touch The New Dimension
cockscomb
None
Force Touch The New Dimension
Force Touch Trackpad
Force Touch APIs
None
NSButton • func setButtonType(_ aType: NSButtonType) • NSAcceleratorButton • NSMultiLevelAcceleratorButton
NSAcceleratorButton @IBOutlet weak var acceleratorButton: NSButton! { didSet { acceleratorButton.continuous
= true acceleratorButton .setPeriodicDelay(0.1, interval: 0.1) } } @IBAction func accelerate(sender: AnyObject) { if let button = sender as? NSButton { print(button.doubleValue) } }
NSMultiLevelAcceleratorButton @IBOutlet weak var multiLevelAcceratorButton: NSButton! { didSet { if
#available(OSX 10.10.3, *) { multiLevelAcceratorButton .maxAcceleratorLevel = 5 } } } @IBAction func multiLevelAccelerate(sender: AnyObject) { if let button = sender as? NSButton { print(button.integerValue) } }
NSButton • NSAcceleratorButton • doubleValue • 0.0, 1.0..<2.0 • NSMultiLevelAcceleratorButton
• integerValue • 0, 1, 2..<maxAcceleratorLevel
NSEvent • NSView • NSGestureRecognizer • NSWindow
NSEventTypePressure class PressureView: NSView { override func pressureChangeWithEvent(event: NSEvent) {
Swift.print("Pressure : \(event.pressure)") if #available(OSX 10.10.3, *) { Swift.print("Stage : \(event.stage)") Swift.print(“State Transition : \(event.stageTransition)") } } }
NSEvent • NSEventTypePressure • var pressure: Float { get }
• Pressure value • var stage: Int { get } • Pressed stage • var stageTransition: CGFloat { get } • For transition animation
El Capitan • NSAlignmentFeedbackFilter • Sample Code: AlignmentGuides • NSHapticFeedbackManager
• enum NSHapticFeedbackPattern • Generic/Alignment/LevelChange • And more…
Force Touch • A new dimension of the UI •
APIs are available (improved with El Capitan) • Will be introduced into iOS 9?