Latest 0.1.0
Homepage https://github.com/marciniwanicki/DFDiff
License MIT
Platforms ios 7.0, requires ARC
Authors

DFDiff demo

Build status

This small and extremely simple Objective-C library might help you to find a set of simple operations (insert, delete, move) to transform one array into another i.e. @[A, B] -/diff/-> @[B, A], diff = [move(0, 1)]. Currently the library supports only single-dimensional arrays (NSArray). It also provides a convenient way to animate reloading data in UITableView 💣 .

DFDiff

How to use

First, all objects you want to store in arrays need to implement DFDiffId protocol where - (NSString *)diffId must be an unique string for every single item.

@interface DFArrayDiffDemoModelEntity : NSObject <DFDiffId>

To manage changes on UITableView you can use DFTableDataReloader.
Create a new instance with reference to your table view

self.tableDataReloader = [DFTableDataReloader reloaderWithTableView:self.tableView];

and then pass new array whenever you need to refresh the table view (- (void)reloadData:(NSArray <id <DFDiffId>> *)items; )

[self.tableDataReloader reloadData:dataArray];

If something is not clear please take a look at 🚀 DemoApp.

Installation

CocoaPods is a dependency manager for Objective-C, which automates and simplifies the process of using 3rd-party libraries.

Podfile

To integrate DFDiff into your Xcode project using CocoaPods, specify it in your Podfile:

platform :ios, '7.0'

target 'TargetName' do
pod 'DFDiff', '~> 0.1.0'
end

Problems?

Yup, sometimes happen ¯(ツ)/¯ ☺ Please open a new Issue here if you run into a problem specific to DFDiff, have a feature request, or want to share a comment.

Pull requests are encouraged and greatly appreciated! 🍺

License

DFDiff is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "DFDiff",
    "version": "0.1.0",
    "summary": "Easy way to find changes in NSArray and animate reloading data in UITableView.",
    "homepage": "https://github.com/marciniwanicki/DFDiff",
    "license": "MIT",
    "authors": {
        "Marcin Iwanicki": "[email protected]"
    },
    "source": {
        "git": "https://github.com/marciniwanicki/DFDiff.git",
        "tag": "0.1.0"
    },
    "platforms": {
        "ios": "7.0"
    },
    "requires_arc": true,
    "source_files": "DFDiff/**/*.{h,m}",
    "public_header_files": "DFDiff/**/*.h"
}

Pin It on Pinterest

Share This