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

Question: Create MutableObservableArray2D with custom models #658

Open
prgorasiya opened this issue Sep 19, 2019 · 0 comments
Open

Question: Create MutableObservableArray2D with custom models #658

prgorasiya opened this issue Sep 19, 2019 · 0 comments

Comments

@prgorasiya
Copy link

I am trying to create a MutableObservableArray2D so that I can bind it with a table view which has different sections.
I can't seem to get it right.
Here is my code:

//Properties
let upcomingTrips = MutableObservableArray2D<String, TripListModel>(Array2D())
-----

let trips = [TripListModel](JSONArray: data["result"] as! [[String : Any]])
self.upcomingTrips.value = Array2D<String, TripListModel>(sectionsWithItems: [(Dictionary(grouping: trips, by: { $0.time }))] )

First I am mapping API response to an array on objects and then grouping them according to date (string) but I cant assign it to instance of MutableObservableArray2D.

What am I doing wrong here?

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

1 participant