XHVersion

Thank you for visiting XHVersion’s documentation page. Here, you will find all the information you need to effectively use the XHVersion tool in your projects. XHVersion is an efficient framework for version management in iOS applications. It provides a user-friendly interface to handle app versions, updates, and related features effortlessly.

Getting Started

If you’re new to XHVersion, follow these steps to get started:

  1. Install XHVersion into your Xcode project. You can do this via Cocoapods, Carthage, or manually adding the framework.
  2. Import the XHVersion module into your source code files.
  3. Initialize XHVersion in your application delegate’s didFinishLaunchingWithOptions method.
  4. Set up the necessary configuration options, such as minimum compatible versions and update alerts.
  5. Start enjoying the benefits of XHVersion in your app!

Features

XHVersion offers a range of features that simplify app version management:

  • Version Checking: Easily check the current version of your app and handle version-specific functionalities.
  • Version Comparison: Perform comparisons between versions to determine if an update is required or to implement different behaviors based on the current version.
  • Update Alerts: Display customizable update alerts to inform users about available updates and prompt them to upgrade.
  • Customization: Customize the appearance and behavior of XHVersion to seamlessly integrate it into your app’s UI.
  • Localization: Localize XHVersion messages to provide a great user experience across multiple languages.

Documentation

Reference our documentation to understand XHVersion’s classes, methods, and properties. Here are the main components:

  • XHVersion: The main class responsible for version management. It provides methods for checking the current version, comparing versions, and displaying update alerts.
  • XHVersionConfig: This class allows you to configure various options and settings for XHVersion, such as setting the minimum compatible version and customizing the update alert.
  • XHUpdateAlert: A customizable alert view for displaying update alerts to users. Use this class to present update information and handle user actions.

Examples

Here are some quick examples to demonstrate the usage of XHVersion:

Example 1: Basic Version Checking

Use the following code snippet to check the current version of your app:

if XHVersion.currentVersion >= "1.0.0" {
    // Perform actions specific to version 1.0.0 or higher
} else {
    // Perform actions for older versions
}

Example 2: Displaying an Update Alert

Show an update alert to inform users about the latest version and prompt them to update:

let updateAlert = XHUpdateAlert()
updateAlert.message = "A new version of our app is available. Please update!"
updateAlert.addButton(withTitle: "Update") {
    // Handle update button action
}
updateAlert.show()

Conclusion

You’ve reached the end of our XHVersion documentation. Hopefully, this information has provided you with a good understanding of XHVersion’s capabilities and how to incorporate it into your iOS projects. If you have any further questions or need additional assistance, please feel free to reach out to our support team. Happy coding!