-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathindex.html
108 lines (103 loc) · 7.79 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
---
layout: home
---
{% assign size_chapters = site.data.book.chapters | size %}
{% assign col_width = 100 | divided_by: size_chapters %}
<div style="width: 100%; text-align: center;">
<img src="/img/swift-heart.png" style="width: 512px; max-width: 100%;" />
<h1>Heart of Swift</h1>
</div>
<section style="text-align: center; width: 100%;">
<h2 id="introduction">はじめに</h2>
<div style="text-align: left;">
<p><strong>Swift は <em>値型</em> を中心とした特徴的なプログラミング言語です。</strong>多くのプログラミング言語は <em>参照型</em> が中心のため、他のプログラミング言語の経験者でも、その違いに戸惑うことは少なくありません。 Swift がどのようなコンセプトの言語なのかを理解していないと、 Swift らしくない( Swifty でない)非効率なコードを書いてしまいがちです。そこで <strong>"Heart of Swift"</strong> と題して、筆者が Swift を学ぶ上で最も重要だと思うことをまとめたのが本書です。</p>
<p>Heart という単語には、「心臓」の他に「心」や「中心」などの意味があります。</p>
<div style="width: fit-content; margin: 0 auto 15px auto;">
<h3 style="margin: 0 0 4px 0; padding: 0; font-size: x-large; border: none;">heart</h3>
<div style="margin: 0 0 4px 0;"><span style="border: solid 1px; border-radius: 2px; padding: 2px;">名詞</span></div>
<ol style="margin-left: 20px;">
<li>心臓</li>
<li><strong class="accent">心</strong>, 気持ち</li>
<li>[the 〜] <strong class="accent">中心</strong>, 真ん中</li>
</ol>
</div>
<p>"Heart of Swift" というタイトルには、 Swift の根幹をなす概念(中心)や、 Swift という言語がプログラマにどのようなコードを書くことを期待しているか(心)といった意味を込めています。本書が目指すのは、 Swift の Heart (中心)となる概念を説明することを通して、 Swift の Heart (心)の形を描き出すことです。</p>
<p>では、 Swift の Heart (中心)となる概念とは何でしょうか。それが次の二つです。</p>
<ul>
<li><strong><em>Value Semantics</em></strong></li>
<li><strong><em>Protocol-oriented Programming</em></strong></li>
</ul>
<p><em>Value Semantics</em> と <em>Protocol-oriented Programming</em> については、 <a href="https://developer.apple.com/videos/wwdc2015/">WWDC 2015</a> のセッションの中で詳しく説明されています。</p>
<ul>
<li><a href="https://developer.apple.com/videos/play/wwdc2015/414/">"Building Better Apps with Value Types in Swift"</a><br />
<span class="weak"><strong class="accent">Doug Gregor</strong> & Bill Dudney, Session 414, WWDC 2015</span></li>
<li><a href="https://developer.apple.com/videos/play/wwdc2015/408/">"Protocol-Oriented Programming in Swift"</a><br />
<span class="weak"><strong class="accent">Dave Abrahams</strong>, Session 408, WWDC 2015</span></li>
</ul>
<p>これらのセッションの発表者の内、<span class="accent">赤字</span>の二人は <a href="https://swift.org/community/#core-team">Swift Core Team</a> のメンバーです。 Swift の言語仕様の変更や追加は <a href="https://github.com/apple/swift-evolution">Swift Evolution</a> で話し合われますが、その議論を統括して最終的な意思決定を下すのが Swift Core Team です。 Swift の生みの親である Chris Lattner さんも Core Team のメンバーの一人です。まさに Core Team は Swift の中枢と言えます。上記の二つのセッションは、 Swift がどのようなコンセプトの言語なのかを Core Team のメンバーが自らの口で語ったものであり、数ある Swift 関連のセッションの中でも特に重要な二つだと筆者は考えています。</p>
<p>しかし、 2015 年当時から Swift は大きく進化しました。当時の Swift のバージョンは 1.2 です。当然ですが、それらのセッションには Swift の最新事情は反映されていません。たとえば、 Swift 5.1 で <em>Opaque Result Type</em> ( <a href="https://developer.apple.com/xcode/swiftui/">SwiftUI</a> などで多用される <code>some View</code> のような <code>some</code> の付いた型)が導入されました。 <em>Opaque Result Type</em> は <em>Value Semantics</em> と <em>Protocol-oriented Programming</em> の延長上に存在するものですが、 2015 年当時にそれを論じることはできません。</p>
<p>そこで本書は、 <em>Value Semantics</em> と <em>Protocol-oriented Programming</em> を軸に Swift の最新事情を考慮して話を再構築し、言語の根幹について、その全体像を示そうと試みました。本書が、 Swift という言語を理解する手助けになることを願います。</p>
</div>
</section>
<section style="text-align: center; width: 100%;">
<h2 id="table-of-contents">目次</h2>
<table>
<tr>
<th>
<a href="/#introduction">はじめに</a>
</th>
</tr>
{% for chapter in site.data.book.chapters %}
<tr>
<th>
{% if chapter.is_draft %}
第 {{ forloop.index }} 章 {{ chapter.name }} (準備中)
{% else %}
<a href="{{ chapter.path }}">第 {{ forloop.index }} 章 {{ chapter.name }}</a>
{% endif %}
</th>
</tr>
<tr>
<td>
<ul>
{% for section in chapter.sections %}
<li>
{% if section.is_draft %}
{{ section.name }} (準備中)
{% else %}
<a href="{{ section.path }}">{{ section.name }}</a>
{% endif %}
</li>
{% endfor %}
</ul>
</td>
</tr>
{% endfor %}
<tr>
<th>
<a href="/conclusion">おわりに</a>
</th>
</tr>
<tr>
<th>
<a href="/appendix/">付録</a>
</th>
</tr>
<tr>
<th>
<a href="/#acknowledgement">謝辞</a>
</th>
</tr>
</table>
</section>
<section style="text-align: center; width: 100%;">
<h2 id="acknowledgement">謝辞</h2>
<div style="text-align: left;">
<p>本書は、 <a href="https://iosdc.jp/2019/">iOSDC Japan 2019</a> における筆者のレギュラートーク <a href="https://fortee.jp/iosdc-japan-2019/proposal/8c0509d1-ec1d-4225-8e04-e92726f997d4">"Heart of Swift"</a> を元に、加筆・修正して書籍の形にしたものです。</p>
<div class="video" style="position: relative; padding-top:56.25%;">
<iframe style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;" width="1341" height="684" src="https://www.youtube.com/embed/XySdL_Vahx0?rel=0" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</div>
<p>"Heart of Swift" を採択し、貴重な発表の機会を下さった iOSDC Japan 2019 実行委員会の皆様に感謝申し上げます。</p>
<p>また、闘病中にも関わらず筆者の登壇を後押しし、当日は応援に駆けつけてくれた妻に感謝します。ありがとう。安らかに眠って下さい。</p>
</div>
</section>