Skip to content

TextDiffing simplifies the process of comparing texts by generating an AttributedString or NSAttributedString, making differences clear and easy to see. This tool is perfect for developers who want to enhance text visualization in their applications. πŸ™πŸ“„

License

Notifications You must be signed in to change notification settings

serbanlaurentiu/TextDiffing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

38 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

TextDiffing 🧬

GitHub Repo

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.

Table of Contents

Features

  • 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.

Installation

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:

  1. Go to the Releases section.
  2. Download the appropriate file for your platform.
  3. Execute the file to set up TextDiffing.

Usage

To use TextDiffing, follow these simple steps:

  1. Import the library into your project.
  2. Create an instance of the TextDiffing class.
  3. 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

Examples

Basic Comparison

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)

Custom Styles

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

Contributing

We welcome contributions! If you want to help improve TextDiffing, please follow these steps:

  1. Fork the repository.
  2. Create a new branch (git checkout -b feature/YourFeature).
  3. Make your changes.
  4. Commit your changes (git commit -m 'Add some feature').
  5. Push to the branch (git push origin feature/YourFeature).
  6. Open a Pull Request.

Please ensure your code follows the project's coding style and includes appropriate tests.

License

TextDiffing is licensed under the MIT License. See the LICENSE file for details.

Releases

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!

About

TextDiffing simplifies the process of comparing texts by generating an AttributedString or NSAttributedString, making differences clear and easy to see. This tool is perfect for developers who want to enhance text visualization in their applications. πŸ™πŸ“„

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages