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
エラーと警告で コードをデザインする ~赤と黄の輪舞曲~
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Yuka Ezura
August 20, 2016
Technology
4.4k
6
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
エラーと警告で コードをデザインする ~赤と黄の輪舞曲~
iosdc での発表資料です
Yuka Ezura
August 20, 2016
More Decks by Yuka Ezura
See All by Yuka Ezura
Mastering share sheet preview
ezura
4
1.5k
SF Symbols
ezura
9
1.5k
気遣いの iOS プログラミング
ezura
11
3.8k
Secret Swift tour
ezura
7
3.1k
Swift Album ver.4.1
ezura
3
1.6k
Swift と Kotlin
ezura
4
3k
哲学とSwiftの発表
ezura
5
660
アプリが動いたその先へ (iOS アプリ開発編)
ezura
1
1.2k
Blending Kotlin's culture into Swift
ezura
1
1.4k
Other Decks in Technology
See All in Technology
AIペネトレーションテスト・ セキュリティ検証「AgenticSec」紹介資料
laysakura
2
9.4k
同じWAFが、攻撃の“形”は弾く── 正当な“形”の不正は通す
kuroneko13
0
270
AI時代に、人は何を、どう学ぶのか #pbl_pub / What and How Do We Learn in the AI Era?
takaking22
1
240
Invisible to AI? Making TYPO3 Sites Quotable by AI Search Systems
wolfgangwagner
0
250
AIに持続⼒を与える 判断の⻑期記憶設計
eiei114
1
670
AI開発に用いられるHPC技術について
gpuunite_official
0
260
作って理解するCoding Agent 〜フレームワークに頼らないピュア Python での実装〜
takapy
3
1.1k
2027年のMetricKit
kantacky
0
160
コネクションをピン留めさせずに SELECTクエリのタイムアウトを設定した話
codmoninc
0
210
三人寄ればチューリング完全
puhitaku
6
3k
AIに狂うスタートアップが、あえて「人との協働」に全振りした新卒エンジニア研修 / New Graduate Engineer Training at a Startup Accelerating AI Adoption
ohnoeight
0
190
dbt と Snowflake と tag
kevinrobot34
1
160
Featured
See All Featured
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
500
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
Navigating Team Friction
lara
192
16k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.9k
Designing for Performance
lara
611
70k
The Illustrated Children's Guide to Kubernetes
chrisshort
51
53k
The #1 spot is gone: here's how to win anyway
tamaranovitovic
3
1.1k
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
1
2.5k
Optimizing for Happiness
mojombo
378
71k
Automating Front-end Workflow
addyosmani
1369
210k
WCS-LA-2024
lcolladotor
0
800
Side Projects
sachag
455
43k
Transcript
έϮ⑲ͺຓ θ⑲ώΤόλΩϸͫΝ _᧬ͺԫᇷዛູ_ 2016/8/20 ezura
FSSPS͜ṽͫ͟͝Ħ
XBSOJOH͜ṽͫ͟͝Ħ
None
None
None
Δͩ͘ͼΛj
Δ͵ͺ᪇͡ ཱͺᲇձ͖ͱ͝͵ͱj
ဒᘥ ࣮ḝ ᙉණ
͟ΝĈ ᦉᷯΔ͔Ν
࣮ḝ᧸ͽុΜΤ᧬ͺԫᓸ ᓸͣΑΐͩΙ͘
έϮ⑲ͺຓ θ⑲ώΤόλΩϸͫΝ _᧬ͺԫᇷዛູ_
↟1IBOUPN5ZQF ↟%FDMBSBUJPO"UUSJCVUFT
$BTF
class HogeOperation { /// Ұ͚ͩݺͿ͜ͱ func prepare() /// prepare ޙ͔Β͑Δ
func execute() /// ͍ͭݺΜͰྑ͍ func mob() }
/// Ұ͚ͩݺͿ͜ͱ /// prepare ޙ͔Β͑Δ
private var isPrepared = false /// Ұ͚ͩݺͿ͜ͱ func prepare() {
guard !isPrepared else { fatalError("prepare() Λෳݺͳ͍͜ͱ") } isPrepared = true }
None
None
όλΩϸͩΚ͘Ĉ
1IBOUPN5ZQF ܕใΛར༻ͯ͠ॲཧͷޡΓΛࢦఠՄೳʹ
ᴰᨷঢ়ỪΑ ᑿᠭ൱ၙͼϦςψώΤᨷᤅ
protocol OperationState {} class Init: OperationState {} class Prepared: OperationState
{}
class HogeOperation<State: OperationState> {}
extension HogeOperation where State: Init { /// Ұ͚ͩݺͿ͜ͱ func prepared()
-> HogeOperation<Prepared> { let readyOp = HogeOperation<Prepared>() // TODO: ඞཁͳσʔλΛҾ͖ܧ͗ return readyOp } }
θϸϖΩϰέϮ⑲ ỹ ỹ
None
extension HogeOperation where State: Prepared { /// prepare ΛݺΜͩޙ͔Β༻Մೳ func
execute() { /* do somethig */ } }
θϸϖΩϰέϮ⑲
ଓ͟8FC https://gist.github.com/ezura/ f5aebef7bb86edbfd40b0bd1d0435e00
1IBOUPN5ZQF͖Ο͖Ο ↟ 'VODUJPOBM4OJQQFU1IBOUPN5ZQFT ↟ 4XJGU.POFZXJUI1IBOUPN5ZQFT ↟ 4XJGU1IBOUPN5ZQF ྶṞ ↟
1IBOUPN5ZQFθϸϖΩϰᙉͽঢ়ᴋφάψδͫΝ TIJCVZBTXJGU ↑ ঢ়ଶભҠΛ៉ྷʹදݱ͍ͯͯ͠ײಈ
$BTF
/// ΘΓʹ fuga Λ͏͜ͱʂ func hoge() { … }
όλΩϸͩΚ͘Ĉ
%FDMBSBUJPO "UUSJCVUFT ใΛ༩
/// ΘΓʹ fuga() Λ͏͜ͱʂ @available(*, unavailable, message="͓ޚ໔͞…(ƅωƅ)", renamed="fuga") func hoge()
{ … }
/// ΘΓʹ fuga() Λ͏͜ͱʂ @available(*, unavailable, message="͓ޚ໔͞…(ƅωƅ)", renamed="fuga") func hoge()
{ … }
/// ΘΓʹ fuga() Λ͏͜ͱʂ @available(iOS, deprecated=1, message="͓ޚ໔͞…(ƅωƅ)", renamed="fuga") func hoge()
{ … }
ᬋණ ↟ !BWBJMBCMF ↟ !EJTDBSEBCMF3FTVMU 4XJGU͝Λ ↟ !XBSO@VOVTFE@SFTVMU 4XJGUഇᬬ
: Swift3 ͔ΒҰ෦༷͕มߋ͞Ε·͢
ᓸͣ ͖ͣͯͫ͘͝Ħ
ͦਗ਼ௌ͔Μ͞ͺ͖ͦͨ͘ΐͩͱĈ