SlideShare a Scribd company logo
/*
*/


/**
*/
/* @es_kumagai */












class Item {
// 戻り値を使わないと警告される
@warn_unused_result
func makeFilter() -> Filter {…}
// 戻り値を使わなくても警告されない
func apply(filter: Filter) -> Item {…}
}


class Item {
// 戻り値を使わないと警告される
func makeFilter() -> Filter {…}
// 戻り値を使わなくても警告されない
@discardableResult
func apply(filter: Filter) -> Item {…}
}


/// MutatingCounterpart: xxxx
/// MonmutatingCounterpart: xxxx
func makeFilter() -> Filter {…}


func add<T: FloatingPoint>(lhs: T, rhs: T) -> T {
return lhs + rhs
}
enum Item {
case binary(NSData)
}
let data1: NSMutableData = …
let data2: NSData = …
let item = Item.binary(data1)
data1.appendData(data2)
enum Item {
case binary(Data)
}
var data1: Data = …
let data2: Data = …
let item = Item.binary(data1)
data1.appendData(data2)
Advance to the next element and return it, or `nil` if no
next element exists.Once `nil` has been returned, all
subsequent calls return `nil`.
protocol IteratorProtocol {
associatedtype Element
mutating func next() -> Element?
protocol BooleanType {
var boolValue: Bool { get }
}
func remove<T:BooleanType>(recursively flag: T) {
…
}
func isKindOf<R:BooleanType>(type: AnyType) -> R {
…
}
struct Condition : BooleanType {
…
}
let condition = Condition(…)
if condition {
…
}
!, &&, ||
func && (lhs: Bool, rhs: () -> Bool) -> Bool
func || (lhs: Bool, rhs: () -> Bool) -> Bool
func ! (a: Bool) -> Bool
// 定義では `` が必要
enum DrawingStyle {
case `default`
case `repeat`
case fit
}
// 使用時は `` が不要
let style = DrawingStyle.default
// 定義では `` が必要
class Object {
var `default`: Int
func `repeat`(_ times: Int) -> String { … }
}
// 使用時は `` が不要
let object = Object()
let value = object.default
// 定義では `` が必要
enum Evaluate {
case `self`
case `dynamicType`
}
// 使用時も `` が必要
let eval = Evaluate.`self`
// プロトコル型で使う
let p: A & B = Value()
// 型引数で使う
func doSomething<T: A & B>(_ value: T) {
}
struct Value : Equatable {
static func == (lhs: Value, rhs: Value) -> Bool {
}
}
class Base : Equatable {
func isEqual(to rhs: Base) -> Bool {…}
}
class Sub : Base {
override func isEqual(to rhs: Base) -> Bool {…}
}
func == (lhs: Base, rhs: Base) -> Bool {
return lhs.isEqual(to: rhs)
}
class Base : Equatable {
class func == (lhs: Base, rhs: Base) -> Bool {…}
}
class Sub : Base {
override
class func == (lhs: Base, rhs: Base) -> Bool {…}
}
func makeIncrementer(inout value: Int) -> () -> Void {
return { value += 1; print("Inside:", value) }
}
var value = 1
let incrementer = makeIncrementer(&value)
print("Outside:", value) // Outside: 1
incrementer() // Inside: 2
print("Outside:", value) // Outside: 1
incrementer() // Inside: 3
print("Outside:", value) // Outside: 1
func something(value: inout Int) {
let noescaped: @noescape () -> Void = {
value = 10
}
let escaped: () -> Void = { [value] in
print(value)
}
}


func total(price: Int, count: Int) -> Int {
}
// 引数リストを丸ごとタプルで扱える
let item: (Int, count: Int) = (100, 5)
total(item)
func total(price: Int, count: Int) -> Int {
}
// 原則、引数リストを1つのタプルで表現できない
let item: (Int, count: Int) = (100, 5)
total(item)
func apply<T, R>(value: T, f: (T) -> R) -> R {
return f(value)
}
let item: (Int, count: Int) = (100, 5)
func total(price: Int, count: Int) -> Int { … }
apply(value: item, f: total)
switch (value1, value2) {
case let (value?, nil), let (nil, value?):
return value
case let (value1?, value2?):
return value1 + value2
case (nil, nil):
return 0
}
switch device {
case
let .iPhone(_, osVersion, network, _)
where osVersion > 8.0,
let .iPad(_, osVersion, network, _, true)
where network == .cellular,
doSomething(device, osVersion, network)
case .iPodTouch:
doSomething(device)
default:
doSomething()
}
let values = sequence(first: 1) { $0 * 2 }
struct MutableSlice<Base : MutableIndexable> {
var base: Base { get }
}
Enjoy! Swift
/* Thank you */

More Related Content

What's hot

Chap 9(functions)
Chap 9(functions)Chap 9(functions)
F# Presentation
F# PresentationF# Presentation
F# Presentation
mrkurt
 
Function overloading(C++)
Function overloading(C++)Function overloading(C++)
Function overloading(C++)
Ritika Sharma
 
lets play with "c"..!!! :):)
lets play with "c"..!!! :):)lets play with "c"..!!! :):)
lets play with "c"..!!! :):)
Rupendra Choudhary
 
