K.K. Slider ์์ ์ฌ์๊ธฐ. ์์ฒด Coordinator๊ฐ ์๊ณ AppCoordinator๊ฐ ์ง์ ๊ด๋ฆฌ.
Presentation/MusicPlayer/
โโโ PlayerMode.swift # minimize/maximize ๋ชจ๋ enum
โโโ ViewControllers/
โ โโโ PlayerViewController.swift # ํ๋ ์ด์ด UI
โโโ ViewModels/
โ โโโ PlayerReactor.swift # ์ฌ์ ์ํ ๊ด๋ฆฌ
โโโ Views/
โโโ MaximizePlayerView.swift # ํ์ฅ ๋ทฐ
โโโ MinimizePlayerView.swift # ์ถ์ ๋ทฐ
โโโ SongRow.swift # ๋
ธ๋ ํ
โโโ SongRow.xib # XIB ๋ ์ด์์
AppCoordinator.swift๊ฐ PlayerViewController์ ์๋ช
์ฃผ๊ธฐ๋ฅผ ์ง์ ์ ์ด:
// ํ์: ํญ๋ฐ ์ ์ค๋ฒ๋ ์ด๋ก ์ถ๊ฐ
func showMusicPlayer()
// ์ถ์: ํ๋จ์ 80pt ๋ฏธ๋ ํ๋ ์ด์ด
func minimize()
// ํ์ฅ: 450pt ํฐ ํ๋ ์ด์ด
func maximize()
// ์ ๊ฑฐ
func removePlayerViewController()PlayerViewController๋ ํญ๋ฐ ์์ addSubview๋ก ๋ฐฐ์น.
topAnchor constraint ์กฐ์ + spring animation์ผ๋ก minimize/maximize ์ ํ.
File: Utility/MusicPlayerManager.swift (์ฑ๊ธํค)
AVPlayer๋ก ์ค๋์ค ์ฌ์BehaviorRelay๋ก ์ํ ๊ด๋ฆฌ (isPlaying, currentSong, progress ๋ฑ)- ๋ฐฑ๊ทธ๋ผ์ด๋ ์ฌ์ ์ง์
MPRemoteCommandCenter์ฐ๋ (์ ๊ธํ๋ฉด ์ปจํธ๋กค)- ์ฌ์ ๋ชจ๋: shuffle, fullRepeat, oneSongRepeat
Items.shared.categoryList[.songs] โ MusicPlayerManager.shared.songList
โ
PlayerReactor.mutate(.fetch) โ Mutation.setSongs
โ
PlayerViewController UI ์
๋ฐ์ดํธ
- ๋ณ๋ Coordinator๋ฅผ ๋ง๋ค์ง ๋ง ๊ฒ โ gotchas.md #10
PlayerReactor์ coordinator ํ์ ์AppCoordinator