Post

Replies

Boosts

Views

Activity

Reply to Why do they behave differently from each other ?
Duplicate items/sections is not the point.The same initial list @[@1,@2,@3,@5] and same insertion list @[@3,@4] and same toidentifier @5, why different between insertSectionsWithIdentifiers and insertItemsWithIdentifiers. It seem to ignore the duplicate section @3,only insert @4 when insertSectionsWithIdentifiers. but when insertItemsWithIdentifiers, it seem to move the @3,not ignore.
Jul ’20
Reply to Why do they behave differently from each other ?
NSArray *sections = @[@"1",@"2",@"3",@"5"];     NSArray *insertSections = @[@"3",@"4"];     [self.stringSnapshot appendSectionsWithIdentifiers:sections];     [self.stringSnapshot insertSectionsWithIdentifiers:insertSections afterSectionWithIdentifier:@"5"];     NSArray *expect = @[@"1",@"2",@"3",@"5",@"4"];     XCTAssertEqualObjects([self.stringSnapshot sectionIdentifiers], expect);     NSArray *items = @[@"1",@"2",@"3",@"5"];     NSArray *insertItems = @[@"3",@"4"];     NSArray *sections = @[@1,@2];     [self.stringSnapshot appendSectionsWithIdentifiers:sections];     [self.stringSnapshot appendItemsWithIdentifiers:items];     [self.stringSnapshot insertItemsWithIdentifiers:insertItems afterItemWithIdentifier:@"5"];     NSArray *expect = @[@"1",@"2",@"3",@"5",@"4"];     XCTAssertEqualObjects([self.stringSnapshot itemIdentifiers], expect); I tried using strings in both cases, but the result is same as above.The same goes for Numbers.
Jul ’20