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
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Ezequiel dos Santos
May 17, 2017
Technology
750
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
[#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
More Decks by Ezequiel dos Santos
See All by Ezequiel dos Santos
Game Code That Is Not Gameplay - IEEE CoG 2026
ezefranca
0
22
Serious Games for Food Waste Reduction
ezefranca
0
82
ICECER 2025: Cross-Device Motion Interaction via Apple’s Native System Frameworks
ezefranca
0
66
Fruta Feia – ICT in Circular Food Networks: A Scoping Review
ezefranca
0
39
[Segah 2025] Gamified Interventions for Composting Behavior in the Workplace
ezefranca
0
280
Gamified Interventions for Composting Behavior: A Case Study Using the Gamiflow Framework in a Workplace Setting
ezefranca
1
500
Comparative Analysis of AI Models in Managing Household Food Waste: OpenAI GPT-4, Google Gemini, Mistral, and Anthropic Claude
ezefranca
0
750
Decision-making algorithms and Planning Algorithms
ezefranca
1
550
Dependency Management in iOS Development: A Developer Survey Perspective
ezefranca
0
630
Other Decks in Technology
See All in Technology
Azure Cost Management の FOCUS コストデータを迷わず読むための“3つの軸”
tetsuyaooooo
0
150
なぜSRE・セキュリティは評価されないのか?守りの組織を事業成長エンジンに変えた実践
cscengineer
PRO
3
2.3k
Jetpack Compose で挑む新聞紙面UI ─ 複合ジェスチャー・ポリゴン記事領域・適応的ページ構成という3つの壁/droidkaigi2026
nikkei_engineer_recruiting
0
230
Benchmarking Vector Databases: pgvector vs. LanceDB
tsho
0
140
少人数データチームのDevin活用実践事例
runandy16
2
450
DINO-EdgeQuery:Edge-First Polygon Decoding for Building Footprint Extraction from Satellite Imagery
lehupa
0
150
「重なり」は迎える側がつくる ― 人もAIエージェントも歓迎するプロダクトエンジニアリング ―
go0517go
PRO
0
260
現場に行くだけでは足りない——プロダクトエンジニアが業務の流れを捉える観点と、その鍛え方
takumiengineering
0
300
Bet AI Day 2026丨Agentは、「金融」という巨大産業の何を変えられるのか
layerx
PRO
0
1k
bet_ai_day_2026_session02
agenticsec
1
1.2k
Bet AI Day 2026丨AIによって本質に戻るシステムリスク管理
layerx
PRO
0
1.2k
Bet AI Day 2026丨Production-Ready AI Agents — エンタープライズの実務を任せるための設計と運用
layerx
PRO
3
2.4k
Featured
See All Featured
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
1
2.9k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
2.1k
Design in an AI World
tapps
1
300
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
270
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
2.1k
Joys of Absence: A Defence of Solitary Play
codingconduct
1
480
brightonSEO & MeasureFest 2025 - Christian Goodrich - Winning strategies for Black Friday CRO & PPC
cargoodrich
3
810
Mind Mapping
helmedeiros
1
350
The Curious Case for Waylosing
cassininazir
1
500
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
230
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
6.1k
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
❤)