Skip to content

โœจ[Feat/fix]๐Ÿž ์˜์ƒ ๋ฒ„ํผ๋ง, ๋ ˆ์ด์•„์›ƒ ๋ฒ„๊ทธ ์ˆ˜์ • ๋ฐ ์Œ์•… ๋ฏธ๋ฆฌ๋“ฃ๊ธฐ ๊ธฐ๋Šฅ ๊ตฌํ˜„ (ํ•„์ˆ˜ ๊ณผ์ œ ๊ตฌํ˜„ ์™„๋ฃŒ)#16

Open
coduhee wants to merge 64 commits into
mastarTrack:mainfrom
coduhee:feature/develop-jh-hard

Conversation

@coduhee
Copy link
Copy Markdown
Collaborator

@coduhee coduhee commented Mar 18, 2026

์˜์ƒ ์žฌ์ƒ ์‹œ์  ์ˆ˜์ •: AVPlayerItem.Status์˜ ๊ฐ’์ด (.readyToPlay)์ธ ์‹œ์ ์— player๋ฅผ playํ•˜์—ฌ ๋ฒ„ํผ๋ง ๋ฒ„๊ทธ๋ฅผ ์žก์•˜์Šต๋‹ˆ๋‹ค.

์˜์ƒ ๋ ˆ์ด์•„์›ƒ ์ˆ˜์ •: ์˜คํ† ๋ ˆ์ด์•„์›ƒ์ด ์„ค์ •๋˜๊ธฐ์ „์— ์˜์ƒ์ด play๋˜์–ด ๋ ˆ์ด์•„์›ƒ์ด 0์œผ๋กœ ์ฐŒ๊ทธ๋Ÿฌ์ ธ์žˆ๋˜ ๋ฌธ์ œ๋ฅผ contentView.bounds๋ฅผ ํ”Œ๋ ˆ์ด์–ด ๋ ˆ์ด์–ด์— ๋Œ€์ž…ํ•ด ๋ฒ„๊ทธ๋ฅผ ์žก์•˜์Šต๋‹ˆ๋‹ค.

๋ฏธ๋ฆฌ๋“ฃ๊ธฐ ์˜ค๋””์˜ค ์žฌ์ƒ: ๋ฆฌ์ŠคํŠธ์—์„œ ๊ณก์„ ์„ ํƒํ•˜๋ฉด ํ•ด๋‹น ์Œ์›์ด ์žฌ์ƒ๋˜๋„๋ก ๊ตฌํ˜„ํ–ˆ์Šต๋‹ˆ๋‹ค.

์žฌ์ƒ ์ƒํƒœ UI ์—ฐ๋™: ReactorKit์˜ State๋กœ ์žฌ์ƒ ์ค‘์ธ URL์„ ๊ด€๋ฆฌํ•˜์—ฌ, ์žฌ์ƒ ์ค‘์ธ ์…€์—๋งŒ dimView์™€ ํŒŒ๋™ ์•„์ด์ฝ˜(Indicator)์ด ๋œจ๋„๋ก ๋ฐ์ดํ„ฐ ํ๋ฆ„์„ ์—ฐ๊ฒฐํ–ˆ์Šต๋‹ˆ๋‹ค.

์˜ค๋””์˜ค ๋งค๋‹ˆ์ € ๋„์ž…: ์‹ฑ๊ธ€ํ†ค ํŒจํ„ด์˜ AudioManager๋ฅผ ๋งŒ๋“ค์–ด, ํ™”๋ฉด์„ ๋„˜๋‚˜๋“ค๊ฑฐ๋‚˜ ์—ฌ๋Ÿฌ ๊ณก์„ ๋ˆŒ๋Ÿฌ๋„ ์†Œ๋ฆฌ๊ฐ€ ์ ˆ๋Œ€ ๊ฒน์น˜์ง€ ์•Š๋„๋ก ์ตœ์ ํ™”ํ–ˆ์Šต๋‹ˆ๋‹ค.

์˜ˆ์™ธ ์ฒ˜๋ฆฌ: ๋ฏธ๋ฆฌ๋“ฃ๊ธฐ URL์ด ์—†๋Š” ๊ณก์„ ํด๋ฆญํ•  ๊ฒฝ์šฐ, Reactor ๋‹จ์—์„œ ๋ฐฉ์–ด ๋กœ์ง์„ ํƒ€๊ฒŒ ํ•˜์—ฌ ์—๋Ÿฌ ํŒ์—…์„ ๋„์šฐ๋„๋ก ๋””ํ…Œ์ผ์„ ์ฑ™๊ฒผ์Šต๋‹ˆ๋‹ค.

