tracking down/working around UnsafeRawBufferPointer with negative count (presumably somewhere out of SwiftUI intestines/Swift runtime)
Asked Answered
S

2

-1

enter image description here

What do I do about this? I get no useful info predictably. A search for UnsafeMutablePointer yields

 func scrollViewWillEndDragging(_ scrollView: UIScrollView, withVelocity velocity: CGPoint, targetContentOffset: UnsafeMutablePointer<CGPoint>) {

delegate messages and

private static func bound(_ property: RLMProperty, _ obj: RLMObjectBase) -> UnsafeMutablePointer<LinkingObjects<Element>> {
    return ptr(property, obj).assumingMemoryBound(to: LinkingObjects<Element>.self)
}

in realm. That's it.

Do I hit some Swift runtime shitware paths? Any advice on how to deal with this would be appreciated as I have spent over a day on this manhunt.

UPD manually unrolling ForEach "fixes" the issue

// let baz = Array(zip(data.indices, data))
//            ForEach(baz, id: \.1.id) { index, foo in
            let index = 0
            if let foo = data.first {

reproduces in both Xcode 13.2.1 and 13.3.1

Stoichiometric answered 28/4, 2022 at 10:25 Comment(0)
S
1

In my case, I am using Core Data, and in the definition of the PersistenceController, I was initializing the container with the old name. Once I replaced the name with the new name of the Core Data model file, the error went away:

container = NSPersistentContainer(name: "DataTest")

Changed to this:

container = NSPersistentContainer(name: "Core")
Synesthesia answered 28/2, 2023 at 19:53 Comment(0)
S
0

AFDataResponse was fed with Realm class instead of the Codable struct modelling that incoming instance deserialized from the networking layer and that somehow resulted in this symptom. Gotta love the transparency and resilience of the swift runtime inherited from c++ (that was sarcasm in case you failed to notice)

Stoichiometric answered 28/4, 2022 at 16:21 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.