Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Subspec for Diffing #368

Closed
wants to merge 13 commits into from
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ This release closes the [2.1.0 milestone](https://github.com/Instagram/IGListKit

- Working ranges now work with `IGListStackedSectionController`. [Ryan Nystrom](https://github.com/rnystrom) [(#356)](https://github.com/Instagram/IGListKit/pull/356)

- Added CocoaPods subspec for diffing, `IGListKit/Diffing` and an [installation guide](https://instagram.github.io/IGListKit/installation.html). [Sherlouk](https://github.com/Sherlouk) [(#368)](https://github.com/Instagram/IGListKit/pull/368)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥🔥🔥


### Fixes

- Avoid `UICollectionView` crashes when queueing a reload and insert/delete on the same item as well as reloading an item in a section that is animating. [Ryan Nystrom](https://github.com/rnystrom) [(#325)](https://github.com/Instagram/IGListKit/pull/325)
Expand Down
45 changes: 45 additions & 0 deletions Guides/Installation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Installation

This guide provides details on how to install `IGListKit`.

## CocoaPods

The preferred method of installation for `IGListKit` is using [CocoaPods](https://cocoapods.org/).

In order to use the latest release of the framework, add the following to your `Podfile`:

```ruby
pod 'IGListKit', '~> 2.0.0'
```

### Using `master`

Alternatively, you can use the latest version from the [`master` branch](https://github.com/Instagram/IGListKit/tree/master). This is what we use at Instagram, so you can be confident that `master` is always stable.

```ruby
pod 'IGListKit', :git => 'https://github.com/Instagram/IGListKit.git', :branch => 'master'
```

### Subspecs

With the exception of `macOS` (which currently only supports the diffing algorithm components), using `pod 'IGListKit'` will get you the full library, including the flexible `UICollectionView` system. Learn more about how to get started in our [Getting Started guide](https://instagram.github.io/IGListKit/getting-started.html).

However, if you only want to use the diffing components of this library, then you can use the diffing subspec in your `Podfile`:

```ruby
pod 'IGListKit/Diffing', '~> 2.0.0'
```

Regardless of whether you only use the diffing components, or the entire library, the imports are the same:

```swift
import IGListKit
```

## Carthage

If using [Carthage](https://github.com/Carthage/Carthage), add the following to your `Cartfile`:

```ogdl
github "Instagram/IGListKit" ~> 2.0.0
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can followup w/ manual install steps too

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did have that, but @jessesquires removed it -- not sure reasoning behind that?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ha, sorry.

Removed because manual installation doesn't really work -- it's not just "drag and drop" because our test target depends on OCMock via CocoaPods.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably worth just leaving it out then, I'm sure if you really want to manually install it then you'll be able to work it out -- or ask in the issues

25 changes: 13 additions & 12 deletions IGListKit.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,22 @@ Pod::Spec.new do |s|
:branch => 'stable'
}

s.ios.source_files = 'Source/**/*.{h,m,mm}'
s.ios.private_header_files = [
'Source/Internal/*.h',
'Source/Common/Internal/*.h'
]
s.subspec 'Diffing' do |ds|
ds.source_files = 'Source/Common/**/*.{h,m,mm}'
ds.private_header_files = 'Source/Common/Internal/*.h'
end

s.tvos.source_files = 'Source/**/*.{h,m,mm}'
s.tvos.private_header_files = [
'Source/Internal/*.h',
'Source/Common/Internal/*.h'
]
s.subspec 'Default' do |cs|
cs.dependency 'IGListKit/Diffing'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Slick!


s.osx.source_files = 'Source/Common/**/*.{h,m,mm}'
s.osx.private_header_files = 'Source/Common/Internal/*.h'
cs.ios.source_files = 'Source/**/*.{h,m,mm}'
cs.ios.private_header_files = ['Source/Internal/*.h', 'Source/Common/Internal/*.h']

cs.tvos.source_files = 'Source/**/*.{h,m,mm}'
cs.tvos.private_header_files = ['Source/Internal/*.h', 'Source/Common/Internal/*.h']
end

s.default_subspec = 'Default'
s.requires_arc = true

s.ios.deployment_target = '8.0'
Expand Down
10 changes: 9 additions & 1 deletion IGListKit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,9 @@
88DF89881E010F5C00B1B9B4 /* IGListDiffResultTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 294AC6311DDE4C19002FCE5D /* IGListDiffResultTests.m */; };
88DF89891E010F6500B1B9B4 /* IGListDiffSwiftTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 88144EE61D870EDC007C7F66 /* IGListDiffSwiftTests.swift */; };
88DF898A1E010F7000B1B9B4 /* IGListDiffTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 88144EE81D870EDC007C7F66 /* IGListDiffTests.m */; };
9893175F1E0E844800DB93B3 /* IGListDiffKit.h in Headers */ = {isa = PBXBuildFile; fileRef = 9893175E1E0E844800DB93B3 /* IGListDiffKit.h */; };
989317601E0E8D0A00DB93B3 /* IGListDiffKit.h in Headers */ = {isa = PBXBuildFile; fileRef = 9893175E1E0E844800DB93B3 /* IGListDiffKit.h */; };
989317611E0E8D0B00DB93B3 /* IGListDiffKit.h in Headers */ = {isa = PBXBuildFile; fileRef = 9893175E1E0E844800DB93B3 /* IGListDiffKit.h */; };
989317631E0ED45900DB93B3 /* IGListCompatibility.h in Headers */ = {isa = PBXBuildFile; fileRef = 989317621E0ED45900DB93B3 /* IGListCompatibility.h */; settings = {ATTRIBUTES = (Public, ); }; };
989317641E0ED45900DB93B3 /* IGListCompatibility.h in Headers */ = {isa = PBXBuildFile; fileRef = 989317621E0ED45900DB93B3 /* IGListCompatibility.h */; settings = {ATTRIBUTES = (Public, ); }; };
989317651E0ED45900DB93B3 /* IGListCompatibility.h in Headers */ = {isa = PBXBuildFile; fileRef = 989317621E0ED45900DB93B3 /* IGListCompatibility.h */; settings = {ATTRIBUTES = (Public, ); }; };
Expand Down Expand Up @@ -433,6 +436,7 @@
887D0B3F1D870D7F009E01F7 /* IGListKitTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = IGListKitTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
887D0B571D870E1E009E01F7 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
88DF897C1E010E6A00B1B9B4 /* IGListKit-macOSTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "IGListKit-macOSTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
9893175E1E0E844800DB93B3 /* IGListDiffKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IGListDiffKit.h; sourceTree = "<group>"; };
989317621E0ED45900DB93B3 /* IGListCompatibility.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IGListCompatibility.h; sourceTree = "<group>"; };
C4A16046BECFD57B7EB75259 /* Pods-IGListKitTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-IGListKitTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-IGListKitTests/Pods-IGListKitTests.debug.xcconfig"; sourceTree = "<group>"; };
DD3152AC1DE227FA00AC9D2C /* IGListKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = IGListKit.framework; sourceTree = BUILT_PRODUCTS_DIR; };
Expand Down Expand Up @@ -502,6 +506,7 @@
0B3B92A21E08D7F5008390ED /* IGListCollectionView.h */,
0B3B92A41E08D7F5008390ED /* IGListDisplayDelegate.h */,
0B3B92A51E08D7F5008390ED /* IGListGridCollectionViewLayout.h */,
0B3B928B1E08D7F5008390ED /* IGListKit.h */,
0B3B92A71E08D7F5008390ED /* IGListReloadDataUpdater.h */,
0B3B92A91E08D7F5008390ED /* IGListScrollDelegate.h */,
0B3B92AA1E08D7F5008390ED /* IGListSectionController.h */,
Expand Down Expand Up @@ -534,10 +539,10 @@
989317621E0ED45900DB93B3 /* IGListCompatibility.h */,
0B3B92831E08D7F5008390ED /* IGListDiff.h */,
0B3B92851E08D7F5008390ED /* IGListDiffable.h */,
9893175E1E0E844800DB93B3 /* IGListDiffKit.h */,
0B3B92861E08D7F5008390ED /* IGListExperiments.h */,
0B3B92871E08D7F5008390ED /* IGListIndexPathResult.h */,
0B3B92891E08D7F5008390ED /* IGListIndexSetResult.h */,
0B3B928B1E08D7F5008390ED /* IGListKit.h */,
0B3B928C1E08D7F5008390ED /* IGListMacros.h */,
0B3B928D1E08D7F5008390ED /* IGListMoveIndex.h */,
0B3B928F1E08D7F5008390ED /* IGListMoveIndexPath.h */,
Expand Down Expand Up @@ -761,6 +766,7 @@
0B3B92CF1E08D7F5008390ED /* IGListDiffable.h in Headers */,
0B3B92EB1E08D7F5008390ED /* IGListMoveIndexInternal.h in Headers */,
0B3B93211E08D7F5008390ED /* IGListStackedSectionController.h in Headers */,
989317601E0E8D0A00DB93B3 /* IGListDiffKit.h in Headers */,
0B3B92EF1E08D7F5008390ED /* NSNumber+IGListDiffable.h in Headers */,
0B3B93411E08D7F5008390ED /* IGListWorkingRangeHandler.h in Headers */,
0B3B92E71E08D7F5008390ED /* IGListIndexPathResultInternal.h in Headers */,
Expand Down Expand Up @@ -813,6 +819,7 @@
0B3B92CE1E08D7F5008390ED /* IGListDiffable.h in Headers */,
0B3B92EA1E08D7F5008390ED /* IGListMoveIndexInternal.h in Headers */,
0B3B93201E08D7F5008390ED /* IGListStackedSectionController.h in Headers */,
9893175F1E0E844800DB93B3 /* IGListDiffKit.h in Headers */,
0B3B92EE1E08D7F5008390ED /* NSNumber+IGListDiffable.h in Headers */,
0B3B93401E08D7F5008390ED /* IGListWorkingRangeHandler.h in Headers */,
0B3B92E61E08D7F5008390ED /* IGListIndexPathResultInternal.h in Headers */,
Expand Down Expand Up @@ -847,6 +854,7 @@
0B3B93501E08D839008390ED /* IGListExperiments.h in Headers */,
0B3B93551E08D839008390ED /* IGListMoveIndex.h in Headers */,
0B3B93541E08D839008390ED /* IGListMacros.h in Headers */,
989317611E0E8D0B00DB93B3 /* IGListDiffKit.h in Headers */,
0B3B93491E08D82E008390ED /* IGListIndexSetResultInternal.h in Headers */,
0B3B93481E08D82E008390ED /* IGListIndexPathResultInternal.h in Headers */,
0B3B93571E08D839008390ED /* NSNumber+IGListDiffable.h in Headers */,
Expand Down
11 changes: 4 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,25 +56,22 @@ We use the open source version `master` branch in the Instagram app.

### CocoaPods

The preferred installation method for `IGListKit` is with [CocoaPods](https://cocoapods.org).
Add the following to your `Podfile`:
The preferred installation method is with [CocoaPods](https://cocoapods.org). Add the following to your `Podfile`:

```ruby
# Latest release of IGListKit
pod 'IGListKit', '~> 2.0.0'

# Use the master branch (we use this at Instagram)
pod 'IGListKit', :git => 'https://github.com/Instagram/IGListKit.git', :branch => 'master'
```

### Carthage

If using [Carthage](https://github.com/Carthage/Carthage), add the following to your `Cartfile`:
For [Carthage](https://github.com/Carthage/Carthage), add the following to your `Cartfile`:

```ogdl
github "Instagram/IGListKit" ~> 2.0.0
```

> **For advanced usage, see our [Installation Guide](https://instagram.github.io/IGListKit/advanced-installation.html)**.

## Getting Started

- Our [Getting Started guide](https://instagram.github.io/IGListKit/getting-started.html)
Expand Down
40 changes: 40 additions & 0 deletions Source/Common/IGListDiffKit.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/**
* Copyright (c) 2016-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/

#import <TargetConditionals.h>

#if TARGET_OS_EMBEDDED || TARGET_OS_SIMULATOR
#import <UIKit/UIKit.h>
#else
#import <Cocoa/Cocoa.h>
#endif
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

import the new compatibility header?


/**
* Project version number for IGListKit.
*/
FOUNDATION_EXPORT double IGListKitVersionNumber;

/**
* Project version string for IGListKit.
*/
FOUNDATION_EXPORT const unsigned char IGListKitVersionString[];

// Common (iOS, tvOS, macOS compatible):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: can we remove this?


#import <IGListKit/IGListAssert.h>
#import <IGListKit/IGListBatchUpdateData.h>
#import <IGListKit/IGListDiff.h>
#import <IGListKit/IGListDiffable.h>
#import <IGListKit/IGListExperiments.h>
#import <IGListKit/IGListIndexPathResult.h>
#import <IGListKit/IGListIndexSetResult.h>
#import <IGListKit/IGListMoveIndex.h>
#import <IGListKit/IGListMoveIndexPath.h>
#import <IGListKit/NSNumber+IGListDiffable.h>
#import <IGListKit/NSString+IGListDiffable.h>
File renamed without changes.