I’m new to Realm and I’m having some trouble displaying the result as plain text. When I query from Realm(and filtering if necessary), I get the result with all key-value pairs.
The function I use to read the results:
func getData() {
let config = Realm.Configuration(schemaVersion: 1)
let realm = try! Realm(configuration: config)
let result = realm.objects(AllCard.self)
print(result)
}
}
The result I get in the console:
Optional(Results<AllCard> <0x7fd79dc0fed0> (
[0] AllCard {
name = Chase Sapphire Reserve;
bank = Chase
},
[1] AllCard {
name = Citibank DoubleCash;
bank = Citibank
}
))
So, for example, I want to display the corresponding “name” value as a Text(or as a list) in SwiftUI, how do I do it? I’ve tried appending the results to an empty list and displaying it as a list from there, but I couldn’t get it working… This problem seems to be easy to solve, but at this point I’m brain-dead. -Thanks!