Perl 6 command line scripting
Perl 6 command line scriptingPerl 6 command line scripting
Perl 6 command line scripting
Simon Proctor
 
Lecture 11 - Functions
Lecture 11 - FunctionsLecture 11 - Functions
Lecture 11 - Functions
Md. Imran Hossain Showrov
 
C Programming Language Part 6
C Programming Language Part 6C Programming Language Part 6
C Programming Language Part 6
Rumman Ansari
 
Rethink programming: a functional approach
Rethink programming: a functional approachRethink programming: a functional approach
Rethink programming: a functional approach
Francesco Bruni
 
Functions and pointers_unit_4
Functions and pointers_unit_4Functions and pointers_unit_4
Functions and pointers_unit_4
Saranya saran
 
C++ lecture 03
C++   lecture 03C++   lecture 03
C++ lecture 03
HNDE Labuduwa Galle
 
Functions
FunctionsFunctions
Functions
SANTOSH RATH
 
Overloading of io stream operators
Overloading of io stream operatorsOverloading of io stream operators
Overloading of io stream operators
SARAVANAN GOPALAKRISHNAN
 
The best of AltJava is Xtend
The best of AltJava is XtendThe best of AltJava is Xtend
The best of AltJava is Xtend
takezoe
 
Lecture 14 - Scope Rules
Lecture 14 - Scope RulesLecture 14 - Scope Rules
Lecture 14 - Scope Rules
Md. Imran Hossain Showrov
 
Namespaces
NamespacesNamespaces
Namespaces
zindadili
 
Swift Programming Language
Swift Programming LanguageSwift Programming Language
Swift Programming Language
Giuseppe Arici
 
Functions
FunctionsFunctions
Functions
Jesmin Akhter
 
Function in c program
Function in c programFunction in c program
Function in c program
CGC Technical campus,Mohali
 
Exploring ES6
Exploring ES6Exploring ES6
Exploring ES6
Ximing Dai
 
Function
FunctionFunction

What's hot (20)

Chap 9(functions)
Chap 9(functions)Chap 9(functions)
Chap 9(functions)
 
F# Presentation
F# PresentationF# Presentation
F# Presentation
 
Function overloading(C++)
Function overloading(C++)Function overloading(C++)
Function overloading(C++)
 
lets play with "c"..!!! :):)
lets play with "c"..!!! :):)lets play with "c"..!!! :):)
lets play with "c"..!!! :):)
 
Perl 6 command line scripting
Perl 6 command line scriptingPerl 6 command line scripting
Perl 6 command line scripting
 
Lecture 11 - Functions
Lecture 11 - FunctionsLecture 11 - Functions
Lecture 11 - Functions
 
C Programming Language Part 6
C Programming Language Part 6C Programming Language Part 6
C Programming Language Part 6
 
Rethink programming: a functional approach
Rethink programming: a functional approachRethink programming: a functional approach
Rethink programming: a functional approach
 
Functions and pointers_unit_4
Functions and pointers_unit_4Functions and pointers_unit_4
Functions and pointers_unit_4
 
C++ lecture 03
C++   lecture 03C++   lecture 03
C++ lecture 03
 
Functions
FunctionsFunctions
Functions
 
Overloading of io stream operators
Overloading of io stream operatorsOverloading of io stream operators
Overloading of io stream operators
 
The best of AltJava is Xtend
The best of AltJava is XtendThe best of AltJava is Xtend
The best of AltJava is Xtend
 
Lecture 14 - Scope Rules
Lecture 14 - Scope RulesLecture 14 - Scope Rules
Lecture 14 - Scope Rules
 
Namespaces
NamespacesNamespaces
Namespaces
 
Swift Programming Language
Swift Programming LanguageSwift Programming Language
Swift Programming Language
 
Functions
FunctionsFunctions
Functions
 
Function in c program
Function in c programFunction in c program
Function in c program
 
Exploring ES6
Exploring ES6Exploring ES6
Exploring ES6
 
Function
FunctionFunction
Function
 

Viewers also liked

Swift 構造体の時代 #yidev
Swift 構造体の時代 #yidevSwift 構造体の時代 #yidev
Swift 構造体の時代 #yidev
Tomohiro Kumagai
 
