Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
uhooiさん発ランダムタスクにチャレンジしよう!
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
野瀬田 裕樹
August 10, 2026
Programming
88
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
uhooiさん発ランダムタスクにチャレンジしよう!
集まれSwift好き!Swift愛好会 vol.80 @ DeNA
https://love-swift.connpass.com/event/311304/
野瀬田 裕樹
August 10, 2026
More Decks by 野瀬田 裕樹
See All by 野瀬田 裕樹
速習iPhone Duo対応
yuukiw00w
3
1k
App Storeの外へ──日本のiOSサイドローディング入門 for iOSDC Japan 2026
yuukiw00w
0
390
ネイティブiOSアプリだからできること
yuukiw00w
0
52
野瀬田とSwift愛好会
yuukiw00w
0
41
ViewModelって200種類あんねん
yuukiw00w
0
66
Validate your App Intents adoption with AppIntentsTesting
yuukiw00w
0
62
App Intentsを実装しよう
yuukiw00w
0
63
iOS26時代の新規アプリ開発
yuukiw00w
0
280
Swift ConcurrencyでよりSwiftyに
yuukiw00w
0
420
Other Decks in Programming
See All in Programming
個人開発者よ、Honoを使え(おじさんver)
tanahiro2010
2
290
そのデザイントークン、Flutterでも同じ見た目になりますか?
nakamizu
0
110
JIS keyboard support in Omarchy
lef237
0
170
AIで開発が速くなった先で、開発チームは何を目指すか
shihochan
1
1.9k
Railsのためのパスキー実践入門 〜マルチテナントSaaSでの意思決定〜
utakaha
3
1.5k
エージェントを使い続けるためのメタワーク / Meta-work for keeping using the agent
rkaga
6
2k
Compiling a real-world CLI tool to native with Static Hermes
tmikov2023
0
140
動画プレイヤーはなぜカクつくのか 〜Flutterのレンダリングとネイティブの境界を解剖する〜
naruogram
0
270
自サークルのIdPからログアウトできるようになるまで
taiseiue
1
150
Zero-Tap Sign-In対応、結局何をすればいいの?
mitohato14
0
1k
学びを記事・スライド・Xへ高速展開する― AI-assisted Learning Loopで回すコンテンツ生成術
ochtum
0
160
Long Living Tokens, Die, Die, Die! (or: The One Ring is Banned in Modern)
sylph01
0
380
Featured
See All Featured
HDC tutorial
michielstock
2
980
Code Reviewing Like a Champion
maltzj
529
40k
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
460
Digital Ethics as a Driver of Design Innovation
axbom
PRO
1
470
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.4k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3.4k
Agile Leadership in an Agile Organization
kimpetersen
PRO
0
300
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
230
23k
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
2
330
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
16k
What the history of the web can teach us about the future of AI
inesmontani
PRO
2
760
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
340
Transcript
uhooiさん発ランダムタスクに チャレンジしよう! 野瀬田 裕樹
野瀬田 裕樹(@ynoseda) DMM.com アプリ開発室所属
uhooiさん • uhooiさんのことはみんな知ってる前提なので話しません • たまにuhooiさんのXからランダムにアプリ開発のお題が流れてくることがあり ます • 今日はたまたま目についたそれをやった話
お題1:ScrollViewの背景色を良い感じにしたい!
やりたいこと • ScrollViewで引っ張ったとき、コンテンツ領域の外ではScrollView自体の backgroundが見える • このbackgroundの色をコンテンツの色と同じにしたい • 上から下に引っ張ったときは、コンテンツの上の方の色と同じにしたい • 逆の場合はコンテンツの下の方の色と同じにしたい
お題1の解答編
お題1の解答編 - 概要 • コンテンツのy座標に連動するpositionを保持する • ScrollViewの背景色で、このpositionより上の領域はコンテンツの上の方の色 にする • 逆に下の方の領域はコンテンツの下の方の色にする
お題1の解答編 - コンテンツのy座標に連動させる private struct ScrollContentViewMinYPreferenceKey: PreferenceKey { static var
defaultValue: [CGFloat] = [0] static func reduce(value: inout [CGFloat], nextValue: () -> [CGFloat]) { value.append(contentsOf: nextValue()) } }
お題1の解答編 - コンテンツのy座標に連動させる ScrollView { content().overlay { GeometryReader { proxy
in Color.clear.preference( key: ScrollContentViewMinYPreferenceKey.self, value: [proxy.frame(in: .global).minY] ) } } }.onPreferenceChange(ScrollContentViewMinYPreferenceKey.self) { value in scrollContentViewMinY = value[0] }
お題1の解答編 - 連動したpositionより上だけ色を変更 .background { VStack(spacing: 0) { topBackgroundColor.frame(height: max(scrollContentViewMinY,
0)) bottomBackgroundColor.frame(height: scrollViewHeight - scrollContentViewMinY) }.ignoresSafeArea() }.overlay { GeometryReader { proxy in Color.clear.onAppear { scrollViewHeight = proxy.frame(in: .global).height } }.ignoresSafeArea() }
お題1の解答編 - 結果 • これで良い感じになった! • https://x.com/ynoseda/status/1737120393960558947?s=20 • 補足 ◦
別に基準値はminYじゃなくてもmaxYでもなんでもいいです ▪ コンテンツの裏のどこかのpositionで切り替わればいいので
お題2:スクロールの境目でボタンの色を変えたい!
やりたいこと • ScrollViewでスクロールしたとき、ナビゲーションバーが透明だとボタンとコン テンツの色が重なって見辛くなることがある • Appleの公式のアプリだと背景色に合わせてボタンの色が良い感じに変化して いる • これを実現したい
お題2の解答編
お題2の解答編 - 概要 • スクロールするごとに今のwindow(UIView)からUIImageに変換する • このとき、ボタンのframeを使ってボタン部分のみを切り出す • 切り出すときにボタンの形状にあたる丸を書いてその外側だけ書き出すよう にする
• ボタンの周りのUIImageが得られるのでそれが明るいか判定する
お題2の解答編 - コード • https://gist.github.com/yuukiw00w/0972b4fd33a08fe774228ebaa592558e • 実装は↑にあるが、汚すぎるので参考までに • https://x.com/ynoseda/status/1741515297054744844?s=20 •
補足 ◦ パフォーマンス低そうな気がするので実運用に耐えられるかは微妙 ◦ 階層は違うけど裏にいるViewの色を判定するAPIとか欲しい
まとめ • たまに時間あったらこういうお題にチャレンジしても面白いよね • みんなも自分なりの回答をポストしてみよう!