realm

React Native + AWS AppSync - maximum data storage

左心房为你撑大大i 提交于 2019-12-06 05:19:12
I’m building an offline application which needs to store around 30,000 records. Will AWS AppSync have any performance issues with a data set of this size? I’ve used redux w/ redux-persist in the past, which saves the store offline, then refetchs and places in memory when the app launches. This causes fairly huge memory issues, especially when querying the data. I’m wondering if AppSync has the ability to use Realm or SQLite for offline storage and querying. Thanks. 来源: https://stackoverflow.com/questions/52862441/react-native-aws-appsync-maximum-data-storage

Install Realm in a Swift App

浪子不回头ぞ 提交于 2019-12-06 05:07:48
问题 I am trying to add Realm to my app written in swift. I have followed the tutorial and I can't seem to get it to work. The biggest problem is that when I try to import Realm I get No such module 'Realm' I don't know what else to try. You can see my efforts below. You can see the instructions here: http://realm.io/docs/cocoa/0.85.0/#swft I have also copied the instructions below: Due to the current lack of proper infrastructure for Swift dependency management, using Realm in your project

What is the best way to connect Realm and SwiftBond

我怕爱的太早我们不能终老 提交于 2019-12-06 04:34:41
问题 I love Realm and I love Bond. Both of them makes app creation a joy. So I was wondering what is the best way to connect Realm and Bond? In Realm we can store basic types such as Int , String , e.g. But in Bond we work with Dynamic s and Bond s. The only way that I found to connect Realm and Bond is following: class TestObject: RLMObject { dynamic var rlmTitle: String = "" dynamic var rlmSubtitle: String = "" var title: Dynamic<String> var subtitle: Dynamic<String> private let titleBond: Bond

Compound key in Realm with lazy property

社会主义新天地 提交于 2019-12-06 04:07:08
I found this great solution for using Realm with compound primary key in Swift: https://github.com/realm/realm-cocoa/issues/1192 public final class Card: Object { public dynamic var id = 0 { didSet { compoundKey = compoundKeyValue() } } public dynamic var type = "" { didSet { compoundKey = compoundKeyValue() } } public dynamic lazy var compoundKey: String = self.compoundKeyValue() public override static func primaryKey() -> String? { return "compoundKey" } private func compoundKeyValue() -> String { return "\(id)-\(type)" } } But I discovered that Realm does not support lazy properties, in my

Save image in Realm

◇◆丶佛笑我妖孽 提交于 2019-12-06 03:18:08
问题 I'm trying to pick image from device's Photo Library in method: func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) { userPhoto.image = info[UIImagePickerControllerOriginalImage] as! UIImage? userPhoto.contentMode = .scaleAspectFill userPhoto.clipsToBounds = true dismiss(animated: true, completion: nil) } and save this picture in Realm (as NSData): asset.assetImage = UIImagePNGRepresentation(userPhoto.image!)! as NSData? ... try!

How to update React Native ListView when Realm data changes

白昼怎懂夜的黑 提交于 2019-12-06 03:10:37
问题 I have a list of 'Activity' objects stored in a Realm DB which are showing on a ListView. There is no problem initially loading the data and showing it on the screen. However, when the data update (in another screen, lets call it 'detail edit screen') and the user returns to the list screen, the list isn't updated. I tried to setState inside the render method, but that returns a blank screen. var activities = realm.objects('Activity').sorted('date'); let ds = new ListView.DataSource(

How to write to a Realm object server on Ubuntu

与世无争的帅哥 提交于 2019-12-06 02:58:06
I have worked through the Realm mobile platform tutorial ( link ). You create a Swift task app. I was able to get the app and server working correctly on my local mac. I was able to add tasks to the tableview. I then created an Ubuntu 16.04 droplet on DigitalOcean. I managed to get the server running and am able to view the Realm dashboard. The problem is that when I run the app with the new server ip address (the ubuntu instance), I see the 'Add task' pop up but no tasks get added to the tableview on the app. The following code adds tasks to the db: try! items.realm?.write { items.insert(Task

Realm.io [Java] notifications - How to listen for changes only in certain Table?

有些话、适合烂在心里 提交于 2019-12-06 02:05:02
问题 I see this example code in realm java documentation. public class MyActivity extends Activity { private Realm realm; // A reference to RealmChangeListener needs to be held to avoid being // removed by the garbage collector. private RealmChangeListener realmListener; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); realm = Realm.getDefaultInstance(); reamlListener = new RealmChangeListener() { @Override public void onChange() { // ... do

How to make a RealmList parcelable

偶尔善良 提交于 2019-12-06 01:58:08
问题 i need to implement the Parcelable interface in a Realm model but i have no idea how to write a RealmList in a Parcel here is my code: public class SomeModel extends RealmObject implements Parcelable { public long id; public RealmList<SomeOtherModel> otherModels; protected SomeModel(Parcel in) { id = in.readLong(); //here i need to otherModel RealmList from parcel } @Override public void writeToParcel(Parcel dest, int flags) { dest.writeLong(id); // here i need to write the otherModels

Querying in Realm (using Swift)

ぃ、小莉子 提交于 2019-12-06 01:44:55
问题 I'm toying with realm.io. I've written a couple of objects, and now I want to query for them. My data class: class Sample : RLMObject { dynamic var sampleKey : String = "" } and my query code @IBAction func readLocalRecord(sender: UIButton) { let s : NSString = NSString.stringWithString("sampleKey == SampleValue") let p : NSPredicate = NSPredicate(format: "sampleKey = %@", argumentArray: NSArray(object: NSString.stringWithString("SampleValue"))) // the following throws exception, that I