Repository: realm/realm-swift
File: src/realm/objc/RLMTable.mm (Objective-C++)

Code before:
        [self RLM_addEmptyRow];
        return;
    }
    tightdb::Table& table = *m_table;
    [self insertRow:data atIndex:table.size()];
}

// Moved to private header
-(RLMRow *)addEmptyRow
{
    return [[_proxyObjectClass alloc] initWithTable:self ndx:[self RLM_addEmptyRow]];
}


-(void)insertRow:(NSObject *)anObject atIndex:(NSUInteger)rowIndex
{
    if (!anObject) {
        [self RLMInsertRow:rowIndex];
        return;
    }
    
    tightdb::Table& table = *m_table;
    tightdb::ConstDescriptorRef desc = table.get_descriptor();
    
    if ([anObject isKindOfClass:[NSArray class]]) {
        verify_row(*desc, (NSArray *)anObject);
        insert_row(size_t(rowIndex), table, (NSArray *)anObject);
        return;
    }
    
    if ([anObject isKindOfClass:[NSDictionary class]]) {
        verify_row_with_labels(*desc, (NSDictionary *)anObject);
        insert_row_with_labels(size_t(rowIndex), table, (NSDictionary *)anObject);
        return;
    }
    
    if ([anObject isKindOfClass:[NSObject class]]) {
        verify_row_from_object(*desc, (NSObject *)anObject);
        insert_row_from_object(size_t(rowIndex), table, (NSObject *)anObject);
        return;
    }

    @throw [NSException exceptionWithName:@"realm:column_not_implemented"
                                   reason:@"You should either use nil, NSObject, NSDictionary, or NSArray"
                                 userInfo:nil];
}

- (void)updateRow:(NSObject *)anObject atIndex:(NSUInteger)rowIndex
{
    if (rowIndex >= self.rowCount) {
        @throw [NSException exceptionWithName:@"realm:index_out_of_bounds"

Review comment (suggestion):
are these casts necessary (also see the ones below). The `NSObject` ones are definitely superfluous.


Code after:
        [self RLM_addEmptyRow];
        return;
    }
    tightdb::Table& table = *m_table;
    [self insertRow:data atIndex:table.size()];
}

// Moved to private header
-(RLMRow *)addEmptyRow
{
    return [[_proxyObjectClass alloc] initWithTable:self ndx:[self RLM_addEmptyRow]];
}


-(void)insertRow:(NSObject *)anObject atIndex:(NSUInteger)rowIndex
{
    if (!anObject) {
        [self RLMInsertRow:rowIndex];
        return;
    }
    
    tightdb::Table& table = *m_table;
    tightdb::ConstDescriptorRef desc = table.get_descriptor();
    
    if ([anObject isKindOfClass:[NSArray class]]) {
        verify_row_with_array(*desc, (NSArray *) anObject);
        insert_row_with_array(size_t(rowIndex), table, (NSArray *) anObject);
        return;
    }
    
    if ([anObject isKindOfClass:[NSDictionary class]]) {
        verify_row_with_dictionary(*desc, (NSDictionary *) anObject);
        insert_row_with_dictionary(size_t(rowIndex), table, (NSDictionary *) anObject);
        return;
    }
    
    if ([anObject isKindOfClass:[NSObject class]]) {
        verify_row_with_object(*desc, (NSObject *) anObject);
        insert_row_with_object(size_t(rowIndex), table, (NSObject *) anObject);
        return;
    }

    @throw [NSException exceptionWithName:@"realm:column_not_implemented"
                                   reason:@"You should either use nil, NSObject, NSDictionary, or NSArray"
                                 userInfo:nil];
}

- (void)updateRow:(NSObject *)anObject atIndex:(NSUInteger)rowIndex
{
    if (rowIndex >= self.rowCount) {
        @throw [NSException exceptionWithName:@"realm:index_out_of_bounds"