Open ChocoChipset opened 9 years ago
I came across the following scenario:
I have a cache file that I would like to flush on every app update. With the current implementation MTMigration it currently looks like:
[MTMigration applicationUpdateBlock:^{ flushCache(); }]; if (isCacheAvailable) { // (1) loadCache(); } else { writeCache(); }
However, unless a synchronization method is introduced, there is no guarantee that the cache file will be flushed before (1).
(1)
Adding a hasAppBeenUpdated property would allow the synchronous execution of code in an easier way:
hasAppBeenUpdated
if (isCacheAvailable && [MTMigration hasAppBeenUpdated] == NO) { loadCache(); } else { writeCache(); }
Let me know what you think, @pwightman
Why not move the if and else blocks inside the applicationUpdateBlock's completion block?
if
else
applicationUpdateBlock
I came across the following scenario:
I have a cache file that I would like to flush on every app update. With the current implementation MTMigration it currently looks like:
However, unless a synchronization method is introduced, there is no guarantee that the cache file will be flushed before
(1)
.Adding a
hasAppBeenUpdated
property would allow the synchronous execution of code in an easier way:Let me know what you think, @pwightman