UA-17470720-3

Jump to content


Photo
- - - - -

Realm support


  • Please log in to reply
No replies to this topic

#1 skrew

skrew

    Jr. Member

  • STV 5.0 Pro
  • PipPip
  • 21 posts
Reputation: 3
Good

Posted 03 September 2015 - 08:53 AM

Hi,

 

It's would be nice to add support for Realm Database  (https://realm.io).

 

I think it would be simple to add support for it (NSObject compliant).

 

I can use it directly as a NSObject / NSDictionary mode but don't works when value change (as it need to be in write transaction mode).

 

 

Thanks.

 

 

Edit: My workaround (is there are way to do this in a better way ?) Maybe miss a didCommitBoundValue

 

self.remoteName = [SCTextFieldCell cellWithText: @"text"
                                        placeholder: self.remRemote.remoteName
                                        boundObject: self.remRemote textFieldTextPropertyName: @"remoteName"];
    
    self.remoteName.textField.textAlignment = NSTextAlignmentRight;
    self.remoteName.textField.returnKeyType = UIReturnKeyDone;
    self.remoteName.textField.enablesReturnKeyAutomatically = YES;
    
    self.remoteName.cellActions.willCommitBoundValue = ^NSObject*(SCTableViewCell *cell, NSIndexPath *indexPath, NSObject *value)
    {
        [[RLMRealm defaultRealm] beginWriteTransaction];
        return value;
    };
    
    self.remoteName.cellActions.valueChanged = ^(SCTableViewCell *cell, NSIndexPath *indexPath)
    {
        [[RLMRealm defaultRealm] commitWriteTransaction];
    };

Edited by skrew, 03 September 2015 - 09:15 AM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users