Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
[7 Masters] Wearables - WatchShaker
Search
Ezequiel dos Santos
October 26, 2017
Programming
810
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
[7 Masters] Wearables - WatchShaker
Ezequiel dos Santos
October 26, 2017
Transcript
27 slides
7Masters - Wearables Ezequiel França WatchShaker! ⌚
Mecatrônica @ SENAI Automação Industrial @ IFSP Analise de Sistemas
@ FIAP Desenvolvedor iOS, Maker e open-source hacker. Ezequiel França
None
None
Heurística?
None
None
Let’s Shake
None
None
http://indiatoday.intoday.in/technology/story/apple-watch- handshakes-nfc-gestures/1/448093.html
None
None
lembrando rapidinho de protocolos delegates
protocol SomeProtocol { func someTypeMethod() }
protocol SomeProtocol { func someTypeMethod() } class SomeClass: SomeProtocol{ }
protocol WatchShakerDelegate { func watchShakerDidShake(_ watchShaker: WatchShaker) func watchShaker(_ watchShaker:WatchShaker,
didFailWith error: Error) }
protocol WatchShakerDelegate { func didShake() func didFail(error: Error) }
protocol WatchShakerDelegate { func watchShakerDidShake(_ watchShaker: WatchShaker) func watchShaker(_ watchShaker:WatchShaker,
didFailWith error: Error) }
class WatchShaker { public var delegate: WatchShakerDelegate? fileprivate var motionManager:
CMMotionManager! fileprivate var lastShakeDate: Date? !// The threshold for how much acceleration needs to happen before an event will register. fileprivate var threshold:Double !// Time between shakes fileprivate var delay:Double = 0.1
init(shakeSensibility to:ShakeSensibility, delay time:Double) { self.threshold = to.rawValue self.delay =
time self.motionManager = CMMotionManager() }
ShakeSensibility
enum ShakeSensibility: Double { case shakeSensibilitySoftest = 0.1 case shakeSensibilitySoft
= 0.7 case shakeSensibilityNormal = 1.0 case shakeSensibilityHard = 1.2 case shakeSensibilityHardest = 2.0 }
public func start(delay accelerometerUpdateInterval:Double = 0.02) { guard motionManager.isAccelerometerAvailable else
{ return } motionManager.accelerometerUpdateInterval = accelerometerUpdateInterval let motionQueue = OperationQueue() motionManager.startAccelerometerUpdates(to: motionQueue) { (accelerometerData, err) -> Void in guard err == nil else { self.delegate?.watchShaker(self, didFailWith: err!) return }
guard let data = accelerometerData else { let e =
NSError(domain: "No accelerometer data", code: 666, userInfo: ["No accelerometer data":"info"]) self.delegate?.watchShaker(self, didFailWith: e) return }
let valueX = fabs(data.acceleration.x) let valueY = fabs(data.acceleration.y) let maxValue
= valueX > valueY ? valueX : valueY if maxValue > self.threshold { if let lastDate = self.lastShakeDate { if Date().compare(lastDate.addingTimeInterval(self.delay)) !== .orderedDescending { self.lastShakeDate = Date() self.delegate!?.watchShakerDidShake(self) } return } self.lastShakeDate = Date() self.delegate!?.watchShakerDidShake(self) }
:) @ezefranca http://ezefranca.com
More Decks by Ezequiel dos Santos
See All by Ezequiel dos Santos
Game Code That Is Not Gameplay - IEEE CoG 2026
ezefranca
0
92
Serious Games for Food Waste Reduction
ezefranca
0
170
ICECER 2025: Cross-Device Motion Interaction via Apple’s Native System Frameworks
ezefranca
0
91
Fruta Feia – ICT in Circular Food Networks: A Scoping Review
ezefranca
0
58
[Segah 2025] Gamified Interventions for Composting Behavior in the Workplace
ezefranca
0
310
Gamified Interventions for Composting Behavior: A Case Study Using the Gamiflow Framework in a Workplace Setting
ezefranca
1
530
Comparative Analysis of AI Models in Managing Household Food Waste: OpenAI GPT-4, Google Gemini, Mistral, and Anthropic Claude
ezefranca
0
800
Decision-making algorithms and Planning Algorithms
ezefranca
1
570
Dependency Management in iOS Development: A Developer Survey Perspective
ezefranca
0
660
Other Decks in Programming
See All in Programming
AI時代のシニアエンジニアとは
yosuke_furukawa
PRO
15
11k
小さなアプリを作って公開するまで
onozaty
0
170
AIで開発が速くなった先で、開発チームは何を目指すか
shihochan
1
2k
graphql-ruby を Spinel で速くしようとした話
mtsmfm
0
140
クラウドゲーミングのパフォーマンス最適化に挑む / Cloud Gaming Performance Tuning
vivion
0
330
Seven New Principles of Software Engineering
yegor256
0
480
社内AIエージェント「Askワンバン」における コストチューニングの取り組み
t0yohei
0
170
protojson における文字化けの扱い
kazuki1023
0
380
Modernizing iOS Apps
seyfoyun
0
150
AI時代のTerminal環境を UNIX哲学で設計・運用する
yasunori0418
1
350
Claude Code ハーネスDeep Dive – 君はどこまで制御する? -
takateeen_knj
6
5.5k
Zero-Tap Sign-In対応、結局何をすればいいの?
mitohato14
0
2.1k
Featured
See All Featured
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
3.1k
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
2
2.2k
Raft: Consensus for Rubyists
vanstee
143
7.9k
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
68
60k
AI: The stuff that nobody shows you
jnunemaker
PRO
11
1.3k
Faster Mobile Websites
deanohume
310
32k
How to build a perfect <img>
jonoalderson
1
6.2k
sira's awesome portfolio website redesign presentation
elsirapls
0
500
Code Reviewing Like a Champion
maltzj
529
40k
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
2
2.1k
GraphQLとの向き合い方2022年版
quramy
50
15k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
250
1.3M