Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Swift 5.1の変更点
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
iganin
November 29, 2019
Programming
820
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Swift 5.1の変更点
2019/11/29 yumemi.swiftでの発表内容です。
iganin
November 29, 2019
More Decks by iganin
See All by iganin
FastMCP OAuth Proxy with Cognito
hironobuiga
3
340
Three-Legged OAuth in AgentCore Gateway
hironobuiga
2
290
Amazon Bedrock AgentCore 認証・認可入門
hironobuiga
3
640
AgentCoreで実現するマルチテナントAIエージェント
hironobuiga
2
140
FlutterでGraphQL のuseQueryを使う
hironobuiga
0
27
FlutterでGraphQLを扱う
hironobuiga
0
25
FlutterでScrollViewとExpandedを併用し てSignIn / SignUp画面 など レイアウトを作成する
hironobuiga
0
22
Data Race and Actor
hironobuiga
0
84
20210625-meet-async-await@swift愛好会
hironobuiga
1
1.7k
Other Decks in Programming
See All in Programming
運用エージェントは "作る" から "育てる" へ - 記憶と自己進化の3層設計パターン / self-evolving-agents-three-layer-agent-design
gawa
12
3.5k
dRuby over BLE
makicamel
2
320
決定論的オーケストレーションの設計と実装 / Design and Implementation of Deterministic Orchestration
nrslib
3
1.1k
[2026年度第1回ORセミナー] 計画最適化ベンチャーと競技プログラミング人材
terryu16
0
250
Why Laravel apps break—Mastering the fundamentals to keep them maintainable
kentaroutakeda
1
340
脅威をエンジニアリングの糧にして――現場編 / Turning Threats into Engineering Fuel — Field Edition
nrslib
0
250
GitHub Copilot CLIのいいところ
htkym
2
1.3k
IBM Bobを活用したレガシーアプリの最新化
oniak3ibm
PRO
1
170
RTSPクライアントを自作してみた話
simotin13
0
490
メソッドのジェネリクスでGoの夢は広がるか? / Kyoto.go #65
utgwkk
3
560
Oxlintのカスタムルールの現況
syumai
5
1k
不変条件と整合性境界—ビジネスが決める設計判断と実現パターン / Invariants and Consistency Boundaries
nrslib
13
3.4k
Featured
See All Featured
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
300
Designing Experiences People Love
moore
143
24k
The Curse of the Amulet
leimatthew05
1
13k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.2k
Navigating Weather and Climate Data
rabernat
0
210
Why You Should Never Use an ORM
jnunemaker
PRO
61
9.9k
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
160
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
2.8k
AI: The stuff that nobody shows you
jnunemaker
PRO
8
690
Code Reviewing Like a Champion
maltzj
528
40k
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.6k
brightonSEO & MeasureFest 2025 - Christian Goodrich - Winning strategies for Black Friday CRO & PPC
cargoodrich
3
720
Transcript
Swift 5.1 の変更点 2019/11/29 yumemi.swift Hironobu Iga
自己紹介 Hironobu Iga( Iganin ) Freelance Mobile App Engineer( iOS
, Android) • Twitter: @iganin_dev • Hatena: Iganin • Qiita: @iganin
話すこと • ざっくりとしたSwift 5.1 の変更点確認 • Pickup ◦ SE-0242 Synthesize
default values for the memberwise initializer ◦ SE-0068 Expanding Swift Self to class members and value types • まとめ
Swift5.1の変更点 (ざっくり)
Swift 5.1で入った変更点 Swift UIの導入もあり、非常に多くの変更が入っています。 簡単にキーワードを上げていきます。
Swift 5.1で入った変更点 Module Stability swiftmodule の ライブラリInterface定義の安定化により、ライブラリのコンパイル時に 使用したSwiftバージョンとアプリのSwiftバージョンが異なっても大丈夫に Additional Language
and Compiler Update SwiftUIの導入と共に多くの変更が入っています • Property Wrapper • Opaque Result Types • single expression の場合はreturn 不要 ( var sample: String { “sample” } ) • Key Path Member Lookup • etc
Swift 5.1で入った変更点 Standard Library Updates Collectionsの扱い, Arrayの初期化, StringにいくつかのAPIが追加 ,Identifiableプロトコ ルの導入など
Language Server Protocol LSPをサポートしているエディターであれば、Swiftのコード補完やシンタックスハイライ ト、ジャンプ機能などが使えるように
PickUpして話すこと Swift UI の導入もあり多くの変更点があります それぞれの内容は深く、他の勉強会でも語られているため 本日の発表ではあまり他の勉強会でみなかった2つをPickupします • SE-0242 Synthesize default
values for the memberwise initializer • SE-0068 Expanding Swift Self to class members and value types
SE-0242 Synthesize default values for the memberwise initializer
Synthesize default values for the memberwise initializer ざっくり説明 Structの自動生成される初期化メソッドがより便利になった
Synthesize default values for the memberwise initializer 従来は、 `var id:
Int = 0` と定義していてもデフォルト値を考慮した初期化メソッドは生成 されていませんでした
Synthesize default values for the memberwise initializer User(name: “Tanaka”) のように初期化するためには、
明示的に定義する必要がありま した
Synthesize default values for the memberwise initializer var id: Int
= 0 を考慮した初期化メソッド init(id: Int = 0, name: String) のようにデフォルト引数を考慮した初期化メソッドが自動生 成されるようになり、明示的にメソッドを作成する必要がなくなりました OK!
SE-0068 Expanding Swift Self to class members and value types
Expanding Swift Self to class members and value types ざっくり説明
class内からstatic変数やメソッドにアクセスしやすくなりました
Expanding Swift Self to class members and value types staticなhogeという変数とfugaというメソッドを定義します。
struct内からアクセスする際に従来は ${Struct名}.変数 や type(of: self).変数とする必 要がありました。
Expanding Swift Self to class members and value types Swift
5.1 以降では、 class, struct, enum内から staticな変数やメソッドにアクセスする際 に、 Self を利用できるようになりました OK!
Expanding Swift Self to class members and value types インスタンス変数・メソッドへのアクセス
• self.変数 • self.メソッド staticへ変数・メソッドへのアクセス • Self.変数 • Self.メソッド 上記のように綺麗な対比関係ができました
まとめ • Swift UI の導入もあり、多くの変更点 • 2つの変更をPickup ◦ structの自動生成初期化メソッドが便利に ◦
staticな変数・メソッドにSelfでアクセス可能に
補足 Swift.orgの1次情報にあたるのはとてもオススメです • https://swift.org/blog/ Swift 5.1の新機能が解説されているPlaygroundが GitHubにありオススメです • twostraws/whats-new-in-swift-5-1 ◦
GitHub: https://github.com/twostraws/whats-new-in-swift-5-1 ◦ 関連記事: https://github.com/twostraws/whats-new-in-swift-5-1
Thank you!