SlideShare a Scribd company logo
1 of 41
Download to read offline
/* 2016.07.01 @ WWDC.next */
/**
*/
/* @es_kumagai */
/**
*/


/* 2016/06/13 2016/06/17 */


// 型名につけるとメタタイプが得られる
let type: Int.Type = Int.self // Int.Type
// 評価式に付けると… 評価結果…?
let value: Int = (5 + 3).self // 8
// 普通に計算すれば、掛け算が優先
let a = 1 + 2 * 5 // 11
// 評価式の一部を.self で括ると…
let b = (1 + 2).self * 5 // 15
// でも.self がなくても同じ?
let c = (1 + 2) * 5 // 15
// 先に評価なら、このように Int 型になりそうだが
let a = (1 + 2) as Int * 3.5
// リテラルのまま存続して Double 型に落ち着く
let b = (1 + 2).self * 3.5 // 10.5
Binary operator '*' cannot be applied to operands
of type 'Int' and 'Double'
let value: Int = 10
let value: Double = 10
let value = 10 as Int32
let value = 10 + doubleValue
Swift Lab で聞いてみた!
let answer = (1 + 2) * 3.5
/* 抜粋 */
/* 抜粋 */
/* 抜粋 */
let answer = (1 + 2).self * 3.5
/* 抜粋 */
/* 抜粋 */
/* 抜粋 */


/* 再掲 */
Enjoy! Swift
/* Thank you */

More Related Content

More from Tomohiro Kumagai

_Function Builders in Swift #love_swift
_Function Builders in Swift #love_swift_Function Builders in Swift #love_swift
_Function Builders in Swift #love_swiftTomohiro Kumagai
 
Property Wrappers の特徴を眺める #swiftzoomin
Property Wrappers の特徴を眺める #swiftzoominProperty Wrappers の特徴を眺める #swiftzoomin
Property Wrappers の特徴を眺める #swiftzoominTomohiro Kumagai
 
みんなで Swift 復習会 GO! in "Swift Days Fukuoka" – 12nd′ オープニング&資料
みんなで Swift 復習会 GO! in "Swift Days Fukuoka" – 12nd′ オープニング&資料みんなで Swift 復習会 GO! in "Swift Days Fukuoka" – 12nd′ オープニング&資料
みんなで Swift 復習会 GO! in "Swift Days Fukuoka" – 12nd′ オープニング&資料Tomohiro Kumagai
 
みんなで Swift 復習会
GO! in 札幌 – 10th′′
みんなで Swift 復習会
GO! in 札幌 – 10th′′みんなで Swift 復習会
GO! in 札幌 – 10th′′
みんなで Swift 復習会
GO! in 札幌 – 10th′′Tomohiro Kumagai
 
イニシャライザー Part 2.5 #hakataswift
イニシャライザー Part 2.5 #hakataswiftイニシャライザー Part 2.5 #hakataswift
イニシャライザー Part 2.5 #hakataswiftTomohiro Kumagai
 
ニコニコ超会議・文化の交差点 #techpub #ニコニコ超会議 #さくらシンデレラ
ニコニコ超会議・文化の交差点 #techpub #ニコニコ超会議 #さくらシンデレラニコニコ超会議・文化の交差点 #techpub #ニコニコ超会議 #さくらシンデレラ
ニコニコ超会議・文化の交差点 #techpub #ニコニコ超会議 #さくらシンデレラTomohiro Kumagai
 
Swift クラスのイニシャライザー #devsap
Swift クラスのイニシャライザー #devsapSwift クラスのイニシャライザー #devsap
Swift クラスのイニシャライザー #devsapTomohiro Kumagai
 
iOSCon 2019 in London #ioscon #love_swift
iOSCon 2019 in London #ioscon #love_swiftiOSCon 2019 in London #ioscon #love_swift
iOSCon 2019 in London #ioscon #love_swiftTomohiro Kumagai
 
Around the 変数 let #love_swift
Around the 変数 let #love_swiftAround the 変数 let #love_swift
Around the 変数 let #love_swiftTomohiro Kumagai
 
もくもく執筆会 #技術同人誌再販Night
もくもく執筆会 #技術同人誌再販Nightもくもく執筆会 #技術同人誌再販Night
もくもく執筆会 #技術同人誌再販NightTomohiro Kumagai
 
