Skip to content

Commit

Permalink
Add storyboard support #39
Browse files Browse the repository at this point in the history
Summary:
This PR is for #39

- [x] I have reviewed the [contributing guide](https://github.com/Instagram/IGListKit/blob/master/CONTRIBUTING.md)
Closes #92

Differential Revision: D4066721

Pulled By: rnystrom

fbshipit-source-id: 4fca278ae9a54aa46626932d47d4a4c001b437d6
  • Loading branch information
Bofei Zhu authored and Facebook Github Bot committed Oct 25, 2016
1 parent 9d4e85a commit 8855b51
Show file tree
Hide file tree
Showing 24 changed files with 787 additions and 9 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ This release closes the [2.0.0 milestone](https://github.com/Instagram/IGListKit
- Added an additional initializer for `IGListSingleSectionController` to be able to support single sections created from nibs. An example can be found [here](Example/IGListKitExamples/ViewControllers/SingleSectionViewController.swift).
- Fixed `-[IGListAdapter reloadDataWithCompletion:]` not returning early when `collectionView` or `dataSource` is nil and `completion` is nil. [Ben Asher](https://github.com/benasher44) [(#51)](https://github.com/Instagram/IGListKit/pull/51)
- Added `-isFirstSection` and `-isLastSection` APIs to `IGListSectionController`

- Added support for cells created from storyboard. [Bofei Zhu](https://github.com/zhubofei) [(#92)](https://github.com/Instagram/IGListKit/pull/92)

1.0.0
-----
Expand Down
134 changes: 134 additions & 0 deletions Example/Demo.storyboard
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11201" systemVersion="16A323" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11161"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--Storyboard View Controller-->
<scene sceneID="oB3-c8-g1U">
<objects>
<viewController storyboardIdentifier="demo" id="5n3-mX-NaJ" customClass="StoryboardViewController" customModule="IGListKitExamples" customModuleProvider="target" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="VEL-Rj-Wcy"/>
<viewControllerLayoutGuide type="bottom" id="wYR-29-GPY"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="s2P-10-T78">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" dataMode="prototypes" translatesAutoresizingMaskIntoConstraints="NO" id="LKS-vo-Ytk" customClass="IGListCollectionView">
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<collectionViewFlowLayout key="collectionViewLayout" minimumLineSpacing="10" minimumInteritemSpacing="10" id="QR6-31-kTQ">
<size key="itemSize" width="309" height="65"/>
<size key="headerReferenceSize" width="0.0" height="0.0"/>
<size key="footerReferenceSize" width="0.0" height="0.0"/>
<inset key="sectionInset" minX="0.0" minY="0.0" maxX="0.0" maxY="0.0"/>
</collectionViewFlowLayout>
<cells>
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="cell" id="Eqn-FQ-8Sv" customClass="StoryboardCell" customModule="IGListKitExamples" customModuleProvider="target">
<rect key="frame" x="33" y="0.0" width="309" height="65"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
<rect key="frame" x="0.0" y="0.0" width="309" height="65"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="1vx-C5-AAO">
<fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
</view>
<constraints>
<constraint firstItem="1vx-C5-AAO" firstAttribute="leading" secondItem="Eqn-FQ-8Sv" secondAttribute="leading" constant="15" id="hC4-dW-fKl"/>
<constraint firstItem="1vx-C5-AAO" firstAttribute="centerY" secondItem="Eqn-FQ-8Sv" secondAttribute="centerY" id="jSJ-a7-q5U"/>
</constraints>
<connections>
<outlet property="textLabel" destination="1vx-C5-AAO" id="QUu-x5-Hgm"/>
</connections>
</collectionViewCell>
</cells>
</collectionView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="LKS-vo-Ytk" firstAttribute="top" secondItem="s2P-10-T78" secondAttribute="top" id="IQP-dj-gaM"/>
<constraint firstItem="LKS-vo-Ytk" firstAttribute="leading" secondItem="s2P-10-T78" secondAttribute="leading" id="cc8-Hj-dNE"/>
<constraint firstAttribute="bottom" secondItem="LKS-vo-Ytk" secondAttribute="bottom" id="hhH-sV-DXp"/>
<constraint firstAttribute="trailing" secondItem="LKS-vo-Ytk" secondAttribute="trailing" id="tnZ-7G-n7P"/>
</constraints>
</view>
<connections>
<outlet property="collectionView" destination="LKS-vo-Ytk" id="rhv-M3-HDp"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="WwB-xb-Qef" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-146.40000000000001" y="90.404797601199405"/>
</scene>
<!--Single Section Storyboard View Controller-->
<scene sceneID="VLx-Fb-fo0">
<objects>
<viewController storyboardIdentifier="singleSectionDemo" id="frc-YL-WX9" customClass="SingleSectionStoryboardViewController" customModule="IGListKitExamples" customModuleProvider="target" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="VaC-h1-D9B"/>
<viewControllerLayoutGuide type="bottom" id="jSR-p6-C72"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="bMx-bC-IhF">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" dataMode="prototypes" translatesAutoresizingMaskIntoConstraints="NO" id="Lqf-9C-lS3" customClass="IGListCollectionView">
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<collectionViewFlowLayout key="collectionViewLayout" minimumLineSpacing="10" minimumInteritemSpacing="10" id="vuu-gE-rAa">
<size key="itemSize" width="309" height="65"/>
<size key="headerReferenceSize" width="0.0" height="0.0"/>
<size key="footerReferenceSize" width="0.0" height="0.0"/>
<inset key="sectionInset" minX="0.0" minY="0.0" maxX="0.0" maxY="0.0"/>
</collectionViewFlowLayout>
<cells>
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="cell" id="fD7-7i-CX0" customClass="StoryboardCell" customModule="IGListKitExamples" customModuleProvider="target">
<rect key="frame" x="33" y="0.0" width="309" height="65"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
<rect key="frame" x="0.0" y="0.0" width="309" height="65"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="y2N-aR-93q">
<fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
</view>
<constraints>
<constraint firstItem="y2N-aR-93q" firstAttribute="leading" secondItem="fD7-7i-CX0" secondAttribute="leading" constant="15" id="kVn-2C-bNo"/>
<constraint firstItem="y2N-aR-93q" firstAttribute="centerY" secondItem="fD7-7i-CX0" secondAttribute="centerY" id="zXx-Fd-B4q"/>
</constraints>
<connections>
<outlet property="textLabel" destination="y2N-aR-93q" id="SPh-KG-DJQ"/>
</connections>
</collectionViewCell>
</cells>
</collectionView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="Lqf-9C-lS3" firstAttribute="leading" secondItem="bMx-bC-IhF" secondAttribute="leading" id="2B9-1H-mjw"/>
<constraint firstItem="Lqf-9C-lS3" firstAttribute="top" secondItem="bMx-bC-IhF" secondAttribute="top" id="4rw-Vn-NT0"/>
<constraint firstAttribute="trailing" secondItem="Lqf-9C-lS3" secondAttribute="trailing" id="6St-9C-UOf"/>
<constraint firstAttribute="bottom" secondItem="Lqf-9C-lS3" secondAttribute="bottom" id="Hwt-35-Ha0"/>
</constraints>
</view>
<connections>
<outlet property="collectionView" destination="Lqf-9C-lS3" id="me8-q7-8f5"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="T5T-i5-O9g" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-825" y="90"/>
</scene>
</scenes>
</document>
29 changes: 29 additions & 0 deletions Example/IGListKitExamples.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@
2991F9301D7BC0E400B0C58F /* EmptyViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2991F92F1D7BC0E400B0C58F /* EmptyViewController.swift */; };
299B54001D6BD6630074A202 /* SearchViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 299B53FF1D6BD6630074A202 /* SearchViewController.swift */; };
814F1E00410200822610BB49 /* Pods_IGListKitExamples.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 52A8DC2D07A93D7AA55BC993 /* Pods_IGListKitExamples.framework */; };
821BC4B41DB8B25B00172ED0 /* Demo.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 821BC4B31DB8B25B00172ED0 /* Demo.storyboard */; };
821BC4B61DB8B3DC00172ED0 /* StoryboardViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 821BC4B51DB8B3DC00172ED0 /* StoryboardViewController.swift */; };
821BC4B81DB8B48300172ED0 /* StoryboardCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 821BC4B71DB8B48300172ED0 /* StoryboardCell.swift */; };
821BC4BA1DB8B61200172ED0 /* StoryboardLabelSectionController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 821BC4B91DB8B61200172ED0 /* StoryboardLabelSectionController.swift */; };
82D91B691DBA0EF300E62758 /* SingleSectionStoryboardViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 82D91B681DBA0EF300E62758 /* SingleSectionStoryboardViewController.swift */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
Expand Down Expand Up @@ -79,6 +84,11 @@
299B53FF1D6BD6630074A202 /* SearchViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SearchViewController.swift; sourceTree = "<group>"; };
4125DCD99578FDEF3C373BA0 /* Pods-IGListKitExamples.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-IGListKitExamples.release.xcconfig"; path = "Pods/Target Support Files/Pods-IGListKitExamples/Pods-IGListKitExamples.release.xcconfig"; sourceTree = "<group>"; };
52A8DC2D07A93D7AA55BC993 /* Pods_IGListKitExamples.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_IGListKitExamples.framework; sourceTree = BUILT_PRODUCTS_DIR; };
821BC4B31DB8B25B00172ED0 /* Demo.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Demo.storyboard; sourceTree = "<group>"; };
821BC4B51DB8B3DC00172ED0 /* StoryboardViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StoryboardViewController.swift; sourceTree = "<group>"; };
821BC4B71DB8B48300172ED0 /* StoryboardCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StoryboardCell.swift; sourceTree = "<group>"; };
821BC4B91DB8B61200172ED0 /* StoryboardLabelSectionController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StoryboardLabelSectionController.swift; sourceTree = "<group>"; };
82D91B681DBA0EF300E62758 /* SingleSectionStoryboardViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SingleSectionStoryboardViewController.swift; sourceTree = "<group>"; };
FE05AB853448A0705AF80427 /* Pods-IGListKitExamples.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-IGListKitExamples.debug.xcconfig"; path = "Pods/Target Support Files/Pods-IGListKitExamples/Pods-IGListKitExamples.debug.xcconfig"; sourceTree = "<group>"; };
/* End PBXFileReference section */

