Repository: realm/realm-swift
File: Realm/RLMArray.mm (Objective-C++)

Code before:
// patents in process, and are protected by trade secret or copyright law.
// Dissemination of this information or reproduction of this material
// is strictly forbidden unless prior written permission is obtained
// from TightDB Incorporated.
//
////////////////////////////////////////////////////////////////////////////

#import "RLMArray_Private.hpp"
#import "RLMArrayAccessor.h"

#import "RLMRealm_Private.hpp"
#import "RLMSchema.h"
#import "RLMObjectStore.h"
#import "RLMQueryUtil.h"
#import "RLMConstants.h"

#import <objc/runtime.h>

#import <tightdb/util/unique_ptr.hpp>

//
// Private properties
//
@interface RLMArray ()
@property (nonatomic, assign) tightdb::Query *backingQuery;
@property (nonatomic, copy) NSString *objectClassName;
@end

//
// RLMArray implementation
//
@implementation RLMArray {
    tightdb::util::UniquePtr<tightdb::Query> _backingQuery;
    tightdb::TableView _backingView;
}

@dynamic backingQuery;
@synthesize realm = _realm;
@synthesize objectIndex = _objectIndex;
@synthesize backingTableIndex = _backingTableIndex;
@synthesize backingTable = _backingTable;
@synthesize writable = _writable;

- (instancetype)initWithObjectClassName:(NSString *)objectClassName
                                  query:(tightdb::Query *)query
                                   view:(tightdb::TableView &)view {
    self = [super init];
    if (self) {
        self.objectClassName = objectClassName;
        self.backingQuery = query;
        _backingView = view;

Review comment (suggestion):
This by default generates an ivar named _backingView when the property is synthesized. Keep this line and remove the other declaration.


Code after:
// patents in process, and are protected by trade secret or copyright law.
// Dissemination of this information or reproduction of this material
// is strictly forbidden unless prior written permission is obtained
// from TightDB Incorporated.
//
////////////////////////////////////////////////////////////////////////////

#import "RLMArray_Private.hpp"
#import "RLMArrayAccessor.h"

#import "RLMRealm_Private.hpp"
#import "RLMSchema.h"
#import "RLMObjectStore.h"
#import "RLMQueryUtil.h"
#import "RLMConstants.h"

#import <objc/runtime.h>

#import <tightdb/util/unique_ptr.hpp>

//
// Private properties
//
@interface RLMArray ()
@property (nonatomic, assign) tightdb::Query *backingQuery;
// When getting the backingView using dot notation, the tableview is copied in core. Use _backingView instead when accessing.
@property (nonatomic, assign) tightdb::TableView backingView;
@property (nonatomic, copy) NSString *objectClassName;
@end

//
// RLMArray implementation
//
@implementation RLMArray {
    tightdb::util::UniquePtr<tightdb::Query> _backingQuery;
}

@dynamic backingQuery;
@synthesize realm = _realm;
@synthesize objectIndex = _objectIndex;
@synthesize backingTableIndex = _backingTableIndex;
@synthesize backingTable = _backingTable;
@synthesize writable = _writable;

- (instancetype)initWithObjectClassName:(NSString *)objectClassName
                                  query:(tightdb::Query *)query
                                   view:(tightdb::TableView &)view {
    self = [super init];
    if (self) {
        self.objectClassName = objectClassName;
        self.backingQuery = query;