みんなで Swift 復習会 GO! in 岩手 – 9th′
みんなで Swift 復習会 GO! in 岩手 – 9th′みんなで Swift 復習会 GO! in 岩手 – 9th′
みんなで Swift 復習会 GO! in 岩手 – 9th′Tomohiro Kumagai
 
macOS アプリで Swift Package Manager を使ってみる #love_swift #hakataswift
macOS アプリで Swift Package Manager を使ってみる #love_swift #hakataswiftmacOS アプリで Swift Package Manager を使ってみる #love_swift #hakataswift
macOS アプリで Swift Package Manager を使ってみる #love_swift #hakataswiftTomohiro Kumagai
 
みんなで Swift 復習会 GO! in 福岡 – 8th′ #minna_de_swift
みんなで Swift 復習会 GO! in 福岡 – 8th′ #minna_de_swiftみんなで Swift 復習会 GO! in 福岡 – 8th′ #minna_de_swift
みんなで Swift 復習会 GO! in 福岡 – 8th′ #minna_de_swiftTomohiro Kumagai
 
Getting Started with Attending iOSCon in London 高画質・追記版 #love_swift #ioscon
Getting Started with Attending iOSCon in London 高画質・追記版 #love_swift #iosconGetting Started with Attending iOSCon in London 高画質・追記版 #love_swift #ioscon
Getting Started with Attending iOSCon in London 高画質・追記版 #love_swift #iosconTomohiro Kumagai
 
みんなで Swift 復習会
GO! in 京都 – 6th′
みんなで Swift 復習会
GO! in 京都 – 6th′みんなで Swift 復習会
GO! in 京都 – 6th′
みんなで Swift 復習会
GO! in 京都 – 6th′Tomohiro Kumagai
 
みんなで Swift 復習会 GO! in 福岡 – 5th′
みんなで Swift 復習会 GO! in 福岡 – 5th′みんなで Swift 復習会 GO! in 福岡 – 5th′
みんなで Swift 復習会 GO! in 福岡 – 5th′Tomohiro Kumagai
 
勉強会の東京外開催の気持ち #yuru_bounen2017
勉強会の東京外開催の気持ち #yuru_bounen2017勉強会の東京外開催の気持ち #yuru_bounen2017
勉強会の東京外開催の気持ち #yuru_bounen2017Tomohiro Kumagai
 
みんなで Swift 復習会 GO! in 福岡・発表資料
みんなで Swift 復習会 GO! in 福岡・発表資料みんなで Swift 復習会 GO! in 福岡・発表資料
みんなで Swift 復習会 GO! in 福岡・発表資料Tomohiro Kumagai
 
Protocol-Oriented Integers に想うジェネリックプログラミングの未来
Protocol-Oriented Integers に想うジェネリックプログラミングの未来Protocol-Oriented Integers に想うジェネリックプログラミングの未来
Protocol-Oriented Integers に想うジェネリックプログラミングの未来Tomohiro Kumagai
 
技術系同人誌を書こう #love_swift #devsap
技術系同人誌を書こう #love_swift #devsap技術系同人誌を書こう #love_swift #devsap
技術系同人誌を書こう #love_swift #devsapTomohiro Kumagai
 

More from Tomohiro Kumagai (20)

_Function Builders in Swift #love_swift
_Function Builders in Swift #love_swift_Function Builders in Swift #love_swift
_Function Builders in Swift #love_swift
 
Property Wrappers の特徴を眺める #swiftzoomin
Property Wrappers の特徴を眺める #swiftzoominProperty Wrappers の特徴を眺める #swiftzoomin
Property Wrappers の特徴を眺める #swiftzoomin
 
みんなで Swift 復習会 GO! in "Swift Days Fukuoka" – 12nd′ オープニング&資料
みんなで Swift 復習会 GO! in "Swift Days Fukuoka" – 12nd′ オープニング&資料みんなで Swift 復習会 GO! in "Swift Days Fukuoka" – 12nd′ オープニング&資料
みんなで Swift 復習会 GO! in "Swift Days Fukuoka" – 12nd′ オープニング&資料
 
みんなで Swift 復習会
GO! in 札幌 – 10th′′
みんなで Swift 復習会
GO! in 札幌 – 10th′′みんなで Swift 復習会
GO! in 札幌 – 10th′′
みんなで Swift 復習会
GO! in 札幌 – 10th′′
 
