skiptools / skip-ui

SwiftUI for Android
https://skip.tools
GNU Lesser General Public License v3.0
128 stars 14 forks source link

Using UUIDs with List>ForEach causes crashes #9

Closed pnewell closed 1 year ago

pnewell commented 1 year ago

I am reporting a bug with UUIDs and List>ForEach. When using List>ForEach with UUID as the ForEach "id" it causes the app to crash. I tested ForEach without List and that seems to load fine in Android. I took a quick look at the Android debugger and it mentions not being able to store UUID in the bundle (I think because it isn't Parcelable).

Example:

struct Item {
  let id: UUID
  var title: String
}

struct ListView: View {
    var items: [Item] = [Item(id: UUID(), title: "My Item")]

    var body: some View {
        List {
            ForEach(items, id: \.id) { item in
                Text(item.title)
            }
        }
    }
}
aabewhite commented 1 year ago

Thanks - on it!

aabewhite commented 1 year ago

Fixed in skip-ui 0.3.16