mysterioustrousers / mtmigration Goto Github PK
View Code? Open in Web Editor NEWManages blocks of code that only need to run once on version updates in iOS apps.
License: BSD 2-Clause "Simplified" License
Manages blocks of code that only need to run once on version updates in iOS apps.
License: BSD 2-Clause "Simplified" License
Sorry for my english.
I'm using [MTMigration applicationUpdateBlock]. I want to indicate migrating progress to user. I think when fixed by additional completionBlock. Are there plans to add such a function?
Hello, I've been using MTMigration for years (and contributed to an early version) but now that Swift Package Manager exists I would very much like a SwiftPM version instead of integrating it with CocoaPods.
Until then I have ported a subset to Swift as a drop-in replacement and made it into a Swift Package: https://github.com/Clafou/Migration
If i need to migrate from lets say 1.0 to 1.1 and i would use your method migrateToVersion:block: with the parameter @"1.1" for the version, than the block would be executed if the current Version is 1.1 no matter if there was an old version installed. And the block would get executed if the app version is higher. For example if the initial install of the user is 2.0 than the block would get executed.
Please correct me if i am wrong.
Best regards.
A common use case for me is to distinguish new installs from updates. Often I need to correct something in the database of old users, but don't touch it for fresh installs (because it's fixed out of the box for them).
Perhaps something like this would make sense:
[MTMigration migrateToVersion:@"1.1" block:^{
if([[MTMigration firstVersionKnownOnThisDevice] isEqualToString:@"1.1"]) {
// Treat new users differently
}
[obj doSomeDataStuff];
}];
I try to avoid this situation; if often happens when you ship some initial data with the app and the app doesn't sync with a server.
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)
.
Adding a hasAppBeenUpdated
property would allow the synchronous execution of code in an easier way:
if (isCacheAvailable &&
[MTMigration hasAppBeenUpdated] == NO) {
loadCache();
} else {
writeCache();
}
Let me know what you think, @pwightman
It would be handy to have a method where you can set a block that is executed on every Application Update. So everytime the version string of the application changes.
This would be handy to clean up the application or do other stuff that needs to be done on every update.
I need this functionality. So I'll implement it.
Do you think it would be worth that this functionality is part of the repo?
Why not just run the block in the thread the method was called on?
=====================Cartfile ====================
github "mysterioustrousers/MTMigration"
=====================Run "carthage update" ====================
*** Fetching MTMigration
*** Checking out MTMigration at "0.0.5"
*** xcodebuild output can be found in /var/folders/m9/wv055crx2l1c8ttcy2vtl8_40000gn/T/carthage-xcodebuild.lFesDL.log
*** Skipped building MTMigration due to the error:
Dependency "MTMigration" has no shared framework schemes
We appreciate the work but is this repo still maintained? We needed Carthage support which isn't available here. So we refactored stuff and moved to Swift 4. Feel free to give it a try and make pull requests
Thanks !
When installing via CocoaPods, I'm not getting the new applicationUpdateBlock:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.