mirror of
https://github.com/Instagram/IGListKit
synced 2026-04-25 15:37:38 +00:00
Summary: Couple best practices I want to make sure our examples reflect: - Multiple cells in a section controller - Unique models returned in `objectsForListAdapter:` (no dupes!) - Dynamic item count (`comments` array) Issue fixed: #595 - [x] All tests pass. Demo project builds and runs. Closes https://github.com/Instagram/IGListKit/pull/615 Differential Revision: D4852192 Pulled By: jessesquires fbshipit-source-id: f4a89800f90e6b5ea4b6dd7c0d9a78ca5d65082c
39 lines
1.2 KiB
Objective-C
39 lines
1.2 KiB
Objective-C
/**
|
|
Copyright (c) 2016-present, Facebook, Inc. All rights reserved.
|
|
|
|
The examples provided by Facebook are for non-commercial testing and evaluation
|
|
purposes only. Facebook reserves all rights not expressly granted.
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
|
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
*/
|
|
|
|
#import "Post.h"
|
|
|
|
@implementation Post
|
|
|
|
- (instancetype)initWithUsername:(NSString *)username
|
|
comments:(NSArray<NSString *> *)comments {
|
|
if (self = [super init]) {
|
|
_username = [username copy];
|
|
_comments = [comments copy];
|
|
}
|
|
return self;
|
|
}
|
|
|
|
#pragma mark - IGListDiffable
|
|
|
|
- (id<NSObject>)diffIdentifier {
|
|
return self;
|
|
}
|
|
|
|
- (BOOL)isEqualToDiffableObject:(id)object {
|
|
// since the diff identifier returns self, object should only be compared with same instance
|
|
return self == object;
|
|
}
|
|
|
|
@end
|