coduhee added 30 commits March 11, 2026 20:40
1. ์ปจํ…Œ์ด๋„ˆ ๋ทฐ Leading ์•ž์œผ๋กœ 10๋งŒํผ ๋‹น๊ธฐ๊ธฐ
2. ๊ตฌ๋ถ„์„  trailing ์•ž์œผ๋กœ 10๋งŒํผ ๋‹น๊ธฐ๊ธฐ
600x600์€ ๋„ˆ๋ฌด ๋ฌด๊ฑฐ์›Œ์„œ ๋กœ๋”ฉ ์†๋„ ์ €ํ•˜๋จ
coduhee added 26 commits March 17, 2026 11:45
ํ‰๊ท  ์ƒ‰์ƒ์œผ๋กœ ์นด๋“œ ๋งŒ๋“œ๋Š” ๊ธฐ๋Šฅ ์ œ๊ฑฐ
HomeVC, SearchVC ํ”Œ๋ ˆ์ด์–ด ํ†ตํ•ฉ ๊ด€๋ฆฌ
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

์ด๋ฒˆ PR์€ ์˜์ƒ ๋ฒ„ํผ๋ง ๋ฐ ๋ ˆ์ด์•„์›ƒ ๋ฒ„๊ทธ๋ฅผ ์ˆ˜์ •ํ•˜๊ณ , ์Œ์•… ๋ฏธ๋ฆฌ๋“ฃ๊ธฐ ๊ธฐ๋Šฅ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋“ฑ ๋งŽ์€ ๊ฐœ์„  ์‚ฌํ•ญ์„ ํฌํ•จํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. ์ „๋ฐ˜์ ์œผ๋กœ ๊ธฐ๋Šฅ ๊ตฌํ˜„์€ ์ž˜ ์ด๋ฃจ์–ด์กŒ์œผ๋‚˜, ์•ฑ์˜ ์„ฑ๋Šฅ, ํ…Œ์ŠคํŠธ ์šฉ์ด์„ฑ, ๊ทธ๋ฆฌ๊ณ  ์œ ์ง€๋ณด์ˆ˜์„ฑ์„ ํ–ฅ์ƒ์‹œํ‚ค๊ธฐ ์œ„ํ•ด ๋ช‡ ๊ฐ€์ง€ ๊ตฌ์กฐ์ ์ธ ๊ฐœ์„ ์ด ํ•„์š”ํ•ด ๋ณด์ž…๋‹ˆ๋‹ค. ์ฃผ์š” ํ”ผ๋“œ๋ฐฑ์€ ๋‹ค์Œ๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค:

  • AudioManager๋ฅผ ์‹ฑ๊ธ€ํ†ค ๋Œ€์‹  ์˜์กด์„ฑ ์ฃผ์ž…์„ ์‚ฌ์šฉํ•˜๋„๋ก ๋ฆฌํŒฉํ† ๋งํ•˜์—ฌ ํ…Œ์ŠคํŠธ ์šฉ์ด์„ฑ์„ ๋†’์ด๋Š” ๊ฒƒ์„ ์ œ์•ˆํ•ฉ๋‹ˆ๋‹ค.
  • AVPlayer๋ฅผ ์žฌ์‚ฌ์šฉ ๊ฐ€๋Šฅํ•œ ์…€(UICollectionViewCell) ๋‚ด์—์„œ ์ง์ ‘ ๊ด€๋ฆฌํ•˜๋Š” ๋Œ€์‹ , ViewController์—์„œ ๋‹จ์ผ ์ธ์Šคํ„ด์Šค๋กœ ๊ด€๋ฆฌํ•˜์—ฌ ๋ฆฌ์†Œ์Šค ์‚ฌ์šฉ์„ ์ตœ์ ํ™”ํ•˜๊ณ  ์ž ์žฌ์ ์ธ ์„ฑ๋Šฅ ๋ฌธ์ œ๋ฅผ ๋ฐฉ์ง€ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.
  • ์ƒํƒœ ๋ณ€๊ฒฝ์— ๋”ฐ๋ฅธ UI ์—…๋ฐ์ดํŠธ ๋ฐฉ์‹์„ ๋ณด๋‹ค ๋ฐ˜์‘ํ˜• ํŒจ๋Ÿฌ๋‹ค์ž„์— ๋งž๊ฒŒ ์ˆ˜์ •ํ•˜์—ฌ ์ฝ”๋“œ์˜ ์ผ๊ด€์„ฑ๊ณผ ์•ˆ์ •์„ฑ์„ ๋†’์ด๋Š” ๊ฒƒ์„ ๊ถŒ์žฅํ•ฉ๋‹ˆ๋‹ค.

