Welcome to the TextDiffing repository! This project aims to help you visualize differences between texts using AttributedString / NSAttributedString. You can easily highlight changes, additions, and deletions in your text, making it easier to track modifications over time.
- Visual Differences: See changes clearly with color-coded highlights.
- User-Friendly: Simple API for easy integration into your projects.
- Customizable: Adjust styles and formats to fit your needs.
- Efficient: Designed for performance, even with large texts.
To get started with TextDiffing, clone the repository and build the project. You can also download the latest release from the Releases section. If you choose to download a release, follow these steps:
- Go to the Releases section.
- Download the appropriate file for your platform.
- Execute the file to set up TextDiffing.
To use TextDiffing, follow these simple steps:
- Import the library into your project.
- Create an instance of the TextDiffing class.
- Use the
compareTexts
method to analyze two strings.
Here's a basic example:
import TextDiffing
let text1 = "Hello, world!"
let text2 = "Hello, beautiful world!"
let differ = TextDiffer()
let attributedString = differ.compareTexts(text1, text2)
// Display attributedString in your UI
let text1 = "This is a sample text."
let text2 = "This is a sample text with some changes."
let differ = TextDiffer()
let result = differ.compareTexts(text1, text2)
// Output the result
print(result)
You can customize the styles for added and removed text:
let styles = TextDiffStyles(addedColor: .green, removedColor: .red)
let differ = TextDiffer(styles: styles)
let attributedString = differ.compareTexts(text1, text2)
// Use attributedString in your UI
We welcome contributions! If you want to help improve TextDiffing, please follow these steps:
- Fork the repository.
- Create a new branch (
git checkout -b feature/YourFeature
). - Make your changes.
- Commit your changes (
git commit -m 'Add some feature'
). - Push to the branch (
git push origin feature/YourFeature
). - Open a Pull Request.
Please ensure your code follows the project's coding style and includes appropriate tests.
TextDiffing is licensed under the MIT License. See the LICENSE file for details.
For the latest releases and updates, visit the Releases section. Here, you can find all the versions of TextDiffing, including notes on new features and bug fixes.
Thank you for checking out TextDiffing! We hope you find it useful for your text comparison needs. If you have any questions or feedback, feel free to reach out through the Issues section on GitHub. Happy coding!