swift – SwiftData IOS 17 Array in random order?


Why is the order of my array random when i take advantage of the @Mannequin macro.

class TestModel {
var title: String?
var array: [TestModel2]

    init(title: String = "") {
        self.title = title
        array = []
    }

}

class TestModel2 {
var title: String?

    init(title: String = "") {
        self.title = title
    }

}

This works superb, and all of the gadgets in array are within the order I add them.

But when I declare each of them as @Mannequin, like this:


@Mannequin
class TestModel {
var title: String?
var array: [TestModel2]

    init(title: String = "") {
        self.title = title
        array = []
    }

}

@Mannequin
class TestModel2 {
var title: String?

    init(title: String = "") {
        self.title = title
    }

}

The array gadgets are all the time in a random order. Once I reload the view the place they’re displayed or after I add gadgets to the array the order is randomised.

Is that this a beta bug? Or is that this supposed?

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles