Introduction
Welcome to the KiNMigrationModule documentation! This documentation will guide you through the installation and usage of the KiNMigrationModule library.
Installation
To start using KiNMigrationModule in your project, you can choose one of the following methods:
Method 1: Cocoapods
- Open your
Podfile
and add the following line: - Run
pod install
in your project directory. - Import KiNMigrationModule in your project:
pod 'KiNMigrationModule'
import KiNMigrationModule
Method 2: Manual
- Download the latest version of KiNMigrationModule from the GitHub repository.
- Drag and drop the
KiNMigrationModule.framework
file into your Xcode project. - Make sure Copy items if needed is selected and click Finish.
- Import KiNMigrationModule in your project:
import KiNMigrationModule
Usage
Step 1: Setting up the Migration Handlers
In order to use KiNMigrationModule, you need to set up the migration handlers. Follow the steps below to do this:
- Create an instance of
MigrationModule
and set it as the shared instance for your app: - Create a migration handler class that conforms to the
MigrationHandler
protocol: - Register your migration handler with the migration module:
let migrationModule = MigrationModule()
MigrationModule.shared = migrationModule
class MyMigrationHandler: MigrationHandler {
func migrate(fromVersion version: UInt64) {
// Perform migration steps based on the version
}
}
migrationModule.register(handler: MyMigrationHandler())
Step 2: Initializing the Migration Module
Next, you need to initialize the migration module in your app delegate’s didFinishLaunchingWithOptions
method:
- Add the following code to initialize the migration module:
migrationModule.initialize()
Step 3: Performing Migrations
When you want to perform migrations, call the MigrationModule.shared.migrate()
method:
- Call the migration method in an appropriate place in your app, such as during app launch:
MigrationModule.shared.migrate()
Conclusion
Congratulations! You now have the basic understanding of KiNMigrationModule and how to use it in your iOS project. If you encounter any issues or have further questions, please feel free to refer to the GitHub repository or reach out to our support team.