-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFRZDatabaseMappable.m
More file actions
66 lines (53 loc) · 1.74 KB
/
FRZDatabaseMappable.m
File metadata and controls
66 lines (53 loc) · 1.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
//
// FRZDatabaseMappableView.m
// Forza Football
//
// Created by Joel Ekström on 2018-02-01.
// Copyright © 2018 FootballAddicts. All rights reserved.
//
#import "FRZDatabaseMappable.h"
@implementation UITableView (FRZDatabaseMappable)
- (void)deleteSections:(NSIndexSet *)sections
{
[self deleteSections:sections withRowAnimation:UITableViewRowAnimationFade];
}
- (void)insertSections:(NSIndexSet *)sections
{
[self insertSections:sections withRowAnimation:UITableViewRowAnimationFade];
}
- (void)deleteItemsAtIndexPaths:(NSArray<NSIndexPath *> *)indexPaths
{
[self deleteRowsAtIndexPaths:indexPaths withRowAnimation:UITableViewRowAnimationFade];
}
- (void)insertItemsAtIndexPaths:(NSArray<NSIndexPath *> *)indexPaths
{
[self insertRowsAtIndexPaths:indexPaths withRowAnimation:UITableViewRowAnimationFade];
}
- (void)reloadItemsAtIndexPaths:(NSArray<NSIndexPath *> *)indexPaths
{
[self reloadRowsAtIndexPaths:indexPaths withRowAnimation:UITableViewRowAnimationNone];
}
- (void)moveItemAtIndexPath:(NSIndexPath *)indexPath toIndexPath:(NSIndexPath *)newIndexPath;
{
[self moveRowAtIndexPath:indexPath toIndexPath:newIndexPath];
}
- (void)frz_performBatchUpdates:(void (NS_NOESCAPE ^ _Nullable)(void))updates completion:(void (^ _Nullable)(BOOL finished))completion
{
[CATransaction begin];
[CATransaction setCompletionBlock:^{
if (completion) {
completion(YES);
}
}];
[self beginUpdates];
updates();
[self endUpdates];
[CATransaction commit];
}
@end
@implementation UICollectionView (FRZDatabaseMappable)
- (void)frz_performBatchUpdates:(void (^)(void))updates completion:(void (^)(BOOL finished))completion
{
[self performBatchUpdates:updates completion:completion];
}
@end