Swift の3大プロトコルを眺めてみる #love_swift
Swift の3大プロトコルを眺めてみる #love_swiftSwift の3大プロトコルを眺めてみる #love_swift
Swift の3大プロトコルを眺めてみる #love_swift
Tomohiro Kumagai
 
Swift チャチャチャ #love_swift
Swift チャチャチャ #love_swiftSwift チャチャチャ #love_swift
Swift チャチャチャ #love_swift
Tomohiro Kumagai
 
リテラルと型の話 #__swift__
リテラルと型の話 #__swift__リテラルと型の話 #__swift__
リテラルと型の話 #__swift__
Tomohiro Kumagai
 
Swift らしい表現を目指そう #eventdots
Swift らしい表現を目指そう #eventdotsSwift らしい表現を目指そう #eventdots
Swift らしい表現を目指そう #eventdots
Tomohiro Kumagai
 
はじめてのiOSアプリ開発 Swift対応版
はじめてのiOSアプリ開発 Swift対応版はじめてのiOSアプリ開発 Swift対応版
はじめてのiOSアプリ開発 Swift対応版
Tomoki Hasegawa
 
Blending Culture in Twitter Client
Blending Culture in Twitter ClientBlending Culture in Twitter Client
Blending Culture in Twitter Client
Kenji Tanaka
 
Swift Package Manager ことはじめ #cswift
Swift Package Manager ことはじめ #cswiftSwift Package Manager ことはじめ #cswift
Swift Package Manager ことはじめ #cswift
Tomohiro Kumagai
 
Bad Apple Curve!! 〜フーリエ記述子でアニメーション作ってみた〜
Bad Apple Curve!! 〜フーリエ記述子でアニメーション作ってみた〜Bad Apple Curve!! 〜フーリエ記述子でアニメーション作ってみた〜
Bad Apple Curve!! 〜フーリエ記述子でアニメーション作ってみた〜
Yu(u)ki IWABUCHI
 
HTML5は本当にFlashの代替になり得るのか?~Webテクノロジー進化論
HTML5は本当にFlashの代替になり得るのか?~Webテクノロジー進化論HTML5は本当にFlashの代替になり得るのか?~Webテクノロジー進化論
HTML5は本当にFlashの代替になり得るのか?~Webテクノロジー進化論
Teiichi Ota
 
現実(えくせる)と戦う話
現実(えくせる)と戦う話現実(えくせる)と戦う話
現実(えくせる)と戦う話
bleis tift
 
lazy var の特徴を知る #cocoa_kansai #cswift
lazy var の特徴を知る #cocoa_kansai #cswiftlazy var の特徴を知る #cocoa_kansai #cswift
lazy var の特徴を知る #cocoa_kansai #cswift
Tomohiro Kumagai
 
リテラルと型の続きの話 #__swift__
リテラルと型の続きの話 #__swift__リテラルと型の続きの話 #__swift__
リテラルと型の続きの話 #__swift__
Tomohiro Kumagai
 
AWS Cognitoを実際のアプリで導入してハマったこと
AWS Cognitoを実際のアプリで導入してハマったことAWS Cognitoを実際のアプリで導入してハマったこと
AWS Cognitoを実際のアプリで導入してハマったこと
洋一郎 櫻井
 
プロトコル指向に想う世界観 #__swift__
プロトコル指向に想う世界観 #__swift__プロトコル指向に想う世界観 #__swift__
プロトコル指向に想う世界観 #__swift__
Tomohiro Kumagai
 
Core Image Tips & Tricks in iOS 9
Core Image Tips & Tricks in iOS 9Core Image Tips & Tricks in iOS 9
Core Image Tips & Tricks in iOS 9
Shuichi Tsutsumi
 
AKIBA.swift vol.1
AKIBA.swift vol.1AKIBA.swift vol.1
AKIBA.swift vol.1
cocominap
 
Swift 2.0 で変わったところ「後編」 #cswift
Swift 2.0 で変わったところ「後編」 #cswiftSwift 2.0 で変わったところ「後編」 #cswift
Swift 2.0 で変わったところ「後編」 #cswift
Tomohiro Kumagai
 
Swiftのこれまでの動向のまとめと 今後のさらなる発展の期待 - iOSDC 2016
Swiftのこれまでの動向のまとめと 今後のさらなる発展の期待 - iOSDC 2016Swiftのこれまでの動向のまとめと 今後のさらなる発展の期待 - iOSDC 2016
Swiftのこれまでの動向のまとめと 今後のさらなる発展の期待 - iOSDC 2016
将之 小野
 
