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
0
790
Swift 5.1の変更点
2019/11/29 yumemi.swiftでの発表内容です。
iganin
November 29, 2019
Tweet
Share
More Decks by iganin
See All by iganin
Three-Legged OAuth in AgentCore Gateway
hironobuiga
2
210
Amazon Bedrock AgentCore 認証・認可入門
hironobuiga
3
570
AgentCoreで実現するマルチテナントAIエージェント
hironobuiga
1
30
FlutterでGraphQL のuseQueryを使う
hironobuiga
0
17
FlutterでGraphQLを扱う
hironobuiga
0
15
FlutterでScrollViewとExpandedを併用し てSignIn / SignUp画面 など レイアウトを作成する
hironobuiga
0
13
Data Race and Actor
hironobuiga
0
68
20210625-meet-async-await@swift愛好会
hironobuiga
1
1.6k
IBDesignable を活用する
hironobuiga
0
14
Other Decks in Programming
See All in Programming
nilとは何か 〜interfaceの構造とnil!=nilから理解する〜 / Understanding nil in Go Interface Representation and Why nil != nil
kuro_kurorrr
3
1.5k
ご飯食べながらエージェントが開発できる。そう、Agentic Engineeringならね。
yokomachi
1
270
Swift ConcurrencyでよりSwiftyに
yuukiw00w
0
220
AIによる開発の民主化を支える コンテキスト管理のこれまでとこれから
mulyu
3
2.2k
AIに仕事を丸投げしたら、本当に楽になれるのか
dip_tech
PRO
0
170
猫の手も借りたい!ので AIエージェント猫を作って社内に放した話 Claude Code × Container Lambda の Slack Bot "DevNeko"
naramomi7
0
220
24時間止められないシステムを守る-医療ITにおけるランサムウェア対策の実際
koukimiura
2
180
AHC061解説
shun_pi
0
270
CSC307 Lecture 13
javiergs
PRO
0
310
DevinとClaude Code、SREの現場で使い倒してみた件
karia
1
760
受け入れテスト駆動開発(ATDD)×AI駆動開発 AI時代のATDDの取り組み方を考える
kztakasaki
2
500
Raku Raku Notion 20260128
hareyakayuruyaka
0
420
Featured
See All Featured
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
54k
How GitHub (no longer) Works
holman
316
140k
From π to Pie charts
rasagy
0
140
A Tale of Four Properties
chriscoyier
162
24k
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
460
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.1k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3.1k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.4k
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
1
850
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
2.8k
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
2.4k
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
1
67
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!