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
おしゃれなTabBarを作る!
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Kanta
April 22, 2023
68
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
おしゃれなTabBarを作る!
Kanta
April 22, 2023
More Decks by Kanta
See All by Kanta
最新技術をキャッチアップしたい~The Composable Architecture~
kantaswift
3
260
Swift丸1年学んだらどこまでできる!?
kantaswift
3
520
Featured
See All Featured
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
1
2.6k
Practical Orchestrator
shlominoach
191
12k
Navigating Weather and Climate Data
rabernat
0
500
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
360
The Cult of Friendly URLs
andyhume
79
7k
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
480
What's in a price? How to price your products and services
michaelherold
247
13k
Evolving SEO for Evolving Search Engines
ryanjones
0
280
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
3k
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
69
65k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.6k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k
Transcript
PayPayのようなおしゃれな TabBarを作る! 上條 栞汰 ~ in SwiftUI ~
⾃⼰紹介 l 上條栞汰(かみじょうかんた) l 東洋⼤学総合情報学部2年 l Swift歴 1年(あと3週間ぐらい!!) l UIKit
11ヶ⽉ l SwiftUI 1ヶ⽉ 経歴(インターン) l 株式会社ゆめみ l 株式会社サイバーエージェント CA Tech iOS Dojo @kanta_Swift @KantaSwift よろしければフォローお願い致します🙇
PayPayのTabBar 1. 浮いてるように⾒えるデザイン! 2. View(スクロール)と連携している! 3. 膨らんでいる部分がある! <特徴>
3つの特徴を押さえて 実際に作ってみる!!
完成品
冒頭で挙げた特徴を どのように実現していったか 簡単に紹介します!
特徴1. 浮いているように⾒えるデザイン overlayを使⽤! 👈のようなモデルを定義!! -> タブの個数を任意にすることができる! タブとViewを対応させることができる! -> 浮いているように⾒せることができる!
特徴2. スクロールと連携 GeometryReader + PreferenceKey 👇 ScrollViewのOffsetを 取得することができる! [参考] https://medium.com/@maxnatchanon/sw
iftui-how-to-get-content-offset-from- scrollview-5ce1f84603ec 外国の⽅の記事が ⼀番わかりやすかったです!! 👆
特徴3. 膨らみの再現 addLine(to: CGPoint) 現在の位置から引数(to)で指定した位置まで move(to: CGPoint) pathの始点 などなど... いろいろ試してみると楽しい👍
👇 👇
以上3つの特徴を押さえた技術分野をまとめると... • PreferenceKey -> ⼦ビューから親ビューにデータを渡す仕組み • GeometryReader -> ⾃⾝の親のViewに対する位置を知る仕組み •
ShapeとPath -> いろんな形の図形を作ることができる!!
おまけ @resultBuilderについて 配列なのにカンマとシンタックスがない!? 1. 要素の組み合わせを宣⾔的にかける! 2. 可読性が上がってる?かも!
開発する上で参考したサイト達 最後に 特徴1. 浮いているように⾒えるデザイン+おまけ • https://capibara1969.com/2723/ • https://capibara1969.com/2771/ 特徴2. スクロールと連携
特徴3. 膨らみの表現 • https://medium.com/@maxnatchanon/swiftui-how-to-get-content-offset-from-scrollview-5ce1f84603ec • https://qiita.com/hcrane/items/3f3a9ff2ef0fccd01338 • https://qiita.com/maiyama18/items/a64bab2094750319ef8d • https://speakerdeck.com/chocoyama/20fen-dewakaru-su-xi-resultbuilder-iosdc-2022 • https://speakerdeck.com/uhooi/iosdc-japan-2022
ご清聴ありがとうございました! ※近⽇(今⽉中!)に今回開発したTabViewのコードを公開するので 気になる⽅いらっしゃいましたらフォローお願いします🙇 @KantaSwift