Comment on lines +54 to +56
private var player: AVPlayer?
private var playerLayer: AVPlayerLayer?
private var playerItem: AVPlayerItem?
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

ํ˜„์žฌ SearchCollectionViewCell ๋‚ด๋ถ€์— AVPlayer ์ธ์Šคํ„ด์Šค๋ฅผ ์ง์ ‘ ์ƒ์„ฑํ•˜๊ณ  ๊ด€๋ฆฌํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. UICollectionViewCell์€ ์žฌ์‚ฌ์šฉ๋˜๊ธฐ ๋•Œ๋ฌธ์—, ๊ฐ ์…€์ด ์ž์‹ ๋งŒ์˜ AVPlayer๋ฅผ ๊ฐ€์งˆ ๊ฒฝ์šฐ ์—ฌ๋Ÿฌ ์‹ฌ๊ฐํ•œ ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค:

  1. ๊ณผ๋„ํ•œ ๋ฆฌ์†Œ์Šค ์‚ฌ์šฉ: AVPlayer๋Š” ๋ฌด๊ฑฐ์šด ๊ฐ์ฒด์ž…๋‹ˆ๋‹ค. ํ™”๋ฉด์— ์—ฌ๋Ÿฌ ๋น„๋””์˜ค ์…€์ด ๋™์‹œ์— ๋ณด์ด๋ฉด ๋‹ค์ˆ˜์˜ AVPlayer ์ธ์Šคํ„ด์Šค๊ฐ€ ์ƒ์„ฑ๋˜์–ด ๋ฉ”๋ชจ๋ฆฌ์™€ CPU ์‚ฌ์šฉ๋Ÿ‰์ด ๊ธ‰๊ฒฉํžˆ ์ฆ๊ฐ€ํ•˜๊ณ , ์•ฑ ์„ฑ๋Šฅ ์ €ํ•˜ ๋ฐ ๋น„์ •์ƒ ์ข…๋ฃŒ์˜ ์›์ธ์ด ๋  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
  2. ์žฌ์ƒ ๊ด€๋ฆฌ์˜ ๋ณต์žก์„ฑ: ViewController๊ฐ€ visibleCells๋ฅผ ์ˆœํšŒํ•˜๋ฉฐ ๊ฐ ์…€์˜ ๋น„๋””์˜ค๋ฅผ ์ง์ ‘ ์ œ์–ด(playVideo, pauseVideo)ํ•ด์•ผ ํ•˜๋ฏ€๋กœ ViewController์™€ Cell ๊ฐ„์˜ ๊ฒฐํ•ฉ๋„๊ฐ€ ๋†’์•„์ง‘๋‹ˆ๋‹ค.

๊ฐœ์„  ๋ฐฉ์•ˆ:
ViewController ๋ ˆ๋ฒจ์—์„œ ๋‹จ ํ•˜๋‚˜์˜ AVPlayer ์ธ์Šคํ„ด์Šค๋ฅผ ๊ด€๋ฆฌํ•˜๋Š” ๊ฒƒ์ด ์ข‹์Šต๋‹ˆ๋‹ค.

  • ViewController๊ฐ€ AVPlayer๋ฅผ ์†Œ์œ ํ•ฉ๋‹ˆ๋‹ค.
  • ์‚ฌ์šฉ์ž๊ฐ€ ์Šคํฌ๋กคํ•˜์—ฌ ํŠน์ • ๋น„๋””์˜ค ์…€์ด ํ™”๋ฉด ์ค‘์•™์— ์˜ค๊ฑฐ๋‚˜ ์žฌ์ƒ ์กฐ๊ฑด์ด ์ถฉ์กฑ๋˜๋ฉด, ViewController๋Š” ํ•ด๋‹น ์…€์˜ ๋น„๋””์˜ค URL๋กœ AVPlayer์˜ AVPlayerItem์„ ๊ต์ฒดํ•ฉ๋‹ˆ๋‹ค.
  • AVPlayerLayer๋ฅผ ํ•ด๋‹น ์…€์˜ contentView.layer์— ์ถ”๊ฐ€ํ•˜์—ฌ ๋น„๋””์˜ค๋ฅผ ํ‘œ์‹œํ•ฉ๋‹ˆ๋‹ค.
  • ์…€์ด ํ™”๋ฉด ๋ฐ–์œผ๋กœ ์‚ฌ๋ผ์ง€๋ฉด AVPlayerLayer๋ฅผ ์…€์˜ ๋ ˆ์ด์–ด์—์„œ ์ œ๊ฑฐํ•ฉ๋‹ˆ๋‹ค.

