Questions tagged [realm-cocoa]
20 questions
10
votes
2 answers
how to convert RealmSwift List to Results?
I am using a Realm List/Results as my dataSource for a UITableView. At some point I assign a list to it. like:
var dataSource:List! // Or >> Results!
let aRealmObject = realm.objectForPrimaryKey(SomeObject.self, key:…

Ismail
- 2,778
- 2
- 24
- 39
5
votes
2 answers
Can I edit Realm object without transaction in Swift?
In my project I need to send Realm Object in Request body. Before this operation, I need to replace some of values in object variables with another.
But I don't need to save new values, before I get success response from server.
In case when I…

TramPamPam
- 51
- 3
3
votes
3 answers
removeObjects from RLMResults
How can I remove objects from RLMResults. I mean in NSMutableArray there is a function like
[self.dogs removeAllObjects]
is there any funcation like that for RLMResults or RLMArray?

Aye
- 265
- 1
- 3
- 13
3
votes
2 answers
Realm + Mantle: how to avoid multiple inheritance duplication when integrating both frameworks?
I have a simple scenario where I want to parse a User model from Json with Mantle and persist it to a realm database:
In order to use the Mantle library, the model interface must extend the MTLModel class like this:
@interface User:…

Mina Wissa
- 10,923
- 13
- 90
- 158
3
votes
1 answer
Realm database locking?
On sync I overwrite all my local data with the server's data. For this I first call realm.delete(realm.objects(MyObj)) for all my objects. Then I save the response's objects with realm.add(obj, update: false). Everything is in a single transaction.…

User
- 31,811
- 40
- 131
- 232
3
votes
1 answer
How to customize getter & setter in Realm Swift?
I'm new to Realm, I used to use MagicalRecord before.
In MagicalRecord, I can handle import function or even set some mappingKeys for multiple candidate names.
I would like to customize some of the properties of my Realm object.
I found…

PatrickSCLin
- 1,419
- 3
- 17
- 45
2
votes
1 answer
deleting an object after editing a property in realm raises RLMException reason: 'Index 0 is out of bounds (must be less than 0)'
I'm making a simple application where user can add habits and complete theme using swift and realm for database
Everything is working fine except when I edit the state and delete the object
The application crashes with RLMException reason: 'Index 0…

Omar Albeik
- 1,332
- 13
- 17
2
votes
1 answer
Realm - Realm Accessed from incorrect thread Swift
I am new to Realm and getting a 'Realm accessed from incorrect thread' error. I have read that one must access data on the same realm it was retrieved from. However I am getting this error after successfully being able to access the object. Here is…

pls
- 1,522
- 2
- 21
- 41
2
votes
1 answer
Realm 1.0.1 iOS obj-c compilation error
I updated my Realm for iOS Obj-C from 0.98 to 1.0.1
but now we're getting these error during compilation:
undef: __ZN5realm4util23PlatformSpecificCondVarC1Ev undef:
__ZN5realm4util23PlatformSpecificCondVarD1Ev undef:…

ordinaryman09
- 2,761
- 4
- 26
- 32
2
votes
1 answer
Swift diff realm.io without fetching it in advance
I was wondering if there is a possibility in realm.io (swift) to select all items from one "table" that are not in the other one.
Lets say you have 2 classes:
class A: Object {
dynamic var id: Int = 0
dynamic var text: String = ""
}
class…

Danilo
- 45
- 8
2
votes
2 answers
How to check for RLMResults invalidated?
When my user logs out, I clear my realm with realm.deleteAll(). After this, I get a lot of notifications resulting in reads from Results objects, which results in an exception realm::Results::InvalidatedException, "RLMResults has been invalidated".…

Joel Kraut
- 56
- 5
2
votes
1 answer
Creating a LinkingObjects property in RealmSwift by using multiple-level properties
According to the Realm documentation for v0.102.0, this is how you create an inverse relationship:
Person
class Person: Object {
// ... other property declarations
let dogs = List()
}
Dog (v1)
class Dog: Object {
// ... other…

catalandres
- 1,149
- 8
- 20
1
vote
0 answers
Realm Swift updating objects not working
I'm using realm swift v1.0.0 and I create an object and I want to update its value permanently.
Following the official guide and some other answers on stackoverflow I've done:
let myobject = MyObjectClass()
myobject.property1 = "test"
try!…

Andrea.Ferrando
- 987
- 13
- 23
1
vote
2 answers
How can I reset Realm's state between tests?
We've been using RLMClearRealmCache to clear Realm's state between tests that are testing migrations. If the cache is not cleared, the next test will not perform migrations, since the cache still reports the schema being up to date, even though…

solidcell
- 7,639
- 4
- 40
- 59
0
votes
1 answer
linkingObjectsProperties override from swift 2.0
I am using realm-cocoa(v1.0.1) with a Swift 2.0 project (need objective-c interoperability) and am having trouble overriding the linkingObjectsProperties method.
I've followed the Realm documentation…

Josh Stern
- 5
- 2