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
Yuka Ezura
August 20, 2016
Technology
6
4k
エラーと警告で コードをデザインする ~赤と黄の輪舞曲~
iosdc での発表資料です
Yuka Ezura
August 20, 2016
Tweet
Share
More Decks by Yuka Ezura
See All by Yuka Ezura
Mastering share sheet preview
ezura
4
1.3k
SF Symbols
ezura
9
1.2k
気遣いの iOS プログラミング
ezura
11
3.3k
Secret Swift tour
ezura
7
2.8k
Swift Album ver.4.1
ezura
3
1.4k
Swift と Kotlin
ezura
4
2.6k
哲学とSwiftの発表
ezura
5
580
アプリが動いたその先へ (iOS アプリ開発編)
ezura
1
950
Blending Kotlin's culture into Swift
ezura
1
1.2k
Other Decks in Technology
See All in Technology
初心者向けAWS Securityの勉強会mini Security-JAWSを9ヶ月ぐらい実施してきての近況
cmusudakeisuke
0
130
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
0
100
第1回 国土交通省 データコンペ参加者向け勉強会③- Snowflake x estie編 -
estie
0
130
10XにおけるData Contractの導入について: Data Contract事例共有会
10xinc
6
660
SREが投資するAIOps ~ペアーズにおけるLLM for Developerへの取り組み~
takumiogawa
1
430
複雑なState管理からの脱却
sansantech
PRO
1
150
強いチームと開発生産性
onk
PRO
35
11k
OTelCol_TailSampling_and_SpanMetrics
gumamon
1
200
New Relicを活用したSREの最初のステップ / NRUG OKINAWA VOL.3
isaoshimizu
3
630
TanStack Routerに移行するのかい しないのかい、どっちなんだい! / Are you going to migrate to TanStack Router or not? Which one is it?
kaminashi
0
600
Incident Response Practices: Waroom's Features and Future Challenges
rrreeeyyy
0
160
AGIについてChatGPTに聞いてみた
blueb
0
130
Featured
See All Featured
Git: the NoSQL Database
bkeepers
PRO
427
64k
Code Review Best Practice
trishagee
64
17k
Building Your Own Lightsaber
phodgson
103
6.1k
Mobile First: as difficult as doing things right
swwweet
222
8.9k
Into the Great Unknown - MozCon
thekraken
32
1.5k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
44
6.8k
The Cost Of JavaScript in 2023
addyosmani
45
6.8k
The World Runs on Bad Software
bkeepers
PRO
65
11k
The Invisible Side of Design
smashingmag
298
50k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
GraphQLとの向き合い方2022年版
quramy
43
13k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
93
16k
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 ͔ΒҰ෦༷͕มߋ͞Ε·͢
ᓸͣ ͖ͣͯͫ͘͝Ħ
ͦਗ਼ௌ͔Μ͞ͺ͖ͦͨ͘ΐͩͱĈ