์ด ๋ฐฉ์‹์„ ํ†ตํ•ด AVPlayer ์ธ์Šคํ„ด์Šค๋ฅผ ํ•˜๋‚˜๋งŒ ์œ ์ง€ํ•˜์—ฌ ๋ฆฌ์†Œ์Šค๋ฅผ ํšจ์œจ์ ์œผ๋กœ ์‚ฌ์šฉํ•˜๊ณ , ์žฌ์ƒ ๋กœ์ง์„ ViewController์—์„œ ์ค‘์•™ ์ง‘์ค‘์ ์œผ๋กœ ๊ด€๋ฆฌํ•˜์—ฌ ์ฝ”๋“œ ๊ตฌ์กฐ๋ฅผ ๊ฐœ์„ ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

References
  1. ์…€ ์žฌ์‚ฌ์šฉ ๊ด€๋ฆฌ๋ฅผ ์ž˜๋ชปํ•˜์—ฌ ๋ˆˆ์— ๋ณด์ด๋Š” UI ๋ฒ„๊ทธ๋‚˜ ๋ฆฌ์†Œ์Šค ๋ˆ„์ˆ˜๋ฅผ ์œ ๋ฐœํ•  ์ˆ˜ ์žˆ๋Š” ๊ฒฝ์šฐ P1(high)์œผ๋กœ ๋ถ„๋ฅ˜ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ๊ฐ ์…€์— ๋ฌด๊ฑฐ์šด AVPlayer ๊ฐ์ฒด๋ฅผ ํ• ๋‹นํ•˜๋Š” ๊ฒƒ์€ ์‹ฌ๊ฐํ•œ ๋ฆฌ์†Œ์Šค ๋ฌธ์ œ๋ฅผ ์ผ์œผํ‚ฌ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. (link)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๊ณ ์นจ

Comment on lines +10 to +28
final class AudioManager {

static let shared = AudioManager()

private init() {}

private var player: AVPlayer?

func play(url: URL) {
player?.pause() // ์ผ๋‹จ ์žฌ์ƒ๋˜๋˜ ๋…ธ๋ž˜๋Š” ๊บผ์•ผ ์•ˆ๊ฒน์นจ

player = AVPlayer(url: url)
player?.play()
}

func play() {
player?.play()
}
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

AudioManager๊ฐ€ ์‹ฑ๊ธ€ํ†ค์œผ๋กœ ๊ตฌํ˜„๋˜์–ด ์žˆ์–ด ์•ฑ์˜ ๋‹ค๋ฅธ ๋ถ€๋ถ„๊ณผ ๊ฐ•ํ•˜๊ฒŒ ๊ฒฐํ•ฉ๋ฉ๋‹ˆ๋‹ค. ์ด๋Š” ์œ ๋‹› ํ…Œ์ŠคํŠธ๋ฅผ ์–ด๋ ต๊ฒŒ ๋งŒ๋“ค๊ณ , ์˜ค๋””์˜ค ์žฌ์ƒ ๋กœ์ง์„ ๋‹ค๋ฅธ ๊ตฌํ˜„์œผ๋กœ ๊ต์ฒดํ•˜๊ธฐ ์–ด๋ ต๊ฒŒ ๋งŒ๋“ญ๋‹ˆ๋‹ค. ์˜ˆ๋ฅผ ๋“ค์–ด, HomeViewController๋‚˜ SearchViewController๋ฅผ ํ…Œ์ŠคํŠธํ•  ๋•Œ ์‹ค์ œ AVPlayer์— ์˜์กดํ•˜๊ฒŒ ๋˜์–ด ํ…Œ์ŠคํŠธ๊ฐ€ ๋ณต์žกํ•ด์ง€๊ณ  ๋А๋ ค์งˆ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์˜์กด์„ฑ ์ฃผ์ž…(Dependency Injection)์„ ์‚ฌ์šฉํ•˜์—ฌ ์ด ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•˜๋Š” ๊ฒƒ์ด ์ข‹์Šต๋‹ˆ๋‹ค.

