Commit 4073db6
committed
Fix empty view setup if configured before parent view
Before this change, if you were to assign a data source’s emptyView
*before* you assigned its tableView or collectionView, the emptyView
would not be displayed if there were no items. This was because the
emptyView was not [properly updated since at the time of the assignment
its parent view would be nil][1].
Before:
```objc
dataSource.emptyView = [MyAwesomeView new];
// other stuff
dataSource.tableView = self.tableView;
// if dataSource has no items, MyAwesomeView will never appear :(
```
After:
```objc
dataSource.emptyView = [MyAwesomeView new];
// other stuff
dataSource.tableView = self.tableView;
// if dataSource has no items, MyAwesomeView will appear in all of its
// glory :)
```
[1]: https://github.com/splinesoft/SSDataSources/blob/2321bc79e9a9b2a537ffe8e806b08fbc021b13e2/SSDataSources/SSBaseDataSource.m#L248-L2501 parent 64c0b70 commit 4073db6
2 files changed
Lines changed: 21 additions & 0 deletions
Lines changed: 17 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
204 | 204 | | |
205 | 205 | | |
206 | 206 | | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
207 | 224 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
| 107 | + | |
| 108 | + | |
107 | 109 | | |
108 | 110 | | |
109 | 111 | | |
| |||
112 | 114 | | |
113 | 115 | | |
114 | 116 | | |
| 117 | + | |
| 118 | + | |
115 | 119 | | |
116 | 120 | | |
117 | 121 | | |
| |||
0 commit comments