Unowned / Weak References with Closure
Unowned / Weak References with ClosureUnowned / Weak References with Closure
Unowned / Weak References with Closure
Naruki Chigira
 

Viewers also liked (20)

Swift 構造体の時代 #yidev
Swift 構造体の時代 #yidevSwift 構造体の時代 #yidev
Swift 構造体の時代 #yidev
 
Swift の3大プロトコルを眺めてみる #love_swift
Swift の3大プロトコルを眺めてみる #love_swiftSwift の3大プロトコルを眺めてみる #love_swift
Swift の3大プロトコルを眺めてみる #love_swift
 
Swift チャチャチャ #love_swift
Swift チャチャチャ #love_swiftSwift チャチャチャ #love_swift
Swift チャチャチャ #love_swift
 
リテラルと型の話 #__swift__
リテラルと型の話 #__swift__リテラルと型の話 #__swift__
リテラルと型の話 #__swift__
 
Swift らしい表現を目指そう #eventdots
Swift らしい表現を目指そう #eventdotsSwift らしい表現を目指そう #eventdots
Swift らしい表現を目指そう #eventdots
 
はじめてのiOSアプリ開発 Swift対応版
はじめてのiOSアプリ開発 Swift対応版はじめてのiOSアプリ開発 Swift対応版
はじめてのiOSアプリ開発 Swift対応版
 
Blending Culture in Twitter Client
Blending Culture in Twitter ClientBlending Culture in Twitter Client
Blending Culture in Twitter Client
 
Swift Package Manager ことはじめ #cswift
Swift Package Manager ことはじめ #cswiftSwift Package Manager ことはじめ #cswift
Swift Package Manager ことはじめ #cswift
 
Bad Apple Curve!! 〜フーリエ記述子でアニメーション作ってみた〜
Bad Apple Curve!! 〜フーリエ記述子でアニメーション作ってみた〜Bad Apple Curve!! 〜フーリエ記述子でアニメーション作ってみた〜
Bad Apple Curve!! 〜フーリエ記述子でアニメーション作ってみた〜
 
HTML5は本当にFlashの代替になり得るのか?~Webテクノロジー進化論
HTML5は本当にFlashの代替になり得るのか?~Webテクノロジー進化論HTML5は本当にFlashの代替になり得るのか?~Webテクノロジー進化論
HTML5は本当にFlashの代替になり得るのか?~Webテクノロジー進化論
 
現実(えくせる)と戦う話
現実(えくせる)と戦う話現実(えくせる)と戦う話
現実(えくせる)と戦う話
 
lazy var の特徴を知る #cocoa_kansai #cswift
lazy var の特徴を知る #cocoa_kansai #cswiftlazy var の特徴を知る #cocoa_kansai #cswift
lazy var の特徴を知る #cocoa_kansai #cswift
 
リテラルと型の続きの話 #__swift__
リテラルと型の続きの話 #__swift__リテラルと型の続きの話 #__swift__
リテラルと型の続きの話 #__swift__
 
AWS Cognitoを実際のアプリで導入してハマったこと
AWS Cognitoを実際のアプリで導入してハマったことAWS Cognitoを実際のアプリで導入してハマったこと
AWS Cognitoを実際のアプリで導入してハマったこと
 
プロトコル指向に想う世界観 #__swift__
プロトコル指向に想う世界観 #__swift__プロトコル指向に想う世界観 #__swift__
プロトコル指向に想う世界観 #__swift__
 
Core Image Tips & Tricks in iOS 9
Core Image Tips & Tricks in iOS 9Core Image Tips & Tricks in iOS 9
Core Image Tips & Tricks in iOS 9
 
AKIBA.swift vol.1
AKIBA.swift vol.1AKIBA.swift vol.1
AKIBA.swift vol.1
 
Swift 2.0 で変わったところ「後編」 #cswift
Swift 2.0 で変わったところ「後編」 #cswiftSwift 2.0 で変わったところ「後編」 #cswift
Swift 2.0 で変わったところ「後編」 #cswift
 
Swiftのこれまでの動向のまとめと 今後のさらなる発展の期待 - iOSDC 2016
Swiftのこれまでの動向のまとめと 今後のさらなる発展の期待 - iOSDC 2016Swiftのこれまでの動向のまとめと 今後のさらなる発展の期待 - iOSDC 2016
Swiftのこれまでの動向のまとめと 今後のさらなる発展の期待 - iOSDC 2016
 
Unowned / Weak References with Closure
Unowned / Weak References with ClosureUnowned / Weak References with Closure
Unowned / Weak References with Closure
 

Similar to Swift 3.0 で変わったところ - 厳選 13 項目 #love_swift #cswift

