Another repro:
struct Repeater<each Input> {
private var __storage = LazyState(initialValue: {
Storage()
})
private var input: (repeat each Input)
init(_ input: repeat each Input) {
self.input = (repeat each input)
}
}
Using classic State does not crash:
struct Repeater<each Input> {
private var __storage = State(initialValue: Storage())
private var input: (repeat each Input)
init(_ input: repeat each Input) {
self.input = (repeat each input)
}
}
And for some reason I can build from LazyState if I do not save my parameter pack to a stored instance variable:
struct Repeater<each Input> {
private var __storage = LazyState(initialValue: {
Storage()
})
init(_ input: repeat each Input) { }
}
It also turns out I can also use LazyState if I declare the stored parameter pack variable before I declare the LazyState variable:
struct Repeater<each Input> {
private var input: (repeat each Input)
private var __storage = LazyState(initialValue: {
Storage()
})
init(_ input: repeat each Input) {
self.input = (repeat each input)
}
}
That one does not crash.
Topic:
UI Frameworks
SubTopic:
SwiftUI