Reputation: 17
I updated to latest realmswift, I have lots of code to update and one of this is the problem.
Before I just called RLMObject
in the statement:
for obj = obj as? RLMObject
now it crashes. Is there any other options?
for obj in Realm().objects(ImageBackgrounds)
{
if let obj = obj as? [what?] // <- what to write here?
{
let image = UIImage(data: obj.[unknown??])
if (obj.[realmImageName???unknown] == "image\(slideshowSequence)")
{
// Do Something
}
}
}
Upvotes: 0
Views: 86
Reputation: 4163
Realm returns objects of the given type now, so you don't have to check for object type anymore. So you just write:
for obj in Realm().objects(ImageBackgrounds)
{
let image = UIImage(data: obj.[unknown??])
if (obj.[realmImageName???unknown] == "image\(slideshowSequence)")
{
// Do Something
}
}
and your obj
type is already ImageBackgrounds
.
Upvotes: 2