---
title: みんなで Swift 復習会での談笑用スライド – 5th #minna_de_swift
tags:  #カジュアルswift勉強会 #swift  
author: [熊谷友宏](https://image.docswell.com/user/es_kumagai)
site: [Docswell](https://www.docswell.com/)
thumbnail: https://bcdn.docswell.com/page/V7P6Y862J8.jpg?width=480
description: みんなで Swift 復習会 (http://cswift.connpass.com) の談笑で使った資料です。これを題材に２時間ばかり、集まったみんなと談笑しました。  ※ Docswell での公開に移行する直前の Slideshare での閲覧数は 512 でした。
published: February 09, 17
canonical: https://image.docswell.com/s/es_kumagai/ZV1684-05-170209090526
---
# Page. 1

![Page Image](https://bcdn.docswell.com/page/V7P6Y862J8.jpg)

ΈΜͳͰ4XJGU෮शձ
$POTUBOUTBOE
7BSJBCMFTͷଓ͖

ΧδϡΞϧ4XJGUϓϩάϥϛϯά
‫۽‬୩༑޺
IUUQF[OFUKQ
4XJGU


# Page. 2

![Page Image](https://bcdn.docswell.com/page/2JV3GN3XEQ.jpg)

5IF#BTJDT
$POTUBOUTBOE7BSJBCMFT


# Page. 3

![Page Image](https://bcdn.docswell.com/page/5EG38K3R7L.jpg)

໊લ෇͚


# Page. 4

![Page Image](https://bcdn.docswell.com/page/4JQ59N5Y7P.jpg)

໊લ෇͚
ม਺ͷ໊લ
⾣ ΄ͱΜͲͷจࣈ͕࢖͑Δ
⾣ ࢖͑ͳ͍จࣈ΋͋Δ
let π = 3.14
let ＃ = &quot;minnna_de_swift&quot;
let 📱 = &quot;iPhone 7&quot;
// 使えない文字もある
let ⛩ = &quot;伏見稲荷大社&quot;
&amp;YQFDUFE1BUUFSO


# Page. 5

![Page Image](https://bcdn.docswell.com/page/K749XG9ZE1.jpg)

໊લ෇͚
ม਺໊ʹ࢖͑ͳ͍จࣈ
⾣ ۭനจࣈ
⾣ ਺ֶ‫߸ه‬ʢЄ΍КͳͲ͸আ͘ʣ
⾣ ໼ҹ
⾣ 6OJDPEF1SJWBUF6TF&quot;SFBT
w #BTJD.VMUJMJOHVBM1MBOF
w 1MBOFT
w 1MBOFT
⾣ #PY%SBXJOH$IBSBDUFST
⾣ ਺ࣈʢઌ಄ʹొ৔͢Δ৔߹ʹ‫ݶ‬Γʣ


# Page. 6

![Page Image](https://bcdn.docswell.com/page/LJ1KNDKD7G.jpg)

໊લ෇͚
ม਺ͷ࠶ఆٛ
⾣ ಉ໊͡લͰͷ࠶ఆٛ͸Ͱ͖ͳ͍
⾣ ఆٛ‫ʹޙ‬ม਺ͷ‫ܕ‬ΛมߋͰ͖ͳ͍
⾣ Մมม਺Λෆมม਺ʹͨ͠Γɺ‫ٯ‬͸Ͱ͖ͳ͍
ผ໊ͷม਺ͱͯ͠࠶ఆٛ


# Page. 7

![Page Image](https://bcdn.docswell.com/page/GJWD4YD872.jpg)

໊લ෇͚
༧໿‫ͱޠ‬ಉ໊͡લ
⾣ όοΫΫΥʔτͰ‫ׅ‬Δ͜ͱͰ࢖͑Δ
⾣ ͦ͏͢Δ͔͠ͳ͍৔߹Ͱͳ͚Ε͹ɺආ͚Δ
let `repeat` = 10
print(`repeat`)


# Page. 8

![Page Image](https://bcdn.docswell.com/page/4EZG2XG9J3.jpg)

໊લ෇͚
Մม஋ม਺
⾣ ม਺WBSͳΒɺ‫׵ޓ‬ੑͷ͋Δ‫ܕ‬ͷ஋ʹมߋՄೳ
⾣ ม਺MFU͸มߋͰ͖ͳ͍ʢϏϧυλΠϜΤϥʔʣ
let maxCapacity = 100
var amount = 10
maxCapacity = 20
amount = 20


# Page. 9

![Page Image](https://bcdn.docswell.com/page/Y76YV4YDEV.jpg)

දࣔ


# Page. 10

![Page Image](https://bcdn.docswell.com/page/G75GDQG874.jpg)

දࣔ
஋Λදࣔ
⾣ QSJOUؔ਺ͰɺͻͱͭҎ্ͷ஋ΛදࣔՄೳʢ̌Ҏ্ʁʣ
⾣ ‫ͨͬ͋ʹڥ؀‬ग़ྗઌʹදࣔ͞ΕΔ
⾣ ‫ط‬ఆͰ͸ɺ࠷‫ʹޙ‬lվߦจࣈz͕ग़ྗ͞ΕΔ
w ࠷‫ޙ‬ͷจࣈ͸UFSNJOBUPSͰมߋՄೳ
print(&quot;A&quot;)
print(&quot;A&quot;, &quot;B&quot;)
print(&quot;A&quot;, &quot;B&quot;, separator: &quot;&amp;&quot;)
print(&quot;A&quot;, &quot;B&quot;, separator: &quot;&amp;&quot;, terminator: “;&quot;)


# Page. 11

![Page Image](https://bcdn.docswell.com/page/9J2Y8PYVJR.jpg)

දࣔ
4USJOH*OUFSQPMBUJPO
⾣ จࣈྻิ‫ߏ׬‬จͰɺจࣈྻΛੜ੒Մೳ
⾣ จࣈྻ͸࿈݁͢ΔΑΓͪ͜Β͕ࣗવʁ
let a = 100
let b = 200
// 文字列の連結
print(&quot;a = &quot; + String(a) + &quot;, b = &quot; + String(b))
// 文字列補完構文
print(&quot;a = \(a), b = \(b)”)


# Page. 12

![Page Image](https://bcdn.docswell.com/page/DEYG65GQEM.jpg)

දࣔ
จࣈྻม‫׵‬
⾣ શͯͷΠϯελϯε͸จࣈྻԽͰ͖Δ
⾣ $VTUPN4USJOH$POWFSUJCMFͰௐ੔Ͱ͖Δ
let value = 10
let string = String(describing: value)


# Page. 13

![Page Image](https://bcdn.docswell.com/page/VJNGZNG278.jpg)

දࣔ
จࣈྻม‫׵‬ʢσόοά༻ʣ
⾣ σόοά༻͸$VTUPN%FCVH4USJOH$POWFSUJCMFͰ
⾣ 0QUJPOBMͷத਎͸σόοά༻ͷจࣈྻʹͳΔ
String(describing: Int.self)
String(reflecting: Int.self)
// Int
// Swift.Int
let v = Int.self as Int.Type?
print(v)
// &quot;Optional(Swift.Int)\n&quot;


# Page. 14

![Page Image](https://bcdn.docswell.com/page/YE9WZRWDE3.jpg)

දࣔ
จࣈྻม‫׵‬ʢϦϑϨΫγϣϯ༻ʣ
⾣ ϦϑϨΫγϣϯ༻͸$VTUPN3FqFDUBCMFͰ
⾣ ‫ط‬ఆͰ͸ɺ‫ࣗܕ‬਎ͷอଘ‫ܕ‬ϓϩύςΟʔͷ஋Λऔಘ
Mirror(reflecting: value)
for child in Mirror(reflecting: value).children {
print(child)
}


# Page. 15

![Page Image](https://bcdn.docswell.com/page/GE8N1WN57D.jpg)

දࣔ
1MBZHSPVOE༻ͷม‫׵‬
⾣ 1MBZHSPVOE༻͸$VTUPN1MBZHSPVOE2VJDL-PPLBCMF
⾣ 1MBZHSPVOEͰͷ஋֬ೝ༻ͷΧελϚΠζʹ࠷ద
extension MyData : CustomPlaygroundQuickLookable {
var customPlaygroundQuickLook: PlaygroundQuickLook {
return .text(&quot;My Data&quot;)
}
}


# Page. 16

![Page Image](https://bcdn.docswell.com/page/LELPQNP37R.jpg)

ΈΜͳͰ4XJGU෮शձ
&amp;OEJOH


# Page. 17

![Page Image](https://bcdn.docswell.com/page/4JM41X4M7W.jpg)

&amp;OKPZ4XJGU
5IBOLZPV
ΈΜͳͰ4XJGU෮शձ
 $POTUBOUTBOE7BSJBCMFT
‫۽‬୩༑޺
IUUQF[OFUKQ
⾣
໊લ෇͚
⾣
දࣔ


