Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
[#2 Swift Meetup SP - 2017] Heurísticas e Swif...
Search
Ezequiel dos Santos
May 17, 2017
Technology
0
510
[#2 Swift Meetup SP - 2017] Heurísticas e Swift: Do “NSProcessInfo” à um shake no Apple Watch
#2 Swift Meetup SP
https://github.com/ezefranca/WatchShaker
Ezequiel dos Santos
May 17, 2017
Tweet
Share
More Decks by Ezequiel dos Santos
See All by Ezequiel dos Santos
Fruta Feia – ICT in Circular Food Networks: A Scoping Review
ezefranca
0
3
[Segah 2025] Gamified Interventions for Composting Behavior in the Workplace
ezefranca
0
54
Gamified Interventions for Composting Behavior: A Case Study Using the Gamiflow Framework in a Workplace Setting
ezefranca
1
260
Comparative Analysis of AI Models in Managing Household Food Waste: OpenAI GPT-4, Google Gemini, Mistral, and Anthropic Claude
ezefranca
0
410
Decision-making algorithms and Planning Algorithms
ezefranca
1
330
Dependency Management in iOS Development: A Developer Survey Perspective
ezefranca
0
390
Mestrado: Gestos e jogos: reflexões e desenvolvimento de um sistema de detecção de gestos baseado em wearables para controle de jogos
ezefranca
0
600
Server-Driven UI na prática
ezefranca
0
540
Modelo Clássico e Jogos (Jesper Jull) e exergames.
ezefranca
0
380
Other Decks in Technology
See All in Technology
歴代のWeb Speed Hackathonの出題から考えるデグレしないパフォーマンス改善
shuta13
6
590
Gaze-LLE: Gaze Target Estimation via Large-Scale Learned Encoders
kzykmyzw
0
310
生成AI利用プログラミング:誰でもプログラムが書けると 世の中どうなる?/opencampus202508
okana2ki
0
190
Amazon Bedrock AgentCore でプロモーション用動画生成エージェントを開発する
nasuvitz
6
400
Yahoo!ニュースにおけるソフトウェア開発
lycorptech_jp
PRO
0
290
サービスロボット最前線:ugoが挑むPhysical AI活用
kmatsuiugo
0
190
人を動かすことについて考える
ichimichi
2
320
EKS Pod Identity における推移的な session tags
z63d
1
200
Android Studio の 新しいAI機能を試してみよう / Try out the new AI features in Android Studio
yanzm
0
260
mruby(PicoRuby)で ファミコン音楽を奏でる
kishima
1
150
Evolution on AI Agent and Beyond - AGI への道のりと、シンギュラリティの3つのシナリオ
masayamoriofficial
0
140
第64回コンピュータビジョン勉強会@関東(後編)
tsukamotokenji
0
220
Featured
See All Featured
Bash Introduction
62gerente
614
210k
Bootstrapping a Software Product
garrettdimon
PRO
307
110k
Become a Pro
speakerdeck
PRO
29
5.5k
Product Roadmaps are Hard
iamctodd
PRO
54
11k
4 Signs Your Business is Dying
shpigford
184
22k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3k
The Invisible Side of Design
smashingmag
301
51k
Building Adaptive Systems
keathley
43
2.7k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4k
Balancing Empowerment & Direction
lara
2
580
Site-Speed That Sticks
csswizardry
10
780
Transcript
Swift Meetup SP Heurísticas e Swift: Do “NSProcessInfo” a um
shake no Apple Watch Ezequiel França
Mecatrônica @ SENAI Automação Industrial @ IFSP Analise de Sistemas
@ FIAP Desenvolvedor iOS, Maker e open-source hacker. Ezequiel França
https://www.youtube.com/watch?v=BoeRfMBVCGo
None
Swift Meetup SP ❤
Heurísticas?
None
None
None
None
None
None
None
http://mathwiki.cs.ut.ee/asymptotics/05_polynomial_complexity
Let’s Shake
None
None
http://indiatoday.intoday.in/technology/story/apple-watch- handshakes-nfc-gestures/1/448093.html
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
None
None
3 vouchers para o curso de SpriteKit (100% em Swift
❤)