Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The attribute cycle detected error in PDFView of PDFKit using UIViewRepresentable in SwiftUI means that there is a cyclic dependency between the properties of the PDFView and the SwiftUI View that represents it. This happens when a property of the SwiftUI View is dependent on the changed state of the PDFView property and vice versa, resulting in an infinite loop.

To fix this error, you need to ensure that the properties of the PDFView and SwiftUI View do not have a circular dependency. You can use computed properties or callbacks to update the state of the SwiftUI View or the PDFView. Also, make sure to avoid using the same property names for both the SwiftUI View and the PDFView to prevent any confusion or overlap between the two.