Expand Down Expand Up @@ -114,6 +124,7 @@
2942FF891D9F39E00015D24B /* RemoveSectionController.swift */,
2942FF8A1D9F39E00015D24B /* SearchSectionController.swift */,
2942FF8B1D9F39E00015D24B /* UserSectionController.swift */,
821BC4B91DB8B61200172ED0 /* StoryboardLabelSectionController.swift */,
2981BA361DB869FF00A987F9 /* WorkingRangeSectionController.swift */,
);
path = SectionControllers;
Expand Down Expand Up @@ -148,6 +159,7 @@
2942FF821D9F39E00015D24B /* SectionControllers */,
2961B3A31D68B0B5001C9451 /* ViewControllers */,
2961B3A61D68B0B5001C9451 /* Views */,
822B29F21DB8AA4700010000 /* Storyboard */,
);
path = IGListKitExamples;
sourceTree = "<group>";
Expand All @@ -162,7 +174,9 @@
2991F9231D7BB89F00B0C58F /* NestedAdapterViewController.swift */,
299B53FF1D6BD6630074A202 /* SearchViewController.swift */,
26271C8D1DAE9D3F0073E116 /* SingleSectionViewController.swift */,
821BC4B51DB8B3DC00172ED0 /* StoryboardViewController.swift */,
2981BA381DB874BB00A987F9 /* WorkingRangeViewController.swift */,
82D91B681DBA0EF300E62758 /* SingleSectionStoryboardViewController.swift */,
);
path = ViewControllers;
sourceTree = "<group>";
Expand All @@ -179,6 +193,7 @@
2961B3A81D68B0B5001C9451 /* SpinnerCell.swift */,
26271C931DAE9F050073E116 /* NibCell.swift */,
26271C911DAE9EFC0073E116 /* NibCell.xib */,
821BC4B71DB8B48300172ED0 /* StoryboardCell.swift */,
2981BA341DB868A500A987F9 /* ImageCell.swift */,
);
path = Views;
Expand All @@ -201,6 +216,15 @@
name = Pods;
sourceTree = "<group>";
};
822B29F21DB8AA4700010000 /* Storyboard */ = {
isa = PBXGroup;
children = (
821BC4B31DB8B25B00172ED0 /* Demo.storyboard */,
);
name = Storyboard;
path = ..;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
Expand Down Expand Up @@ -267,6 +291,7 @@
2961B3981D68B031001C9451 /* LaunchScreen.storyboard in Resources */,
26271C921DAE9EFC0073E116 /* NibCell.xib in Resources */,
2961B3951D68B031001C9451 /* Assets.xcassets in Resources */,
821BC4B41DB8B25B00172ED0 /* Demo.storyboard in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -332,6 +357,7 @@
2942FF8C1D9F39E00015D24B /* DemoSectionController.swift in Sources */,
2981BA351DB868A500A987F9 /* ImageCell.swift in Sources */,
2942FF931D9F39E00015D24B /* SearchSectionController.swift in Sources */,
82D91B691DBA0EF300E62758 /* SingleSectionStoryboardViewController.swift in Sources */,
2942FF911D9F39E00015D24B /* LabelSectionController.swift in Sources */,
2981BA391DB874BB00A987F9 /* WorkingRangeViewController.swift in Sources */,
2961B3AC1D68B0B5001C9451 /* LoadMoreViewController.swift in Sources */,
Expand All @@ -347,13 +373,16 @@
2942FF8D1D9F39E00015D24B /* EmbeddedSectionController.swift in Sources */,
2991F9281D7BB9EC00B0C58F /* EmbeddedCollectionViewCell.swift in Sources */,
2942FF8F1D9F39E00015D24B /* GridSectionController.swift in Sources */,
821BC4B81DB8B48300172ED0 /* StoryboardCell.swift in Sources */,
2942FF921D9F39E00015D24B /* RemoveSectionController.swift in Sources */,
26271C8E1DAE9D3F0073E116 /* SingleSectionViewController.swift in Sources */,
2961B3AD1D68B0B5001C9451 /* LabelCell.swift in Sources */,
2942FF901D9F39E00015D24B /* HorizontalSectionController.swift in Sources */,
2981BA371DB869FF00A987F9 /* WorkingRangeSectionController.swift in Sources */,
2961B3AB1D68B0B5001C9451 /* DemosViewController.swift in Sources */,
821BC4B61DB8B3DC00172ED0 /* StoryboardViewController.swift in Sources */,
2942FF8E1D9F39E00015D24B /* ExpandableSectionController.swift in Sources */,
821BC4BA1DB8B61200172ED0 /* StoryboardLabelSectionController.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
Loading

0 comments on commit 8855b51

Please sign in to comment.