Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use this with Swift Realm ? Can't init DataSet #32

Closed
wojczitsu opened this issue Jul 29, 2019 · 1 comment
Closed

How to use this with Swift Realm ? Can't init DataSet #32

wojczitsu opened this issue Jul 29, 2019 · 1 comment

Comments

@wojczitsu
Copy link

I've got:

class Statistics: Object {
...
}

func dataForChart() -> Results<Statistics>? {
        var result: Results<Statistics>?
        do {
            let realm = try Realm()
            result = realm.objects(Statistics.self)
        } catch let error as NSError {
            print("Realm error - get all: \(error.localizedDescription)")
        }
        return result
}

let set = RealmLineDataSet(results: database.dataForChart(), xValueField: "date", yValueField: yField) // this won't compile 

Last line gives error: Cannot invoke initializer for type 'RealmLineDataSet' with an argument list of type '(results: Results?, xValueField: String, yValueField: String?)'

@liuxuan30
Copy link
Collaborator

liuxuan30 commented Aug 1, 2019

seems you are using different version of Realm. Please check README for the version we supported.
to be honest I think this library is not ready to use for generic cases. refer #17

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants