๊ธ€ ์ž‘์„ฑ์ž: ์ด์ง€์›๐ŸŒฉ๏ธ
@objc func scrollToTop(_ sender: UIButton) {
    collectionView.scrollToItem(at: IndexPath(row: 0, section: 0), at: .top, animated: true)
}

๋„ค๋น„๊ฒŒ์ด์…˜ ํƒ€์ดํ‹€์„ ํ„ฐ์น˜ํ•˜๋ฉด ์ปฌ๋ ‰์…˜๋ทฐ ์ตœ์ƒ๋‹จ์œผ๋กœ ์ด๋™ํ•˜๊ณ  ์‹ถ์—ˆ๋‹ค. ์ด ๋ฐ–์—๋„ scrollToItem(at:at:animated:)์— ์ฒซ๋ฒˆ์งธ ์ธ์ž๋กœ ๋“ค์–ด๊ฐ€๋Š” IndexPath(row:section:)์„ ์กฐ์ ˆํ•˜๋ฉด ์›ํ•˜๋Š” ์œ„์น˜๋กœ ์ด๋™ํ•  ์ˆ˜ ์žˆ๋‹ค. (์˜ˆ: ํŠน์ • ์„น์…˜์œผ๋กœ ์ด๋™, ํŠน์ • ์œ„์น˜๋กœ ์ด๋™)

๋ฐ˜์‘ํ˜•