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
CSC305 Lecture 02
javiergs
PRO
1
260
NetworkXとGNNで学ぶグラフデータ分析入門〜複雑な関係性を解き明かすPythonの力〜
mhrtech
3
960
Web技術を最大限活用してRAW画像を現像する / Developing RAW Images on the Web
ssssota
2
1.1k
CSC305 Lecture 04
javiergs
PRO
0
230
AI Coding Meetup #3 - 導入セッション / ai-coding-meetup-3
izumin5210
0
320
育てるアーキテクチャ:戦い抜くPythonマイクロサービスの設計と進化戦略
fujidomoe
1
150
(Extension DC 2025) Actor境界を越える技術
teamhimeh
1
210
iOSアプリの信頼性を向上させる取り組み/ios-app-improve-reliability
shino8rayu9
0
140
Go Conference 2025: Goで体感するMultipath TCP ― Go 1.24 時代の MPTCP Listener を理解する
takehaya
7
1.5k
どの様にAIエージェントと 協業すべきだったのか?
takefumiyoshii
1
570
Let's Write a Train Tracking Algorithm
twocentstudios
0
220
dynamic!
moro
9
5.6k
Featured
See All Featured
Navigating Team Friction
lara
189
15k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
9
840
Fireside Chat
paigeccino
40
3.7k
Writing Fast Ruby
sferik
629
62k
The Invisible Side of Design
smashingmag
301
51k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
34
6.1k
How STYLIGHT went responsive
nonsquared
100
5.8k
Building Adaptive Systems
keathley
43
2.8k
Making Projects Easy
brettharned
118
6.4k
The Power of CSS Pseudo Elements
geoffreycrofte
79
6k
How to Think Like a Performance Engineer
csswizardry
27
2k
A designer walks into a library…
pauljervisheath
208
24k
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)
͋Γ͕ͱ͏ ͍͟͝·ͨ͠