Swift the implicit parts
Swift the implicit partsSwift the implicit parts
Swift the implicit parts
Maxim Zaks
 
Stack queue
Stack queueStack queue
Stack queue
Tony Nguyen
 
Stack queue
Stack queueStack queue
Stack queue
James Wong
 
Stack queue
Stack queueStack queue
Stack queue
Harry Potter
 
Stack queue
Stack queueStack queue
Stack queue
Young Alista
 
Stack queue
Stack queueStack queue
Stack queue
Fraboni Ec
 
Stack queue
Stack queueStack queue
Stack queue
Luis Goldster
 
Stack queue
Stack queueStack queue
Stack queue
Hoang Nguyen
 
TI1220 Lecture 6: First-class Functions
TI1220 Lecture 6: First-class FunctionsTI1220 Lecture 6: First-class Functions
TI1220 Lecture 6: First-class Functions
Eelco Visser
 
Functional programming ii
Functional programming iiFunctional programming ii
Functional programming ii
Prashant Kalkar
 
Functional Programming for OO Programmers (part 2)
Functional Programming for OO Programmers (part 2)Functional Programming for OO Programmers (part 2)
Functional Programming for OO Programmers (part 2)
Calvin Cheng
 
C++ problemPart 1 Recursive Print (40 pts)Please write the recu.pdf
C++ problemPart 1 Recursive Print (40 pts)Please write the recu.pdfC++ problemPart 1 Recursive Print (40 pts)Please write the recu.pdf
C++ problemPart 1 Recursive Print (40 pts)Please write the recu.pdf
callawaycorb73779
 
Complete the provided partial C++ Linked List program. Main.cpp is g.pdf
Complete the provided partial C++ Linked List program. Main.cpp is g.pdfComplete the provided partial C++ Linked List program. Main.cpp is g.pdf
Complete the provided partial C++ Linked List program. Main.cpp is g.pdf
rajkumarm401
 
In C++Add the function min as an abstract function to the classar.pdf
In C++Add the function min as an abstract function to the classar.pdfIn C++Add the function min as an abstract function to the classar.pdf
In C++Add the function min as an abstract function to the classar.pdf
fantoosh1
 
#ifndef MYLIST_H_ #define MYLIST_H_#includeiostream #include.docx
#ifndef MYLIST_H_ #define MYLIST_H_#includeiostream #include.docx#ifndef MYLIST_H_ #define MYLIST_H_#includeiostream #include.docx
#ifndef MYLIST_H_ #define MYLIST_H_#includeiostream #include.docx
ajoy21
 
Hello Swift 3/5 - Function
Hello Swift 3/5 - FunctionHello Swift 3/5 - Function
Hello Swift 3/5 - Function
Cody Yun
 
25-functions.ppt
25-functions.ppt25-functions.ppt
25-functions.ppt
JyothiAmpally
 
For each task, submit your source java code file.(1) Objective Im.pdf
For each task, submit your source java code file.(1) Objective Im.pdfFor each task, submit your source java code file.(1) Objective Im.pdf
For each task, submit your source java code file.(1) Objective Im.pdf
dhavalbl38
 
Implement the additional 5 methods as indicated in the LinkedList fi.pdf
Implement the additional 5 methods as indicated in the LinkedList fi.pdfImplement the additional 5 methods as indicated in the LinkedList fi.pdf
Implement the additional 5 methods as indicated in the LinkedList fi.pdf
footstatus
 
In C++Write a recursive function to determine whether or not a Lin.pdf
In C++Write a recursive function to determine whether or not a Lin.pdfIn C++Write a recursive function to determine whether or not a Lin.pdf
In C++Write a recursive function to determine whether or not a Lin.pdf
flashfashioncasualwe
 

Similar to Swift 3.0 で変わったところ - 厳選 13 項目 #love_swift #cswift (20)

Swift the implicit parts
Swift the implicit partsSwift the implicit parts
Swift the implicit parts
 
Stack queue
Stack queueStack queue
Stack queue
 
Stack queue
Stack queueStack queue
Stack queue
 
Stack queue
Stack queueStack queue
Stack queue
 
Stack queue
Stack queueStack queue
Stack queue
 
Stack queue
Stack queueStack queue
Stack queue
 
Stack queue
Stack queueStack queue
Stack queue
 
Stack queue
Stack queueStack queue
Stack queue
 
TI1220 Lecture 6: First-class Functions
TI1220 Lecture 6: First-class FunctionsTI1220 Lecture 6: First-class Functions
TI1220 Lecture 6: First-class Functions
 
Functional programming ii
Functional programming iiFunctional programming ii
Functional programming ii
 
