Lock in $30 Savings on PRO—Offer Ends Soon! ⏳
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Force Touch APIs in OS X
Search
cockscomb
July 11, 2015
Programming
0
810
Force Touch APIs in OS X
Presented at Cocoa勉強会関西62
cockscomb
July 11, 2015
Tweet
Share
More Decks by cockscomb
See All by cockscomb
jq at the Shortcuts
cockscomb
1
2k
GraphQL放談
cockscomb
4
2.1k
GraphQL Highway
cockscomb
28
8.6k
吉田を支える技術
cockscomb
0
2.4k
コーポレートサイトを静的化してAmplify Consoleにデプロイする
cockscomb
0
3.4k
ユーザインターフェイスと非同期処理
cockscomb
5
2k
GUIアプリケーションの構造と設計
cockscomb
10
10k
イカリング2におけるシングルページアプリケーション
cockscomb
2
7.6k
あなたの知らない UIKit の世界 — UITableView に UITextView を置きたい
cockscomb
1
7.5k
Other Decks in Programming
See All in Programming
モデル駆動設計をやってみようワークショップ開催報告(Modeling Forum2025) / model driven design workshop report
haru860
0
270
TestingOsaka6_Ozono
o3
0
150
令和最新版Android Studioで化石デバイス向けアプリを作る
arkw
0
400
WebRTC と Rust と8K 60fps
tnoho
2
2k
Context is King? 〜Verifiability時代とコンテキスト設計 / Beyond "Context is King"
rkaga
9
1.2k
AIエンジニアリングのご紹介 / Introduction to AI Engineering
rkaga
6
2.1k
AIの誤りが許されない業務システムにおいて“信頼されるAI” を目指す / building-trusted-ai-systems
yuya4
6
3.4k
dotfiles 式年遷宮 令和最新版
masawada
1
770
Integrating WordPress and Symfony
alexandresalome
0
150
実は歴史的なアップデートだと思う AWS Interconnect - multicloud
maroon1st
0
110
TUIライブラリつくってみた / i-just-make-TUI-library
kazto
1
380
251126 TestState APIってなんだっけ?Step Functionsテストどう変わる?
east_takumi
0
320
Featured
See All Featured
The Invisible Side of Design
smashingmag
302
51k
Side Projects
sachag
455
43k
Typedesign – Prime Four
hannesfritz
42
2.9k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.3k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.6k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
5.8k
Facilitating Awesome Meetings
lara
57
6.7k
Java REST API Framework Comparison - PWX 2021
mraible
34
9k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
9
1k
Context Engineering - Making Every Token Count
addyosmani
9
510
Imperfection Machines: The Place of Print at Facebook
scottboms
269
13k
Done Done
chrislema
186
16k
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?