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
野瀬田 裕樹
August 10, 2026
Programming
74
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
1
520
App Storeの外へ──日本のiOSサイドローディング入門 for iOSDC Japan 2026
yuukiw00w
0
220
ネイティブiOSアプリだからできること
yuukiw00w
0
29
野瀬田とSwift愛好会
yuukiw00w
0
35
ViewModelって200種類あんねん
yuukiw00w
0
56
Validate your App Intents adoption with AppIntentsTesting
yuukiw00w
0
51
App Intentsを実装しよう
yuukiw00w
0
53
iOS26時代の新規アプリ開発
yuukiw00w
0
270
Swift ConcurrencyでよりSwiftyに
yuukiw00w
0
390
Other Decks in Programming
See All in Programming
MVNOの申込からeSIM開通までをiOSアプリでつなぐ- 本人確認・MNP・通信事業者基盤をまたぐ実装
satotakeshi
0
420
変化を抱擁するドキュメントの作り方 - ビジネスルール駆動開発がもたらす、コードとの新しい関係
ioki
2
210
XP祭りでしか伝わらないフリップネタ #xpjug
murabayashi
0
150
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
140
仕様駆動開発による爆速プロダクト開発 / Bakusoku Spec Driven Development
kobakei
0
120
Intent as Code
shoppingjaws
6
1k
C#の現在地 進化の歴史と、AI時代の.NET Everywhere
neuecc
4
2.1k
手動確認はもう限界 〜XCUITestでCustom URL Schemeの遷移を起動種別ごとに自動テストする〜 / Testing Custom URL Schemes with XCUITest
otouto
0
300
アクセシビリティから考える情報設計
high_g_engineer
0
380
{ Android | Kotlin } Gradle Plugin in 2026
ryunen344
1
320
世界の中心で、AI(App Intents)をさけぶ ー App Intents中心設計の実践ガイド
touyou
0
590
Java 27新機能 / Java 27 new features
kishida
2
150
Featured
See All Featured
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
2
2.1k
A Modern Web Designer's Workflow
chriscoyier
699
190k
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
520
Ethics towards AI in product and experience design
skipperchong
2
380
The Pragmatic Product Professional
lauravandoore
37
7.4k
How to train your dragon (web standard)
notwaldorf
97
6.8k
WCS-LA-2024
lcolladotor
0
830
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
56
3.5k
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
390
Joys of Absence: A Defence of Solitary Play
codingconduct
1
520
Building a Modern Day E-commerce SEO Strategy
aleyda
45
9.2k
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
0
240
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とか欲しい
まとめ • たまに時間あったらこういうお題にチャレンジしても面白いよね • みんなも自分なりの回答をポストしてみよう!