=== AttributeGraph: cycle detected through attribute 697368 ===
ForEach<Range<Int>, Int, ModifiedContent<MessageRow, _PaddingLayout>> count (8) != its initial count (7). `ForEach(_:content:)` should only be used for *constant* data. Instead conform data to `Identifiable` or use `ForEach(_:id:content:)` and provide an explicit `id`!
안녕하세요 ◠‿◠ 고고입니다.
갑자기 저 위의 문구가 한 20개쯤은 떠서 당황했는데 읽어보면 ForEach를 할 때 idenfiable을 상속하는 데이터를 쓰거나 id를 넣어달란 뜻이었습니다.
따라서 다음과 같이 고쳤습니다.
// Before
ForEach(0..<channel.allMsgs.count) { index in
Text("")
}
// After
ForEach(0..<channel.allMsgs.count, id: \.self) { index in
Text("")
}
'SwiftUI' 카테고리의 다른 글
[SwiftUI] GeometryReader의 iOS 버전별 차이 (0) | 2022.08.18 |
---|---|
SwiftUI - Lazy Navigation (0) | 2022.03.16 |
[SwiftUI] Previews in Xcode 번역 (0) | 2021.11.06 |
[SwiftUI] navigationBarTitle LayoutConstraints error (0) | 2021.11.06 |
[SwiftUI] iOS 13부터 지원하기 (0) | 2021.11.04 |
댓글