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

Code before:
{
    return [_table getDateInColumn:colNdx atRow:_ndx];
}

-(TightdbTable *)getTableInColumn:(NSUInteger)colNdx
{
    return [_table getTableInColumn:colNdx atRow:_ndx];
}

-(TightdbMixed *)getMixedInColumn:(NSUInteger)colNdx
{
    return [_table getMixedInColumn:colNdx atRow:_ndx];
}

-(void)setInt:(int64_t)value inColumn:(NSUInteger)colNdx
{
    [_table setInt:value inColumn:colNdx atRow:_ndx];
}

-(void)setString:(NSString *)value inColumn:(NSUInteger)colNdx
{
    [_table setString:value inColumn:colNdx atRow:_ndx];
}

-(void)setBinary:(TightdbBinary *)value inColumn:(NSUInteger)colNdx
{
    [_table setBinary:value inColumn:colNdx atRow:_ndx];
}

-(void)setBool:(BOOL)value inColumn:(NSUInteger)colNdx
{
    [_table setBool:value inColumn:colNdx atRow:_ndx];
}

-(void)setFloat:(float)value inColumn:(NSUInteger)colNdx
{
    [_table setFloat:value inColumn:colNdx atRow:_ndx];
}

-(void)setDouble:(double)value inColumn:(NSUInteger)colNdx
{
    [_table setDouble:value inColumn:colNdx atRow:_ndx];
}

-(void)setDate:(time_t)value inColumn:(NSUInteger)colNdx
{
    [_table setDate:value inColumn:colNdx atRow:_ndx];
}

-(void)setTable:(TightdbTable *)value inColumn:(NSUInteger)colNdx
{

Review comment (suggestion):
Consider adding `long` or even a `double`(aka `NSNumber`) as permitted classes.


Code after:
-(void)setObject:(id)obj atIndexedSubscript:(NSUInteger)colNdx
{
    TightdbType columnType = [_table getColumnType:colNdx];

    // TODO: Verify obj type

    switch (columnType) {
        case tightdb_Bool:
            [_table setBool:[obj boolValue] inColumn:colNdx atRow:_ndx];
            break;
        case tightdb_Int:
            [_table setInt:[obj longLongValue] inColumn:colNdx atRow:_ndx];
            break;
        case tightdb_Float:
            [_table setFloat:[obj floatValue] inColumn:colNdx atRow:_ndx];
            break;
        case tightdb_Double:
            [_table setDouble:[obj doubleValue] inColumn:colNdx atRow:_ndx];
            break;
        case tightdb_String:
            if (![obj isKindOfClass:[NSString class]])
                [NSException raise:@"TypeException" format:@"Inserting non-string obj into string column"];
            [_table setString:(NSString*)obj inColumn:colNdx atRow:_ndx];
            break;
        case tightdb_Date:
            if ([obj isKindOfClass:[NSDate class]])
                [NSException raise:@"TypeException" format:@"Inserting non-date obj into date column"];
            [_table setDate:time_t([obj timeIntervalSince1970]) inColumn:colNdx atRow:_ndx];
            break;
        case tightdb_Binary:
            [_table setBinary:(TightdbBinary *)obj inColumn:colNdx atRow:_ndx];
            break;
        case tightdb_Table:
            [_table setTable:(TightdbTable *)obj inColumn:colNdx atRow:_ndx];
            break;
        case tightdb_Mixed:
            [_table setMixed:(TightdbMixed *)obj inColumn:colNdx atRow:_ndx];
            break;
    }
}

-(void)setObject:(id)obj forKeyedSubscript:(id <NSCopying>)key
{
    NSUInteger colNdx = [_table getColumnIndex:(NSString*)key];
    [self setObject:obj atIndexedSubscript:colNdx];
}

-(int64_t)getIntInColumn:(NSUInteger)colNdx
{
    return [_table getIntInColumn:colNdx atRow:_ndx];
}