イニシャライザー Part 2.5 #hakataswift
イニシャライザー Part 2.5 #hakataswiftイニシャライザー Part 2.5 #hakataswift
イニシャライザー Part 2.5 #hakataswift
 
ニコニコ超会議・文化の交差点 #techpub #ニコニコ超会議 #さくらシンデレラ
ニコニコ超会議・文化の交差点 #techpub #ニコニコ超会議 #さくらシンデレラニコニコ超会議・文化の交差点 #techpub #ニコニコ超会議 #さくらシンデレラ
ニコニコ超会議・文化の交差点 #techpub #ニコニコ超会議 #さくらシンデレラ
 
Swift クラスのイニシャライザー #devsap
Swift クラスのイニシャライザー #devsapSwift クラスのイニシャライザー #devsap
Swift クラスのイニシャライザー #devsap
 
iOSCon 2019 in London #ioscon #love_swift
iOSCon 2019 in London #ioscon #love_swiftiOSCon 2019 in London #ioscon #love_swift
iOSCon 2019 in London #ioscon #love_swift
 
Around the 変数 let #love_swift
Around the 変数 let #love_swiftAround the 変数 let #love_swift
Around the 変数 let #love_swift
 
もくもく執筆会 #技術同人誌再販Night
もくもく執筆会 #技術同人誌再販Nightもくもく執筆会 #技術同人誌再販Night
もくもく執筆会 #技術同人誌再販Night
 
みんなで Swift 復習会 GO! in 岩手 – 9th′
みんなで Swift 復習会 GO! in 岩手 – 9th′みんなで Swift 復習会 GO! in 岩手 – 9th′
みんなで Swift 復習会 GO! in 岩手 – 9th′
 
macOS アプリで Swift Package Manager を使ってみる #love_swift #hakataswift
macOS アプリで Swift Package Manager を使ってみる #love_swift #hakataswiftmacOS アプリで Swift Package Manager を使ってみる #love_swift #hakataswift
macOS アプリで Swift Package Manager を使ってみる #love_swift #hakataswift
 
みんなで Swift 復習会 GO! in 福岡 – 8th′ #minna_de_swift
みんなで Swift 復習会 GO! in 福岡 – 8th′ #minna_de_swiftみんなで Swift 復習会 GO! in 福岡 – 8th′ #minna_de_swift
みんなで Swift 復習会 GO! in 福岡 – 8th′ #minna_de_swift
 
Getting Started with Attending iOSCon in London 高画質・追記版 #love_swift #ioscon
Getting Started with Attending iOSCon in London 高画質・追記版 #love_swift #iosconGetting Started with Attending iOSCon in London 高画質・追記版 #love_swift #ioscon
Getting Started with Attending iOSCon in London 高画質・追記版 #love_swift #ioscon
 
みんなで Swift 復習会
GO! in 京都 – 6th′
みんなで Swift 復習会
GO! in 京都 – 6th′みんなで Swift 復習会
GO! in 京都 – 6th′
みんなで Swift 復習会
GO! in 京都 – 6th′
 
みんなで Swift 復習会 GO! in 福岡 – 5th′
みんなで Swift 復習会 GO! in 福岡 – 5th′みんなで Swift 復習会 GO! in 福岡 – 5th′
みんなで Swift 復習会 GO! in 福岡 – 5th′
 
勉強会の東京外開催の気持ち #yuru_bounen2017
勉強会の東京外開催の気持ち #yuru_bounen2017勉強会の東京外開催の気持ち #yuru_bounen2017
勉強会の東京外開催の気持ち #yuru_bounen2017
 
みんなで Swift 復習会 GO! in 福岡・発表資料
みんなで Swift 復習会 GO! in 福岡・発表資料みんなで Swift 復習会 GO! in 福岡・発表資料
みんなで Swift 復習会 GO! in 福岡・発表資料
 
Protocol-Oriented Integers に想うジェネリックプログラミングの未来
Protocol-Oriented Integers に想うジェネリックプログラミングの未来Protocol-Oriented Integers に想うジェネリックプログラミングの未来
Protocol-Oriented Integers に想うジェネリックプログラミングの未来
 
技術系同人誌を書こう #love_swift #devsap
技術系同人誌を書こう #love_swift #devsap技術系同人誌を書こう #love_swift #devsap
技術系同人誌を書こう #love_swift #devsap
 

Swift Open Hours 2 - Swift ラボで聞いてきた話