{"action":"created","issue":{"url":"https://api.github.com/repos/RACCommunity/ReactiveCollections/issues/1","repository_url":"https://api.github.com/repos/RACCommunity/ReactiveCollections","labels_url":"https://api.github.com/repos/RACCommunity/ReactiveCollections/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/RACCommunity/ReactiveCollections/issues/1/comments","events_url":"https://api.github.com/repos/RACCommunity/ReactiveCollections/issues/1/events","html_url":"https://github.com/RACCommunity/ReactiveCollections/pull/1","id":194467951,"number":1,"title":"👷 Placing the first stone","user":{"login":"dmcrodrigues","id":1098602,"avatar_url":"https://avatars.githubusercontent.com/u/1098602?v=3","gravatar_id":"","url":"https://api.github.com/users/dmcrodrigues","html_url":"https://github.com/dmcrodrigues","followers_url":"https://api.github.com/users/dmcrodrigues/followers","following_url":"https://api.github.com/users/dmcrodrigues/following{/other_user}","gists_url":"https://api.github.com/users/dmcrodrigues/gists{/gist_id}","starred_url":"https://api.github.com/users/dmcrodrigues/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmcrodrigues/subscriptions","organizations_url":"https://api.github.com/users/dmcrodrigues/orgs","repos_url":"https://api.github.com/users/dmcrodrigues/repos","events_url":"https://api.github.com/users/dmcrodrigues/events{/privacy}","received_events_url":"https://api.github.com/users/dmcrodrigues/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":18,"created_at":"2016-12-08T23:01:46Z","updated_at":"2016-12-12T16:49:47Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/RACCommunity/ReactiveCollections/pulls/1","html_url":"https://github.com/RACCommunity/ReactiveCollections/pull/1","diff_url":"https://github.com/RACCommunity/ReactiveCollections/pull/1.diff","patch_url":"https://github.com/RACCommunity/ReactiveCollections/pull/1.patch"},"body":"This introduces a `ReactiveArray` which can be observed to track each change made, insertions and removals. This kind of collection can be quite useful to update `UITableView`'s and `UICollectionView`'s in-place without forcing a heavy `reloadData` and which can, in the end, improve the user experience with specific animations to highlight only those changes.\r\n\r\nThe idea is mimicking Swift's `Array` API so it can be used without having any special criteria in consideration and simply enable observation of each change in the array. To achieve that it currently implements:\r\n- `MutableCollection`\r\n- `RandomAccessCollection`\r\n- `RangeReplaceableCollection`\r\n- `ExpressibleByArrayLiteral`\r\n\r\nTo enable observation, `ReactiveArray` provides a signal which sends information about every change performed in the array.\r\n\r\n```swift\r\nenum Change<T> {\r\n    case insert(element: T, at: Int)\r\n    case remove(element: T, at: Int)\r\n}\r\n\r\nlet signal: Signal<[Change<T>], NoError>\r\n```\r\n\r\nUpdates in the array, e.g. replacing an element by another, are represented by a removal of that element followed by an insertion of the new element. This can be improved by merging operations around the same index into a new change, `.update`, but I think we can discuss and possibly introduce it in a later moment as a refinement.\r\n\r\nThis was originally suggested and discussed in https://github.com/RACCommunity/contributors/issues/3."},"comment":{"url":"https://api.github.com/repos/RACCommunity/ReactiveCollections/issues/comments/266483498","html_url":"https://github.com/RACCommunity/ReactiveCollections/pull/1#issuecomment-266483498","issue_url":"https://api.github.com/repos/RACCommunity/ReactiveCollections/issues/1","id":266483498,"user":{"login":"andersio","id":11806295,"avatar_url":"https://avatars.githubusercontent.com/u/11806295?v=3","gravatar_id":"","url":"https://api.github.com/users/andersio","html_url":"https://github.com/andersio","followers_url":"https://api.github.com/users/andersio/followers","following_url":"https://api.github.com/users/andersio/following{/other_user}","gists_url":"https://api.github.com/users/andersio/gists{/gist_id}","starred_url":"https://api.github.com/users/andersio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andersio/subscriptions","organizations_url":"https://api.github.com/users/andersio/orgs","repos_url":"https://api.github.com/users/andersio/repos","events_url":"https://api.github.com/users/andersio/events{/privacy}","received_events_url":"https://api.github.com/users/andersio/received_events","type":"User","site_admin":false},"created_at":"2016-12-12T16:49:47Z","updated_at":"2016-12-12T16:49:47Z","body":"@dmcrodrigues \r\n\r\n> your suggestion got me thinking and I think having that kind of support is valuable but I don't see a reason to not make a distinction between inserting a single element or a range of elements which, in a certain way, gives more information and flexibility to consumers act upon accordingly, e.g perform an insert(_:at:) over an insert(contentsOf:at:).\r\n\r\nIf you look at the `Array` implementation though, all of them is built upon `replaceSubrange`. Say `insert(_:at:)` wraps the value in a `CollectionOfOne`, and `removeAll` sends an `EmptyCollection`.\r\n\r\n> And since we are iterating over this, why not provide from the start a list of updates where an update is the combination of a Remove and an Insert sharing the same index in the same Changeset?\r\n\r\nSure. As a note though, while it matters only when we do batching, we should define it to be pre-deletion indexes — at least UITableView and UICollectionView assumes this."}}
{"actor":{"display_login":"andersio"}}