Is it possible to have conditional table columns for a swifui Table statement?
Like for this code
TableColumn("Image") { artPiece in
if let imageData = artPiece.artImage.first, let image = UIImage(data: imageData!) {
Image(uiImage: image)
.resizable()
.frame(width: 50, height: 50)
} else {
Image(systemName: "photo")
.resizable()
.frame(width: 50, height: 50)
}
}
.customizationID("Image")
TableColumn("Name", value: \.artName)
.customizationID("Name")
TableColumn ("Art ID", value: \.artPieceID) { artPiece in
Text(String(artPiece.artPieceID))
}
.customizationID("Art ID")
have a conditional TableColumn for this part of my SWIFTDATA model var artDefinedFields: [ArtDefinedFields] = [] or if I change the variable string array to this var artDefinedFields: [ArtDefinedFields] = Array(repeating: ArtDefinedFields(), count: 10), initialize the array with "None" and only create a TableColumn when there is aArtDeginedFields value other than "None"