I just saw in WWDC video you have to do:
TableColumn("Rank") { model in
Text("\(model.rank)")
}
Help documentation is deceiving.
Post
Replies
Boosts
Views
Activity
Thank goodness. Was just about to report this.. I see this too..
I never did get this to work. Ended up implementing my own button code.
Any clues? Any one?
Any solutions? Apple? I am getting the feeling the SwiftUI for mac is not ready at all...
import SwiftUI
struct Search: Identifiable {
let id: UUID
let text: String
}
struct SearchBox: View {
@State var searchParam: String = ""
@State var stuff = [Search]()
@State var showList = false
init() {
// To remove only extra separators below the list:
UITableView.appearance().tableFooterView = UIView()
// To remove all separators including the actual ones:
UITableView.appearance().separatorStyle = .none
}
var body: some View {
var binding = Binding<String>(
get: {
self.searchParam
},
set: {
self.stuff.append(
Search(id: UUID(), text: $0)
)
self.searchParam = $0
withAnimation {
self.showList = self.stuff.count > 0
}
})
return VStack(spacing: 0.0) {
TextField("Search", text: binding )
.font(.title)
.padding()
.background(Color.white)
if stuff.count > 0 {
List {
Text("foo")
}
.transition(.slide)
}
}
}
struct SearchBox_Preview: PreviewProvider {
static var previews: some View{
SearchBox()
}
}
}I had to change my state in a withAnimation block. That allowed the animation to happen.