Functional Programming for OO Programmers (part 2)
Functional Programming for OO Programmers (part 2)Functional Programming for OO Programmers (part 2)
Functional Programming for OO Programmers (part 2)
 
C++ problemPart 1 Recursive Print (40 pts)Please write the recu.pdf
C++ problemPart 1 Recursive Print (40 pts)Please write the recu.pdfC++ problemPart 1 Recursive Print (40 pts)Please write the recu.pdf
C++ problemPart 1 Recursive Print (40 pts)Please write the recu.pdf
 
Complete the provided partial C++ Linked List program. Main.cpp is g.pdf
Complete the provided partial C++ Linked List program. Main.cpp is g.pdfComplete the provided partial C++ Linked List program. Main.cpp is g.pdf
Complete the provided partial C++ Linked List program. Main.cpp is g.pdf
 
In C++Add the function min as an abstract function to the classar.pdf
In C++Add the function min as an abstract function to the classar.pdfIn C++Add the function min as an abstract function to the classar.pdf
In C++Add the function min as an abstract function to the classar.pdf
 
#ifndef MYLIST_H_ #define MYLIST_H_#includeiostream #include.docx
#ifndef MYLIST_H_ #define MYLIST_H_#includeiostream #include.docx#ifndef MYLIST_H_ #define MYLIST_H_#includeiostream #include.docx
#ifndef MYLIST_H_ #define MYLIST_H_#includeiostream #include.docx
 
Hello Swift 3/5 - Function
Hello Swift 3/5 - FunctionHello Swift 3/5 - Function
Hello Swift 3/5 - Function
 
25-functions.ppt
25-functions.ppt25-functions.ppt
25-functions.ppt
 
For each task, submit your source java code file.(1) Objective Im.pdf
For each task, submit your source java code file.(1) Objective Im.pdfFor each task, submit your source java code file.(1) Objective Im.pdf
For each task, submit your source java code file.(1) Objective Im.pdf
 
Implement the additional 5 methods as indicated in the LinkedList fi.pdf
Implement the additional 5 methods as indicated in the LinkedList fi.pdfImplement the additional 5 methods as indicated in the LinkedList fi.pdf
Implement the additional 5 methods as indicated in the LinkedList fi.pdf
 
In C++Write a recursive function to determine whether or not a Lin.pdf
In C++Write a recursive function to determine whether or not a Lin.pdfIn C++Write a recursive function to determine whether or not a Lin.pdf
In C++Write a recursive function to determine whether or not a Lin.pdf
 

More from Tomohiro Kumagai

最近気づいた勉強法 — 勉強会開催の習慣化 #yumemi_grow
最近気づいた勉強法 — 勉強会開催の習慣化 #yumemi_grow最近気づいた勉強法 — 勉強会開催の習慣化 #yumemi_grow
最近気づいた勉強法 — 勉強会開催の習慣化 #yumemi_grow
Tomohiro Kumagai
 
Swift 所有権 要諦 #ゆるちとせ
Swift 所有権 要諦 #ゆるちとせSwift 所有権 要諦 #ゆるちとせ
Swift 所有権 要諦 #ゆるちとせ
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_swift
Tomohiro Kumagai
 
Property Wrappers の特徴を眺める #swiftzoomin
Property Wrappers の特徴を眺める #swiftzoominProperty Wrappers の特徴を眺める #swiftzoomin
Property Wrappers の特徴を眺める #swiftzoomin
Tomohiro 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 #hakataswift
Tomohiro Kumagai
 
ニコニコ超会議・文化の交差点 #techpub #ニコニコ超会議 #さくらシンデレラ
ニコニコ超会議・文化の交差点 #techpub #ニコニコ超会議 #さくらシンデレラニコニコ超会議・文化の交差点 #techpub #ニコニコ超会議 #さくらシンデレラ
ニコニコ超会議・文化の交差点 #techpub #ニコニコ超会議 #さくらシンデレラ
Tomohiro Kumagai
 
Swift クラスのイニシャライザー #devsap
Swift クラスのイニシャライザー #devsapSwift クラスのイニシャライザー #devsap
Swift クラスのイニシャライザー #devsap
Tomohiro 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_swift
Tomohiro Kumagai
 
Around the 変数 let #love_swift
Around the 変数 let #love_swiftAround the 変数 let #love_swift
Around the 変数 let #love_swift
Tomohiro Kumagai
 
もくもく執筆会 #技術同人誌再販Night
もくもく執筆会 #技術同人誌再販Nightもくもく執筆会 #技術同人誌再販Night
もくもく執筆会 #技術同人誌再販Night
Tomohiro 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 #hakataswift
Tomohiro 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_swift
Tomohiro 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 #ioscon
Tomohiro 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_bounen2017
Tomohiro Kumagai
 
