KeyPath1 KeyPath 오늘은 KeyPath라는 것을 알아보겠습니다. KeyPath는 사실 개발하면서 현재 많이 쓰지 않는 기능이긴 하지만 SwiftUI에서 간혹 보곤 합니다. LazyVGrid(columns: columns) { ForEach(images, id: \.self) { image in Image(uiImage: image) .resizable() .scaledToFit() .frame(height: 150) } } \.self 이게 바로 KeyPath입니다. 사용해 보신 적이 있으실 겁니다. 간단한 구조체 하나를 만들면서 설명 시작하겠습니다. struct Streamer { var name: String var subscriber: Int } let streamer = Streamer(name: "nogu", s.. 2023. 1. 16. 이전 1 다음