SlideShare ist ein Scribd-Unternehmen logo
1 von 93
Downloaden Sie, um offline zu lesen
/*
*/


/**
*/
/* @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 */

Weitere ähnliche Inhalte

Was ist angesagt? (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
 

Andere mochten auch

Swift 構造体の時代 #yidev
Swift 構造体の時代 #yidevSwift 構造体の時代 #yidev
Swift 構造体の時代 #yidevTomohiro Kumagai
 
Swift の3大プロトコルを眺めてみる #love_swift
Swift の3大プロトコルを眺めてみる #love_swiftSwift の3大プロトコルを眺めてみる #love_swift
Swift の3大プロトコルを眺めてみる #love_swiftTomohiro Kumagai
 
Swift チャチャチャ #love_swift
Swift チャチャチャ #love_swiftSwift チャチャチャ #love_swift
Swift チャチャチャ #love_swiftTomohiro Kumagai
 
リテラルと型の話 #__swift__
リテラルと型の話 #__swift__リテラルと型の話 #__swift__
リテラルと型の話 #__swift__Tomohiro Kumagai
 
Swift らしい表現を目指そう #eventdots
Swift らしい表現を目指そう #eventdotsSwift らしい表現を目指そう #eventdots
Swift らしい表現を目指そう #eventdotsTomohiro 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 ClientKenji Tanaka
 
Swift Package Manager ことはじめ #cswift
Swift Package Manager ことはじめ #cswiftSwift Package Manager ことはじめ #cswift
Swift Package Manager ことはじめ #cswiftTomohiro 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 #cswiftTomohiro 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 9Shuichi Tsutsumi
 
AKIBA.swift vol.1
AKIBA.swift vol.1AKIBA.swift vol.1
AKIBA.swift vol.1cocominap
 
Swift 2.0 で変わったところ「後編」 #cswift
Swift 2.0 で変わったところ「後編」 #cswiftSwift 2.0 で変わったところ「後編」 #cswift
Swift 2.0 で変わったところ「後編」 #cswiftTomohiro 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 ClosureNaruki Chigira
 

Andere mochten auch (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
 

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

Swift the implicit parts
Swift the implicit partsSwift the implicit parts
Swift the implicit partsMaxim Zaks
 
TI1220 Lecture 6: First-class Functions
TI1220 Lecture 6: First-class FunctionsTI1220 Lecture 6: First-class Functions
TI1220 Lecture 6: First-class FunctionsEelco Visser
 
Functional programming ii
Functional programming iiFunctional programming ii
Functional programming iiPrashant 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.pdfcallawaycorb73779
 
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.pdfrajkumarm401
 
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.pdffantoosh1
 
#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.docxajoy21
 
Hello Swift 3/5 - Function
Hello Swift 3/5 - FunctionHello Swift 3/5 - Function
Hello Swift 3/5 - FunctionCody Yun
 
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.pdfdhavalbl38
 
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.pdffootstatus
 
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.pdfflashfashioncasualwe
 

Ähnlich wie 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
 

Mehr von Tomohiro Kumagai

最近気づいた勉強法 — 勉強会開催の習慣化 #yumemi_grow
最近気づいた勉強法 — 勉強会開催の習慣化 #yumemi_grow最近気づいた勉強法 — 勉強会開催の習慣化 #yumemi_grow
最近気づいた勉強法 — 勉強会開催の習慣化 #yumemi_growTomohiro 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_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
 

Mehr von 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 福岡・発表資料
 

Kürzlich hochgeladen

Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 

Kürzlich hochgeladen (20)

Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 

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.