みんなで Swift 復習会 GO! in 福岡・発表資料
みんなで Swift 復習会 GO! in 福岡・発表資料みんなで Swift 復習会 GO! in 福岡・発表資料
みんなで Swift 復習会 GO! in 福岡・発表資料
Tomohiro Kumagai
 

More from Tomohiro Kumagai (20)

最近気づいた勉強法 — 勉強会開催の習慣化 #yumemi_grow
最近気づいた勉強法 — 勉強会開催の習慣化 #yumemi_grow最近気づいた勉強法 — 勉強会開催の習慣化 #yumemi_grow
最近気づいた勉強法 — 勉強会開催の習慣化 #yumemi_grow
 
Swift 所有権 要諦 #ゆるちとせ
Swift 所有権 要諦 #ゆるちとせSwift 所有権 要諦 #ゆるちとせ
Swift 所有権 要諦 #ゆるちとせ
 
_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 福岡・発表資料
 

Recently uploaded

Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j
 
Requirement Traceability in Xen Functional Safety
Requirement Traceability in Xen Functional SafetyRequirement Traceability in Xen Functional Safety
Requirement Traceability in Xen Functional Safety
Ayan Halder
 
openEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain SecurityopenEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain Security
Shane Coughlan
 
Microservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we workMicroservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we work
Sven Peters
 
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
kalichargn70th171
 
Hand Rolled Applicative User Validation Code Kata
Hand Rolled Applicative User ValidationCode KataHand Rolled Applicative User ValidationCode Kata
Hand Rolled Applicative User Validation Code Kata
Philip Schwarz
 
Odoo ERP Vs. Traditional ERP Systems – A Comparative Analysis
Odoo ERP Vs. Traditional ERP Systems – A Comparative AnalysisOdoo ERP Vs. Traditional ERP Systems – A Comparative Analysis
Odoo ERP Vs. Traditional ERP Systems – A Comparative Analysis
Envertis Software Solutions
 
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian CompaniesE-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
Quickdice ERP
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
Aftab Hussain
 
GreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-JurisicGreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-Jurisic
Green Software Development
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Crescat
 
UI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
UI5con 2024 - Keynote: Latest News about UI5 and it’s EcosystemUI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
UI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
Peter Muessig
 
Oracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptxOracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptx
Remote DBA Services
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Łukasz Chruściel
 
WWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders AustinWWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders Austin
Patrick Weigel
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
Aftab Hussain
 
Artificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension FunctionsArtificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension Functions
Octavian Nadolu
 
Oracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptxOracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptx
Remote DBA Services
 
How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?
ToXSL Technologies
 

Recently uploaded (20)

Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
 
Requirement Traceability in Xen Functional Safety
Requirement Traceability in Xen Functional SafetyRequirement Traceability in Xen Functional Safety
Requirement Traceability in Xen Functional Safety
 
openEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain SecurityopenEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain Security
 
Microservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we workMicroservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we work
 
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
 
Hand Rolled Applicative User Validation Code Kata
Hand Rolled Applicative User ValidationCode KataHand Rolled Applicative User ValidationCode Kata
Hand Rolled Applicative User Validation Code Kata
 
Odoo ERP Vs. Traditional ERP Systems – A Comparative Analysis
Odoo ERP Vs. Traditional ERP Systems – A Comparative AnalysisOdoo ERP Vs. Traditional ERP Systems – A Comparative Analysis
Odoo ERP Vs. Traditional ERP Systems – A Comparative Analysis
 
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian CompaniesE-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
 
GreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-JurisicGreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-Jurisic
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
 
UI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
UI5con 2024 - Keynote: Latest News about UI5 and it’s EcosystemUI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
UI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
 
Oracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptxOracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptx
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
 
WWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders AustinWWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders Austin
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
 
Artificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension FunctionsArtificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension Functions
 
Oracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptxOracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptx
 
How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?
 

