I’m trying to get a list of all the users to a macOS app using Swift 3. But for some reason it’s not working. I use the same code for one of my own classes.
users is an Array of BackendlessUser
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000}
p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000; min-height: 13.0px}
p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #4f8187}
p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #d12f1b}
p.p5 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #008400}
span.s1 {font-variant-ligatures: no-common-ligatures}
span.s2 {font-variant-ligatures: no-common-ligatures; color: #ba2da2}
span.s3 {font-variant-ligatures: no-common-ligatures; color: #4f8187}
span.s4 {font-variant-ligatures: no-common-ligatures; color: #703daa}
span.s5 {font-variant-ligatures: no-common-ligatures; color: #272ad8}
span.s6 {font-variant-ligatures: no-common-ligatures; color: #3e1e81}
span.s7 {font-variant-ligatures: no-common-ligatures; color: #000000}
span.s8 {font-variant-ligatures: no-common-ligatures; color: #31595d}
span.s9 {font-variant-ligatures: no-common-ligatures; color: #d12f1b}
func getUsers() {
if users.count > 0 {
users.removeAll()
}
let dataStore = backendless!.data.of(BackendlessUser.ofClass())
dataStore?.find(
{ (result: BackendlessCollection?) -> Void in
let data = result?.getCurrentPage()
for obj in data! {
let item = obj as! BackendlessUser
self.users.append(item)
}
debugPrint("Users are loaded: \(self.users.count) items")
// self.tableView.reloadData()
},
error: {(fault: Fault?) -> Void in
debugPrint("Server reported an error: \(String(describing: fault))")
})
}