diff --git a/CHANGELOG.md b/CHANGELOG.md index 77e99c725..007845f21 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) + ### 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) diff --git a/Guides/Installation.md b/Guides/Installation.md new file mode 100644 index 000000000..3384c4e86 --- /dev/null +++ b/Guides/Installation.md @@ -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 +``` diff --git a/IGListKit.podspec b/IGListKit.podspec index a5d638155..27deae5ff 100644 --- a/IGListKit.podspec +++ b/IGListKit.podspec @@ -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' - 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' diff --git a/IGListKit.xcodeproj/project.pbxproj b/IGListKit.xcodeproj/project.pbxproj index a6457cd51..a1e28b2b4 100644 --- a/IGListKit.xcodeproj/project.pbxproj +++ b/IGListKit.xcodeproj/project.pbxproj @@ -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, ); }; }; @@ -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 = ""; }; 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 = ""; }; 989317621E0ED45900DB93B3 /* IGListCompatibility.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IGListCompatibility.h; sourceTree = ""; }; 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 = ""; }; DD3152AC1DE227FA00AC9D2C /* IGListKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = IGListKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -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 */, @@ -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 */, @@ -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 */, @@ -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 */, @@ -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 */, diff --git a/README.md b/README.md index 03aa5d514..4c12753c6 100644 --- a/README.md +++ b/README.md @@ -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/installation.html). + ## Getting Started - Our [Getting Started guide](https://instagram.github.io/IGListKit/getting-started.html) diff --git a/Source/Common/IGListDiffKit.h b/Source/Common/IGListDiffKit.h new file mode 100644 index 000000000..c40ddbe67 --- /dev/null +++ b/Source/Common/IGListDiffKit.h @@ -0,0 +1,32 @@ +/** + * 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 + +/** + * Project version number for IGListKit. + */ +FOUNDATION_EXPORT double IGListKitVersionNumber; + +/** + * Project version string for IGListKit. + */ +FOUNDATION_EXPORT const unsigned char IGListKitVersionString[]; + +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import diff --git a/Source/Common/IGListKit.h b/Source/IGListKit.h similarity index 100% rename from Source/Common/IGListKit.h rename to Source/IGListKit.h