Swift 3.0 で変わったところ - 厳選 13 項目 #love_swift #cswift

  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23. 
 class Item { // 戻り値を使わないと警告される @warn_unused_result func makeFilter() -> Filter {…} // 戻り値を使わなくても警告されない func apply(filter: Filter) -> Item {…} }
  • 24. 
 class Item { // 戻り値を使わないと警告される func makeFilter() -> Filter {…} // 戻り値を使わなくても警告されない @discardableResult func apply(filter: Filter) -> Item {…} }
  • 25. 
 /// MutatingCounterpart: xxxx /// MonmutatingCounterpart: xxxx func makeFilter() -> Filter {…}
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31. func add<T: FloatingPoint>(lhs: T, rhs: T) -> T { return lhs + rhs }
  • 32.
  • 33.
  • 34. enum Item { case binary(NSData) } let data1: NSMutableData = … let data2: NSData = … let item = Item.binary(data1) data1.appendData(data2)
  • 35. enum Item { case binary(Data) } var data1: Data = … let data2: Data = … let item = Item.binary(data1) data1.appendData(data2)
  • 36.
  • 37.
  • 38.
  • 39. Advance to the next element and return it, or `nil` if no next element exists.Once `nil` has been returned, all subsequent calls return `nil`. protocol IteratorProtocol { associatedtype Element mutating func next() -> Element?
  • 40.
  • 41.
  • 42. protocol BooleanType { var boolValue: Bool { get } }
  • 43. func remove<T:BooleanType>(recursively flag: T) { … } func isKindOf<R:BooleanType>(type: AnyType) -> R { … }
  • 44. struct Condition : BooleanType { … } let condition = Condition(…) if condition { … }
  • 45. !, &&, || func && (lhs: Bool, rhs: () -> Bool) -> Bool func || (lhs: Bool, rhs: () -> Bool) -> Bool func ! (a: Bool) -> Bool
  • 46.
  • 47.
  • 48.
  • 49. // 定義では `` が必要 enum DrawingStyle { case `default` case `repeat` case fit } // 使用時は `` が不要 let style = DrawingStyle.default
  • 50. // 定義では `` が必要 class Object { var `default`: Int func `repeat`(_ times: Int) -> String { … } } // 使用時は `` が不要 let object = Object() let value = object.default
  • 51. // 定義では `` が必要 enum Evaluate { case `self` case `dynamicType` } // 使用時も `` が必要 let eval = Evaluate.`self`
  • 52.
  • 53.
  • 54.
  • 55. // プロトコル型で使う let p: A & B = Value() // 型引数で使う func doSomething<T: A & B>(_ value: T) { }
  • 56.
  • 57.
  • 58.
  • 59. struct Value : Equatable { static func == (lhs: Value, rhs: Value) -> Bool { } }
  • 60. class Base : Equatable { func isEqual(to rhs: Base) -> Bool {…} } class Sub : Base { override func isEqual(to rhs: Base) -> Bool {…} } func == (lhs: Base, rhs: Base) -> Bool { return lhs.isEqual(to: rhs) }
  • 61. class Base : Equatable { class func == (lhs: Base, rhs: Base) -> Bool {…} } class Sub : Base { override class func == (lhs: Base, rhs: Base) -> Bool {…} }
  • 62.
  • 63.
  • 64. func makeIncrementer(inout value: Int) -> () -> Void { return { value += 1; print("Inside:", value) } } var value = 1 let incrementer = makeIncrementer(&value) print("Outside:", value) // Outside: 1 incrementer() // Inside: 2 print("Outside:", value) // Outside: 1 incrementer() // Inside: 3 print("Outside:", value) // Outside: 1
  • 65. func something(value: inout Int) { let noescaped: @noescape () -> Void = { value = 10 } let escaped: () -> Void = { [value] in print(value) } } 

  • 66.
  • 67.
  • 68.
  • 69. func total(price: Int, count: Int) -> Int { } // 引数リストを丸ごとタプルで扱える let item: (Int, count: Int) = (100, 5) total(item)
  • 70. func total(price: Int, count: Int) -> Int { } // 原則、引数リストを1つのタプルで表現できない let item: (Int, count: Int) = (100, 5) total(item)
  • 71. func apply<T, R>(value: T, f: (T) -> R) -> R { return f(value) } let item: (Int, count: Int) = (100, 5) func total(price: Int, count: Int) -> Int { … } apply(value: item, f: total)
  • 72.
  • 73.
  • 74.
  • 75. switch (value1, value2) { case let (value?, nil), let (nil, value?): return value case let (value1?, value2?): return value1 + value2 case (nil, nil): return 0 }
  • 76. switch device { case let .iPhone(_, osVersion, network, _) where osVersion > 8.0, let .iPad(_, osVersion, network, _, true) where network == .cellular, doSomething(device, osVersion, network) case .iPodTouch: doSomething(device) default: doSomething() }
  • 77.
  • 78.
  • 79. let values = sequence(first: 1) { $0 * 2 }
  • 80.
  • 81.
  • 82.
  • 83. struct MutableSlice<Base : MutableIndexable> { var base: Base { get } }
  • 84.
  • 85.
  • 86.
  • 87.
  • 88.
  • 89.
  • 90.
  • 91.
  • 92.