  1. AudioManagerType ํ”„๋กœํ† ์ฝœ์„ ์ •์˜ํ•ฉ๋‹ˆ๋‹ค.
  2. AudioManager๊ฐ€ ์ด ํ”„๋กœํ† ์ฝœ์„ ์ค€์ˆ˜ํ•˜๋„๋ก ํ•ฉ๋‹ˆ๋‹ค.
  3. SceneDelegate์—์„œ AudioManager ์ธ์Šคํ„ด์Šค๋ฅผ ์ƒ์„ฑํ•˜๊ณ , ์ด๋ฅผ ํ•„์š”๋กœ ํ•˜๋Š” ๋ทฐ ์ปจํŠธ๋กค๋Ÿฌ์˜ ์ƒ์„ฑ์ž๋ฅผ ํ†ตํ•ด ์ฃผ์ž…ํ•ฉ๋‹ˆ๋‹ค.

์ด๋ ‡๊ฒŒ ํ•˜๋ฉด ํ…Œ์ŠคํŠธ ์‹œ์—๋Š” ์‹ค์ œ AudioManager ๋Œ€์‹  ์˜ค๋””์˜ค ์žฌ์ƒ ๋™์ž‘์„ ํ‰๋‚ด ๋‚ด๋Š” ๊ฐ€์งœ ๊ฐ์ฒด(mock object)๋ฅผ ์ฃผ์ž…ํ•˜์—ฌ, ๋ทฐ ์ปจํŠธ๋กค๋Ÿฌ์˜ ๋กœ์ง์„ ๋…๋ฆฝ์ ์œผ๋กœ ํ…Œ์ŠคํŠธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

References
  1. ์ง์ ‘์ ์ธ ์ „์—ญ/๊ณต์œ  ์˜์กด์„ฑ ์‚ฌ์šฉ์€ ํ…Œ์ŠคํŠธ ์šฉ์ด์„ฑ๊ณผ ์œ ์—ฐ์„ฑ์„ ํฌ๊ฒŒ ์ €ํ•ดํ•  ๋•Œ P1(high)์œผ๋กœ ๋ถ„๋ฅ˜๋˜์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ์‹ฑ๊ธ€ํ†ค ํŒจํ„ด์€ ์ „์—ญ ์ƒํƒœ์— ๋Œ€ํ•œ ์˜์กด์„ฑ์„ ๋งŒ๋“ค์–ด ์œ ๋‹› ํ…Œ์ŠคํŠธ๋ฅผ ์–ด๋ ต๊ฒŒ ํ•ฉ๋‹ˆ๋‹ค. (link)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์ผ๋ถ€๋Ÿฌ ์‹ฑ๊ธ€ํ†ค์œผ๋กœ ํ•œ๊ฑฐ์ž„

Comment on lines +303 to +312
// ์žฌ์ƒ ์ด๋ฏธ์ง€
for cell in self.collectionView.visibleCells {
if let playableCell = cell as? PlayableUICell,
let indexPath = self.collectionView.indexPath(for: cell),
let item = self.dataSource[indexPath] as? ContentItem {

let isPlaying = (item.previewURL == playingURL)
playableCell.updatePlayUI(isPlaying: isPlaying)
}
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

ํ˜„์žฌ playingURL ์ƒํƒœ๊ฐ€ ๋ณ€๊ฒฝ๋  ๋•Œ๋งˆ๋‹ค visibleCells๋ฅผ ์ˆœํšŒํ•˜๋ฉฐ ์ง์ ‘ UI๋ฅผ ์—…๋ฐ์ดํŠธํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. ์ด ๋ฐฉ์‹์€ ์—ฌ๋Ÿฌ ๋ฌธ์ œ๋ฅผ ๊ฐ€์งˆ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค:

  1. ๋ถˆ์™„์ „ํ•œ ์—…๋ฐ์ดํŠธ: ํ˜„์žฌ ๋ณด์ด์ง€ ์•Š๋Š” ์…€(์Šคํฌ๋กคํ•ด์•ผ ๋ณด์ด๋Š” ์…€)์˜ ์ƒํƒœ๋Š” ์—…๋ฐ์ดํŠธ๋˜์ง€ ์•Š์•„, ์Šคํฌ๋กค ์‹œ ์žฌ์ƒ ์ƒํƒœ๊ฐ€ ์˜ฌ๋ฐ”๋ฅด๊ฒŒ ํ‘œ์‹œ๋˜์ง€ ์•Š์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
  2. ๋ฐ˜์‘ํ˜• ํŒจ๋Ÿฌ๋‹ค์ž„ ์œ„๋ฐ˜: ReactorKit๊ณผ ๊ฐ™์€ ๋ฐ˜์‘ํ˜• ํ”„๋ ˆ์ž„์›Œํฌ๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๋ชฉ์ ์€ ์ƒํƒœ(State)๊ฐ€ ๋ณ€๊ฒฝ๋˜๋ฉด UI๊ฐ€ ์ž๋™์œผ๋กœ ์—…๋ฐ์ดํŠธ๋˜๋„๋ก ํ•˜๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค. ํ˜„์žฌ ์ฝ”๋“œ๋Š” ์ƒํƒœ ๋ณ€๊ฒฝ์— ๋”ฐ๋ผ ์ˆ˜๋™์œผ๋กœ UI๋ฅผ ์กฐ์ž‘ํ•˜๊ณ  ์žˆ์–ด ๋ฐ˜์‘ํ˜• ํŒจ๋Ÿฌ๋‹ค์ž„์„ ๊ฑฐ์Šค๋ฆ…๋‹ˆ๋‹ค.

configureCell ํด๋กœ์ €์—์„œ ์ด๋ฏธ isPlaying ์ƒํƒœ๋ฅผ ๊ธฐ๋ฐ˜์œผ๋กœ UI๋ฅผ ์„ค์ •ํ•˜๋Š” ๋กœ์ง(cell.updatePlayUI(...))์ด ์žˆ์œผ๋ฏ€๋กœ, ์ด ๋กœ์ง์„ ์œ ์ผํ•œ ์ง„์‹ค์˜ ์›์ฒœ(Single Source of Truth)์œผ๋กœ ํ™œ์šฉํ•˜๋Š” ๊ฒƒ์ด ์ข‹์Šต๋‹ˆ๋‹ค.

playingURL์ด ๋ณ€๊ฒฝ๋  ๋•Œ collectionView.reloadData()๋ฅผ ํ˜ธ์ถœํ•˜์—ฌ ์ „์ฒด ์…€์˜ UI๋ฅผ ๋‹ค์‹œ ๊ทธ๋ฆฌ๋„๋ก ํ•˜๋Š” ๊ฒƒ์ด ๋” ๊ฐ„๋‹จํ•˜๊ณ  ๋ฐ˜์‘ํ˜• ํŒจ๋Ÿฌ๋‹ค์ž„์— ๋ถ€ํ•ฉํ•˜๋Š” ํ•ด๊ฒฐ์ฑ…์ž…๋‹ˆ๋‹ค. ์ด๋ ‡๊ฒŒ ํ•˜๋ฉด visibleCells๋ฅผ ์ˆœํšŒํ•˜๋Š” ์ฝ”๋“œ๋ฅผ ์ œ๊ฑฐํ•˜๊ณ  ์ฝ”๋“œ์˜ ์ผ๊ด€์„ฑ์„ ๋†’์ผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

                    // ์žฌ์ƒ ์ด๋ฏธ์ง€
                    self.collectionView.reloadData()
References
  1. ์—ฌ๋Ÿฌ ์ œ์–ด๋˜์ง€ ์•Š๋Š” ์†Œ์Šค์—์„œ UI ์ƒํƒœ๋ฅผ ๋ณ€๊ฒฝํ•˜๋ฉด ๋ Œ๋”๋ง์ด ์ผ๊ด€๋˜์ง€ ์•Š์„ ์ˆ˜ ์žˆ์œผ๋ฏ€๋กœ P1(high)์œผ๋กœ ๋ถ„๋ฅ˜ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ํ˜„์žฌ UI ์ƒํƒœ๋Š” configureCell๊ณผ subscribe ๋ธ”๋ก ๋‘ ๊ณณ์—์„œ ๋ณ€๊ฒฝ๋˜๊ณ  ์žˆ์–ด ์ž ์žฌ์ ์ธ ๋น„์ผ๊ด€์„ฑ์„ ์œ ๋ฐœํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. (link)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.reloadData()ํ•˜๋Š”๊ฑด ๋„ˆ๋ฌด ๋น„ํšจ์œจ์ ์ผ๊ฑฐ๊ฐ™์Œ ๋ณ€๊ฒฝ๋ ๋•Œ๋งˆ๋‹ค ์ปฌ๋ ‰์…˜๋ทฐ๋ฅผ ๋‹ค ๊ฐˆ์•„์—Ž์œผ๋ฉด ๋„ˆ๋ฌด ๋‚ญ๋น„๊ณ  ์‚ฌ์šฉ์ž ๋ˆˆ์— ๊นœ๋นก๊ฑฐ๋ฆฌ๋Š”๊ฒŒ ๋ˆˆ์— ๋ณด์ผ๊ฑฐ๊ฐ™์Œ

Comment on lines +317 to +326
// ์žฌ์ƒ ์ด๋ฏธ์ง€
for cell in self.collectionView.visibleCells {
if let playableCell = cell as? PlayableUICell,
let indexPath = self.collectionView.indexPath(for: cell),
let item = self.dataSource[indexPath] as? ContentItem {

let isPlaying = (item.previewURL == playingURL)
playableCell.updatePlayUI(isPlaying: isPlaying)
}
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

HomeViewController์—์„œ์™€ ๋™์ผํ•œ ๋ฌธ์ œ๊ฐ€ ์—ฌ๊ธฐ์„œ๋„ ๋ฐœ๊ฒฌ๋ฉ๋‹ˆ๋‹ค. playingURL ์ƒํƒœ๊ฐ€ ๋ณ€๊ฒฝ๋  ๋•Œ visibleCells๋ฅผ ์ง์ ‘ ์ˆœํšŒํ•˜์—ฌ UI๋ฅผ ์—…๋ฐ์ดํŠธํ•˜๋Š” ๋ฐฉ์‹์€ ๋น„ํšจ์œจ์ ์ด๋ฉฐ ๋ฐ˜์‘ํ˜• ํ”„๋กœ๊ทธ๋ž˜๋ฐ ํŒจ๋Ÿฌ๋‹ค์ž„์— ๋งž์ง€ ์•Š์Šต๋‹ˆ๋‹ค.

configureCell์— ์ด๋ฏธ ์žฌ์ƒ ์ƒํƒœ์— ๋”ฐ๋ฅธ UI ์„ค์ • ๋กœ์ง์ด ์žˆ์œผ๋ฏ€๋กœ, playingURL์ด ๋ณ€๊ฒฝ๋  ๋•Œ collectionView.reloadData()๋ฅผ ํ˜ธ์ถœํ•˜์—ฌ ๋ฐ์ดํ„ฐ ์†Œ์Šค๋ฅผ ํ†ตํ•ด UI๋ฅผ ์ผ๊ด€์„ฑ ์žˆ๊ฒŒ ์—…๋ฐ์ดํŠธํ•˜๋Š” ๊ฒƒ์ด ์ข‹์Šต๋‹ˆ๋‹ค.

                    // ์žฌ์ƒ ์ด๋ฏธ์ง€
                    self.collectionView.reloadData()
References
  1. ์—ฌ๋Ÿฌ ์ œ์–ด๋˜์ง€ ์•Š๋Š” ์†Œ์Šค์—์„œ UI ์ƒํƒœ๋ฅผ ๋ณ€๊ฒฝํ•˜๋ฉด ๋ Œ๋”๋ง์ด ์ผ๊ด€๋˜์ง€ ์•Š์„ ์ˆ˜ ์žˆ์œผ๋ฏ€๋กœ P1(high)์œผ๋กœ ๋ถ„๋ฅ˜ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ํ˜„์žฌ UI ์ƒํƒœ๋Š” configureCell๊ณผ subscribe ๋ธ”๋ก ๋‘ ๊ณณ์—์„œ ๋ณ€๊ฒฝ๋˜๊ณ  ์žˆ์–ด ์ž ์žฌ์ ์ธ ๋น„์ผ๊ด€์„ฑ์„ ์œ ๋ฐœํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. (link)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์šฐ์šฐ์šฐ

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant