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
Swift 2.2 の新機能
Search
Kazuki Ohara
April 02, 2016
Programming
0
510
Swift 2.2 の新機能
Kazuki Ohara
April 02, 2016
Tweet
Share
Other Decks in Programming
See All in Programming
実用的なGOCACHEPROG実装をするために / golang.tokyo #40
mazrean
1
270
ソフトウェアテスト徹底指南書の紹介
goyoki
1
150
Navigating Dependency Injection with Metro
zacsweers
3
260
MCPで実現するAIエージェント駆動のNext.jsアプリデバッグ手法
nyatinte
7
1.1k
MCPでVibe Working。そして、結局はContext Eng(略)/ Working with Vibe on MCP And Context Eng
rkaga
5
2.3k
ぬるぬる動かせ! Riveでアニメーション実装🐾
kno3a87
1
210
Laravel Boost 超入門
fire_arlo
3
210
Deep Dive into Kotlin Flow
jmatsu
1
330
MCPとデザインシステムに立脚したデザインと実装の融合
yukukotani
4
1.4k
Ruby×iOSアプリ開発 ~共に歩んだエコシステムの物語~
temoki
0
270
Navigation 2 を 3 に移行する(予定)ためにやったこと
yokomii
0
160
そのAPI、誰のため? Androidライブラリ設計における利用者目線の実践テクニック
mkeeda
2
290
Featured
See All Featured
It's Worth the Effort
3n
187
28k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.4k
The Cult of Friendly URLs
andyhume
79
6.6k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3k
A better future with KSS
kneath
239
17k
Documentation Writing (for coders)
carmenintech
74
5k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
285
13k
BBQ
matthewcrist
89
9.8k
Large-scale JavaScript Application Architecture
addyosmani
512
110k
YesSQL, Process and Tooling at Scale
rocio
173
14k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
30
9.7k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
29
1.9k
Transcript
4XJGUͷ৽ػೳ େݪҰً
ࣗݾհ w ඇܞଳ ήʔϜձࣾͰ ඇήʔϜ J04ΞϓϦΛ࡞ͬͯΔ ΤϯδχΞ w 4XJGUྐྵϲ݄ऑ w
5XJUUFS!PSDIFMZ w 'BDFCPPLLB[VLJPIBSB w 2JJUBPSDIFMZ
None
΄ͱΜͲͷ ΩʔϫʔυΛҾϥϕϧͰ ͑ΔΑ͏ʹ͢Δ
Ҿϥϕϧ indexOf(value, in: collection) ҾͷׂΛ໌֬ʹ͠ ՄಡੑΛ্ͤ͞Δ
Ͱ JOΩʔϫʔυ
let names = [ "C", "Objective-C", "Swift" ] for name
in names { print("Hello \(name)!") }
͑ͳ͍ʂ
4XJGUͰશͯͷΩʔϫʔυ͕ Ҿϥϕϧͱͯ͠ ͑ΔΑ͏ʹͳΓ·ͨ͠ ͨͩ͠MFU WBS JOPVUআ͘
λϓϧൺֱԋࢉࢠ
λϓϧΛ͑Ϋϥεɺ ߏମΛఆٛ͢Δ͜ͱͳ͘ ෳͷཁૉΛ࣋ͭσʔλΛѻ͑Δ let rhythm = (3, 3, 7)
͔ؔΒෳͷΛ ฦ͢߹ʹศར func getRhythm() -> (Int, Int, Int) { return
(3, 3, 7) } let rhythm = getRhythm()
͔͠͠ ൺֱԋࢉࢠ͕ͳ͍
let rhythm = getRhythm() if rhythm == (5, 7, 5)
{ print("haiku") } ͜ͷΤϥʔʹͳΔ
4XJGUͰλϓϧʹ͕ ͑ΔΑ͏ʹͳͬͨ ଞʹ
Ҿϥϕϧ͖ͷ ؔͷ໊લ
extension UIView { func insertSubview(view: UIView, at index: Int) func
insertSubview(view: UIView, aboveSubview siblingSubview: UIView) func insertSubview(view: UIView, belowSubview siblingSubview: UIView) } 4XJGUͰ໊લಉ͡ͰҾ ϥϕϧ͕ҧ͏͕ؔΑ͋͘Δ
͔͠͠ ݺͼग़͢Ҏ֎ͷతͰ ͜ͷؔΛࢦఆ͢Δ߹ɺ ҾϥϕϧΛ༩͑ΒΕͳ͍ͷͰ ᐆດʹͳΔ let someView: UIView = ...
let fn = someView.insertSubview
Ͳͷ JOTFSU4VC7JFX
4XJGUͰҾϥϕϧΛ ࢦఆͰ͖ΔΑ͏ʹͳͬͨ MFUGOTPNF7JFXJOTFSU4VCWJFX @BU MFUGOTPNF7JFXJOTFSU4VCWJFX @BCPWF4VCWJFX
ηϨΫλͷࢦఆํ๏
class NSNotificationCenter { func addObserver(_ observer: AnyObject, selector aSelector: Selector,
name aName: String?, object anObject: AnyObject?) } 4XJGUͰϝιουΛࢦఆ͢Δ ͨΊͷηϨΫλͱ͍͏ͷΛ ͏͜ͱ͕͋Δ
ྫϘϦϡʔϜ͕มԽͨ͠Β TFMG ଟ"QQ%FMFHBUF ͷ WPMVNF$IBOHFEϝιου͕ ݺΕΔΑ͏ʹొ͢Δ NotificationCenter.defaultCenter().addObserver(self, selector: "volumeChanged:", name:
"AVSystemController_SystemVolumeDidChangeNotification", object: nil) ηϨΫλʹจࣈྻΛͬͯ ϝιουΛࢦఆ͍ͯ͠Δ
ίϯύΠϥจࣈྻͷ༰Λ νΣοΫ͠ͳ͍ ଘࡏ͠ͳ͍ϝιουͩͱ ࣮ߦ࣌Τϥʔ͕ى͖Δʂ
͜Μͳͷόάͷݩ Ͱ͢ΑͶ
4XJGUͰ͜͏ॻ͚·͢ ଘࡏ͠ͳ͍ϝιουΛࢦఆ͢Δͱ ίϯύΠϧΤϥʔʹͳΓ ࣮ߦ࣌ΤϥʔΛ͛·͢ NotificationCenter.defaultCenter().addObserver(self, selector: #selector(AppDelegate.volumeChanged(_:)), name: "AVSystemController_SystemVolumeDidChangeNotification", object:
nil)
͋Γ͕ͱ͏ ͍͟͝·ͨ͠