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
技術的負債の正体を知って向き合う / Facing Technical Debt
irof
0
170
チームの境界をブチ抜いていけ
tokai235
0
170
そのpreloadは必要?見過ごされたpreloadが技術的負債として爆発した日
mugitti9
2
3.3k
「ちょっと古いから」って避けてた技術書、今だからこそ読もう
mottyzzz
10
6.7k
10年もののAPIサーバーにおけるCI/CDの改善の奮闘
mbook
0
820
Range on Rails ―「多重範囲型」という新たな選択肢が、複雑ロジックを劇的にシンプルにしたワケ
rizap_tech
0
120
kiroとCodexで最高のSpec駆動開発を!!数時間で web3ネイティブなミニゲームを作ってみたよ!
mashharuki
0
170
SpecKitでどこまでできる? コストはどれくらい?
leveragestech
0
750
コードとあなたと私の距離 / The Distance Between Code, You, and I
hiro_y
0
160
Building, Deploying, and Monitoring Ruby Web Applications with Falcon (Kaigi on Rails 2025)
ioquatix
4
2.1k
その面倒な作業、「Dart」にやらせませんか? Flutter開発者のための業務効率化
yordgenome03
1
130
Advance Your Career with Open Source
ivargrimstad
0
510
Featured
See All Featured
For a Future-Friendly Web
brad_frost
180
9.9k
Become a Pro
speakerdeck
PRO
29
5.5k
GraphQLとの向き合い方2022年版
quramy
49
14k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
20
1.2k
Producing Creativity
orderedlist
PRO
347
40k
Music & Morning Musume
bryan
46
6.8k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
359
30k
A better future with KSS
kneath
239
18k
Faster Mobile Websites
deanohume
310
31k
Product Roadmaps are Hard
iamctodd
PRO
54
11k
Mobile First: as difficult as doing things right
swwweet
224
10k
Visualization
eitanlees
149
16k
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)
͋Γ͕ͱ͏ ͍͟͝·ͨ͠