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
72
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 野瀬田 裕樹
App Storeの外へ──日本のiOSサイドローディング入門 for iOSDC Japan 2026
yuukiw00w
0
150
ネイティブiOSアプリだからできること
yuukiw00w
0
19
野瀬田とSwift愛好会
yuukiw00w
0
30
ViewModelって200種類あんねん
yuukiw00w
0
49
Validate your App Intents adoption with AppIntentsTesting
yuukiw00w
0
48
App Intentsを実装しよう
yuukiw00w
0
49
iOS26時代の新規アプリ開発
yuukiw00w
0
270
Swift ConcurrencyでよりSwiftyに
yuukiw00w
0
380
Human Interface Guidelines 2
yuukiw00w
0
86
Other Decks in Programming
See All in Programming
GKE アップグレード前に知っておきたい Blue/Green と PDB の関係
stkk
0
160
Gmail/Google DriveをトリガーにAIエージェントを動かそう! / Run AI agents with Gmail/Google Drive as triggers!
har1101
3
490
WebMCP Challenge に星空観察アプリで参加した話
okajun35
0
120
ALB ログから Trace を気合で繋げる技術
fohte
7
880
iOS開発×AI駆動開発 〜最近使って便利だったスキルの話〜
nogu66
0
140
LL言語やWebフレームワークのPostgreSQL対応 〜DBの機能がユーザーに届くまで〜
kentaroutakeda
0
150
デプロイ直後のレイテンシスパイクを調べたら、 Railsの仕様にたどり着いた
nhsykym
0
110
AI時代に学ぶ 好きなルール 嫌いなルール Linter編
shorty5121
0
910
Laravelのアプリケーションをどこにデプロイするか #ツナギメオフライン.9
akase244
0
120
コンパウンドプロダクト開発のためのローカルプロセスマネージャー再発明 #layerxgo
izumin5210
0
660
AWS Step Functions 大規模並列の壁を越える / jaws-sonic-2026-niigata-step-functions
kasacchiful
PRO
1
430
業務時間外もAIに働いてもらう話
colorful12
3
10k
Featured
See All Featured
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
2
500
Faster Mobile Websites
deanohume
310
32k
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
11k
The SEO Collaboration Effect
kristinabergwall1
1
550
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
660
Abbi's Birthday
coloredviolet
3
9.9k
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
3k
How to build a perfect <img>
jonoalderson
1
6k
Building Adaptive Systems
keathley
44
3.2k
Side Projects
sachag
456
43k
Building a Modern Day E-commerce SEO Strategy
aleyda
45
9.2k
The Spectacular Lies of Maps
axbom
PRO
1
990
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とか欲しい
まとめ • たまに時間あったらこういうお題にチャレンジしても面白いよね • みんなも自分なりの回答をポストしてみよう!