I have a UItableview with reordable rows and the data is in an NSarray. So how do I move an object in the NSMutablearray when the appropriate tableview delegate is called?>
Similar to Tomasz but with out of range error handling
enum ArrayError: ErrorType {
case OutOfRange
}
extension Array {
mutating func move(fromIndex fromIndex: Int, toIndex: Int) throws {
if toIndex >= count || toIndex < 0 {
throw ArrayError.OutOfRange
}
insert(removeAtIndex(fromIndex), atIndex: toIndex)
}
}