 		sendNext(self.observer, change)
 	}
 
+	/// Replaces all items with a given array of items
+	/// and emits `DataChangeReloadSections`.
 	public func replaceItemsWithItems(items: [T]) {
 		self._items.value = items
 		let change = DataChangeReloadSections(0)

		return (self, indexPath)
	}

	public func insertItem(item: T, atIndex index: Int) {
		self._items.value.insert(item, atIndex: index)
		let change = DataChangeInsertItems(z(index))
		sendNext(self.observer, change)
	}

	public func deleteItemAtIndex(index: Int) {
		self._items.value.removeAtIndex(index)
		let change = DataChangeDeleteItems(z(index))
		sendNext(self.observer, change)
	}

	public func replaceItemAtIndex(index: Int, withItem item: T) {
		self._items.value[index] = item
		let change = DataChangeReloadItems(z(index))
		sendNext(self.observer, change)
	}

	public func moveItemAtIndex(index oldIndex: Int, toIndex newIndex: Int) {
		let item = self._items.value.removeAtIndex(oldIndex)
		self._items.value.insert(item, atIndex: newIndex)

import Foundation
import ReactiveCocoa

/// `DataSource` implementation that has one section of items of type T.
///
/// The array of items can be modified by calling methods that perform
/// individual changes and instantly make the dataSource emit
/// a corresponding dataChange.
public final class MutableDataSource<T>: DataSource {

	public let changes: Signal<DataChange, NoError>
