Compare commits

...
30 Commits
Author SHA1 Message Date
Alex.k 307d2d8951 deployment target -> 9.0 2016-10-14 10:29:08 +03:00
Alex.k c2cb27dc85 updated readme 2016-10-14 10:25:37 +03:00
Alex.k 5f30473885 update readme 2016-10-10 16:58:23 +03:00
Alex 0ad7a826d1 Merge pull request #37 from EckoEdc/patch-1
Mark method from UICollectionViewDataSource open
2016-10-10 16:47:02 +03:00
Edric 3e98254fbd Mark method from UICollectionViewDataSource open
This fix compiling error:  override of non open method.
(Seen using Carthage)
2016-10-10 09:25:01 -04:00
Alex.k 83090712f9 update readme 2016-09-30 17:18:39 +03:00
Alex.k 3fbf9587c6 update podspec 2016-09-30 17:11:34 +03:00
Alex.k 027307c052 fixed transition bug 2016-09-30 17:08:49 +03:00
Alex.k 9b2acb1630 converted to swift 3 2016-09-30 15:45:33 +03:00
aleksei1000000 910117cea9 Update README.md 2016-09-29 17:15:39 +03:00
Juri Vasylenko 57f66ff374 Update README.md 2016-08-05 12:18:26 +04:00
Juri Vasylenko 31c6bb617c Update README.md 2016-07-29 16:16:21 +04:00
Juri Vasylenko ab91671d73 Merge pull request #23 from aleksei1000000/patch-1
Update README.md
2016-07-21 15:39:03 +04:00
aleksei1000000 16d082b749 Update README.md 2016-07-21 14:35:48 +03:00
aleksei1000000 36fc87a449 Update README.md 2016-07-21 12:05:53 +03:00
Alex.k 323379b216 update podspec 2016-06-16 09:03:58 +03:00
Alex 25d94360e1 Merge pull request #21 from imaccallum/master
Fixed indefinite cell growth
2016-06-16 06:01:58 +00:00
Ian MacCallum b0e7cc7f0c Fixed indefinite cell growth 2016-06-15 23:01:24 -04:00
Alex.k 169f1bb59f update docs 2016-06-10 10:12:59 +03:00
Alex.k 65344f8c34 update readme 2016-06-10 10:10:11 +03:00
Alex.k 3e9e629839 update readme 2016-06-08 16:37:30 +03:00
Alex.k 8cb5e56d70 update podspec 2016-06-08 16:28:29 +03:00
Alex.k fdea171402 Fixes #18 2016-06-08 16:22:41 +03:00
Alex.k 956a270b1e update podspec 2016-06-08 14:42:29 +03:00
Alex.k b832f9e372 Fixes #17 2016-06-08 14:40:44 +03:00
Alex aa66607cbd Merge pull request #15 from Dershowitz011/master
Readme fixed again.. -_-
2016-06-07 13:38:40 +00:00
Alex.k 2ef07885b7 update podspec 2016-06-07 16:31:37 +03:00
Alex.k d89e99654f Fixes #14 2016-06-07 16:29:44 +03:00
Shantanu R Desai c91a711dd8 Readme fixed again.. -_- 2016-06-07 17:51:18 +05:30
Alex.k a003cc01d1 update readme 2016-06-07 11:37:26 +03:00
36 changed files with 781 additions and 415 deletions
@@ -488,20 +488,23 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0730;
LastUpgradeCheck = 0730;
LastUpgradeCheck = 0800;
ORGANIZATIONNAME = "Alex K.";
TargetAttributes = {
848596271CF585F3000BCC74 = {
CreatedOnToolsVersion = 7.3.1;
DevelopmentTeam = LEAZS7L33U;
DevelopmentTeam = 34MUF9YXTA;
LastSwiftMigration = 0800;
};
8485963B1CF585F3000BCC74 = {
CreatedOnToolsVersion = 7.3.1;
LastSwiftMigration = 0800;
TestTargetID = 848596271CF585F3000BCC74;
};
8499D8131D001B82004B5B37 = {
CreatedOnToolsVersion = 7.3.1;
DevelopmentTeam = LEAZS7L33U;
LastSwiftMigration = 0800;
};
};
};
@@ -673,8 +676,10 @@
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
@@ -696,7 +701,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.3;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
@@ -718,8 +723,10 @@
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
@@ -735,9 +742,10 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.3;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
VALIDATE_PRODUCT = YES;
};
name = Release;
@@ -745,32 +753,36 @@
848596461CF585F3000BCC74 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
EMBEDDED_CONTENT_CONTAINS_SWIFT = YES;
DEVELOPMENT_TEAM = 34MUF9YXTA;
INFOPLIST_FILE = DemoExpandingCollection/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.ramotion.DemoExpandingCollection;
PRODUCT_BUNDLE_IDENTIFIER = com.ramotion.dev1;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
SWIFT_VERSION = 3.0;
};
name = Debug;
};
848596471CF585F3000BCC74 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
EMBEDDED_CONTENT_CONTAINS_SWIFT = YES;
DEVELOPMENT_TEAM = 34MUF9YXTA;
INFOPLIST_FILE = DemoExpandingCollection/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.ramotion.DemoExpandingCollection;
PRODUCT_BUNDLE_IDENTIFIER = com.ramotion.dev1;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
SWIFT_VERSION = 3.0;
};
name = Release;
};
@@ -782,6 +794,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.ramotion.DemoExpandingCollectionTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/DemoExpandingCollection.app/DemoExpandingCollection";
};
name = Debug;
@@ -794,6 +807,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.ramotion.DemoExpandingCollectionTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/DemoExpandingCollection.app/DemoExpandingCollection";
};
name = Release;
@@ -802,7 +816,7 @@
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
CURRENT_PROJECT_VERSION = 1;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
@@ -810,11 +824,12 @@
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = ExpandingCollection/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.ramotion.dev;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_VERSION = 3.0;
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
@@ -825,7 +840,7 @@
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
CURRENT_PROJECT_VERSION = 1;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
@@ -833,11 +848,12 @@
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = ExpandingCollection/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.ramotion.dev;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_VERSION = 3.0;
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0730"
LastUpgradeVersion = "0800"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@@ -14,44 +14,43 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
configureNavigationTabBar()
return true
}
func applicationWillResignActive(application: UIApplication) {
func applicationWillResignActive(_ application: UIApplication) {
}
func applicationDidEnterBackground(application: UIApplication) {
func applicationDidEnterBackground(_ application: UIApplication) {
}
func applicationWillEnterForeground(application: UIApplication) {
func applicationWillEnterForeground(_ application: UIApplication) {
}
func applicationDidBecomeActive(application: UIApplication) {
func applicationDidBecomeActive(_ application: UIApplication) {
}
func applicationWillTerminate(application: UIApplication) {
func applicationWillTerminate(_ application: UIApplication) {
}
}
extension AppDelegate {
private func configureNavigationTabBar() {
fileprivate func configureNavigationTabBar() {
//transparent background
UINavigationBar.appearance().setBackgroundImage(UIImage(), forBarMetrics: .Default)
UINavigationBar.appearance().setBackgroundImage(UIImage(), for: .default)
UINavigationBar.appearance().shadowImage = UIImage()
UINavigationBar.appearance().translucent = true
UINavigationBar.appearance().isTranslucent = true
let shadow = NSShadow()
shadow.shadowOffset = CGSize(width: 0, height: 2)
shadow.shadowColor = UIColor(red: 0, green: 0, blue: 0, alpha: 0.1)
// shadow.shadowOffset = k
UINavigationBar.appearance().titleTextAttributes = [
NSForegroundColorAttributeName : UIColor.whiteColor(),
NSForegroundColorAttributeName : UIColor.white,
NSShadowAttributeName: shadow
]
}
@@ -1,9 +1,10 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10117" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="L1n-Ia-Jrw">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11201" systemVersion="15G1004" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="L1n-Ia-Jrw">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11161"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--Demo View Controller-->
@@ -15,20 +16,17 @@
<viewControllerLayoutGuide type="bottom" id="mRg-Mx-OVI"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="CO1-du-RsN">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="BackgroundImage" translatesAutoresizingMaskIntoConstraints="NO" id="o88-Ae-QCA">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
</imageView>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="BackgroundImage" translatesAutoresizingMaskIntoConstraints="NO" id="o88-Ae-QCA"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="1/15" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Irl-Rb-fcB">
<rect key="frame" x="285" y="559" width="31" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.85882352941176465" green="0.8666666666666667" blue="0.87058823529411766" alpha="1" colorSpace="calibratedRGB"/>
<color key="textColor" red="0.85882352941176465" green="0.8666666666666667" blue="0.87058823529411766" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="mRg-Mx-OVI" firstAttribute="top" secondItem="Irl-Rb-fcB" secondAttribute="bottom" constant="20" id="2LM-iO-324"/>
<constraint firstItem="o88-Ae-QCA" firstAttribute="top" secondItem="CpK-wn-s3i" secondAttribute="bottom" constant="-44" id="MHx-PV-wBs"/>
@@ -42,18 +40,17 @@
<nil key="title"/>
<barButtonItem key="leftBarButtonItem" image="searchIcon" id="xuF-jX-6LN"/>
<view key="titleView" contentMode="scaleToFill" id="U0J-H7-fvX">
<rect key="frame" x="180" y="6" width="240" height="33"/>
<rect key="frame" x="68" y="6" width="240" height="33"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="Title" translatesAutoresizingMaskIntoConstraints="NO" id="92b-RV-q6w">
<rect key="frame" x="95" y="9" width="51" height="16"/>
<constraints>
<constraint firstAttribute="width" constant="51" id="E8y-UB-H4U"/>
<constraint firstAttribute="height" constant="16" id="FBz-Jg-2za"/>
</constraints>
</imageView>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="92b-RV-q6w" firstAttribute="centerX" secondItem="U0J-H7-fvX" secondAttribute="centerX" id="kLZ-Jr-wTP"/>
<constraint firstItem="92b-RV-q6w" firstAttribute="centerY" secondItem="U0J-H7-fvX" secondAttribute="centerY" id="qaL-Bm-FyO"/>
@@ -102,33 +99,29 @@
<objects>
<tableViewController storyboardIdentifier="DemoTableViewController" automaticallyAdjustsScrollViewInsets="NO" id="7RW-i0-HfN" customClass="DemoTableViewController" customModule="DemoExpandingCollection" customModuleProvider="target" sceneMemberID="viewController">
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" dataMode="static" style="plain" separatorStyle="none" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" id="2SU-lJ-2AP">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<sections>
<tableViewSection id="IIl-eL-sK9">
<cells>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="CustomTableViewCell" rowHeight="124" id="SFA-X2-Rbf">
<rect key="frame" x="0.0" y="0.0" width="600" height="124"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="124"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="SFA-X2-Rbf" id="RQr-Ti-ps0">
<rect key="frame" x="0.0" y="0.0" width="600" height="124"/>
<frame key="frameInset" width="375" height="124"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="map" translatesAutoresizingMaskIntoConstraints="NO" id="MOR-g7-Roh">
<rect key="frame" x="0.0" y="0.0" width="600" height="124"/>
</imageView>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="map" translatesAutoresizingMaskIntoConstraints="NO" id="MOR-g7-Roh"/>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="stars" translatesAutoresizingMaskIntoConstraints="NO" id="u4E-kh-oBd">
<rect key="frame" x="40" y="92" width="77" height="12"/>
<constraints>
<constraint firstAttribute="width" constant="77" id="fcy-Ae-Cqj"/>
<constraint firstAttribute="height" constant="12" id="r69-to-MYP"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="La Crescenta-Montrose, CA91020 Glendale
NO. 7911847" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Xh7-la-W1r">
<rect key="frame" x="40" y="48" width="552" height="27"/>
<fontDescription key="fontDescription" type="system" pointSize="11"/>
<color key="textColor" red="0.49803921568627452" green="0.51764705882352935" blue="0.53725490196078429" alpha="1" colorSpace="calibratedRGB"/>
<color key="textColor" red="0.49803921568627452" green="0.51764705882352935" blue="0.53725490196078429" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
@@ -146,42 +139,36 @@
</tableViewCellContentView>
</tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" rowHeight="124" id="ew1-hI-ark">
<rect key="frame" x="0.0" y="124" width="600" height="124"/>
<rect key="frame" x="0.0" y="124" width="375" height="124"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="ew1-hI-ark" id="tMC-aw-BE2">
<rect key="frame" x="0.0" y="0.0" width="600" height="124"/>
<frame key="frameInset" width="375" height="124"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="face2" translatesAutoresizingMaskIntoConstraints="NO" id="9zL-0u-FrF">
<rect key="frame" x="40" y="20" width="40" height="40"/>
<constraints>
<constraint firstAttribute="width" constant="40" id="78B-o8-UlD"/>
<constraint firstAttribute="height" constant="40" id="b9d-Vi-STe"/>
</constraints>
</imageView>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="heand" translatesAutoresizingMaskIntoConstraints="NO" id="Nk4-8x-Lwg">
<rect key="frame" x="524" y="34" width="14" height="13"/>
</imageView>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="heand" translatesAutoresizingMaskIntoConstraints="NO" id="Nk4-8x-Lwg"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Peter Allan" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="KVC-Pp-S9H">
<rect key="frame" x="108" y="31" width="74" height="18"/>
<fontDescription key="fontDescription" type="system" pointSize="15"/>
<color key="textColor" red="0.41960784313725491" green="0.41960784313725491" blue="0.41960784313725491" alpha="1" colorSpace="calibratedRGB"/>
<color key="textColor" red="0.41960784313725491" green="0.41960784313725491" blue="0.41960784313725491" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="FEB 14th" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="UAK-of-lpJ">
<rect key="frame" x="219" y="34" width="43" height="12"/>
<fontDescription key="fontDescription" type="system" pointSize="10"/>
<color key="textColor" red="0.76470588235294112" green="0.76470588235294112" blue="0.76470588235294112" alpha="1" colorSpace="calibratedRGB"/>
<color key="textColor" red="0.76470588235294112" green="0.76470588235294112" blue="0.76470588235294112" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="3" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="2zo-A7-sbM">
<rect key="frame" x="40" y="57" width="498" height="59"/>
<constraints>
<constraint firstAttribute="height" constant="59" id="zel-Yy-v9k"/>
</constraints>
<string key="text">The federal beach atc requires states that receive funding to develop a risk-based beach evaluation and classification plan and apply it to</string>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<color key="textColor" red="0.44313725490196076" green="0.44313725490196076" blue="0.44313725490196076" alpha="1" colorSpace="calibratedRGB"/>
<color key="textColor" red="0.44313725490196076" green="0.44313725490196076" blue="0.44313725490196076" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
@@ -201,42 +188,36 @@
</tableViewCellContentView>
</tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" rowHeight="124" id="0ee-7A-I2I">
<rect key="frame" x="0.0" y="248" width="600" height="124"/>
<rect key="frame" x="0.0" y="248" width="375" height="124"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="0ee-7A-I2I" id="jPx-eH-c2S">
<rect key="frame" x="0.0" y="0.0" width="600" height="124"/>
<frame key="frameInset" width="375" height="124"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="face1" translatesAutoresizingMaskIntoConstraints="NO" id="T8j-gX-HQZ">
<rect key="frame" x="40" y="20" width="40" height="40"/>
<constraints>
<constraint firstAttribute="height" constant="40" id="AKq-2T-BRC"/>
<constraint firstAttribute="width" constant="40" id="lAw-yT-R7T"/>
</constraints>
</imageView>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="heand" translatesAutoresizingMaskIntoConstraints="NO" id="szO-5V-CyH">
<rect key="frame" x="524" y="34" width="14" height="13"/>
</imageView>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="heand" translatesAutoresizingMaskIntoConstraints="NO" id="szO-5V-CyH"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Amada Iin" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="UEu-Ap-Kms">
<rect key="frame" x="108" y="31" width="68" height="18"/>
<fontDescription key="fontDescription" type="system" pointSize="15"/>
<color key="textColor" red="0.41960784309999999" green="0.41960784309999999" blue="0.41960784309999999" alpha="1" colorSpace="calibratedRGB"/>
<color key="textColor" red="0.41960784309999999" green="0.41960784309999999" blue="0.41960784309999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="FEB 14th" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="7hI-Qw-bUn">
<rect key="frame" x="213" y="34" width="43" height="12"/>
<fontDescription key="fontDescription" type="system" pointSize="10"/>
<color key="textColor" red="0.76470588240000004" green="0.76470588240000004" blue="0.76470588240000004" alpha="1" colorSpace="calibratedRGB"/>
<color key="textColor" red="0.76470588240000004" green="0.76470588240000004" blue="0.76470588240000004" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="3" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="rkV-jC-tTs">
<rect key="frame" x="40" y="57" width="498" height="59"/>
<constraints>
<constraint firstAttribute="height" constant="59" id="pYw-qC-eUH"/>
</constraints>
<string key="text">The federal beach atc requires states that receive funding to develop a risk-based beach evaluation and classification plan and apply it to</string>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<color key="textColor" red="0.4431372549" green="0.4431372549" blue="0.4431372549" alpha="1" colorSpace="calibratedRGB"/>
<color key="textColor" red="0.4431372549" green="0.4431372549" blue="0.4431372549" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
@@ -256,42 +237,36 @@
</tableViewCellContentView>
</tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" rowHeight="124" id="fTH-KP-Ac5">
<rect key="frame" x="0.0" y="372" width="600" height="124"/>
<rect key="frame" x="0.0" y="372" width="375" height="124"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="fTH-KP-Ac5" id="BGd-Mp-TnE">
<rect key="frame" x="0.0" y="0.0" width="600" height="124"/>
<frame key="frameInset" width="375" height="124"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="face2" translatesAutoresizingMaskIntoConstraints="NO" id="l6O-iU-Deh">
<rect key="frame" x="40" y="20" width="40" height="40"/>
<constraints>
<constraint firstAttribute="height" constant="40" id="Wvu-NC-dmu"/>
<constraint firstAttribute="width" constant="40" id="goR-UO-N7g"/>
</constraints>
</imageView>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="heand" translatesAutoresizingMaskIntoConstraints="NO" id="ceS-Mg-PrP">
<rect key="frame" x="524" y="34" width="14" height="13"/>
</imageView>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="heand" translatesAutoresizingMaskIntoConstraints="NO" id="ceS-Mg-PrP"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Peter Allan" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="a3U-of-sdv">
<rect key="frame" x="108" y="31" width="74" height="18"/>
<fontDescription key="fontDescription" type="system" pointSize="15"/>
<color key="textColor" red="0.41960784309999999" green="0.41960784309999999" blue="0.41960784309999999" alpha="1" colorSpace="calibratedRGB"/>
<color key="textColor" red="0.41960784309999999" green="0.41960784309999999" blue="0.41960784309999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="FEB 14th" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="h3x-N2-MWJ">
<rect key="frame" x="219" y="34" width="43" height="12"/>
<fontDescription key="fontDescription" type="system" pointSize="10"/>
<color key="textColor" red="0.76470588240000004" green="0.76470588240000004" blue="0.76470588240000004" alpha="1" colorSpace="calibratedRGB"/>
<color key="textColor" red="0.76470588240000004" green="0.76470588240000004" blue="0.76470588240000004" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="3" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="3ZN-4l-hGa">
<rect key="frame" x="40" y="57" width="498" height="59"/>
<constraints>
<constraint firstAttribute="height" constant="59" id="z9M-6w-uYi"/>
</constraints>
<string key="text">The federal beach atc requires states that receive funding to develop a risk-based beach evaluation and classification plan and apply it to</string>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<color key="textColor" red="0.4431372549" green="0.4431372549" blue="0.4431372549" alpha="1" colorSpace="calibratedRGB"/>
<color key="textColor" red="0.4431372549" green="0.4431372549" blue="0.4431372549" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
@@ -311,42 +286,36 @@
</tableViewCellContentView>
</tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" rowHeight="124" id="irZ-0L-X9r">
<rect key="frame" x="0.0" y="496" width="600" height="124"/>
<rect key="frame" x="0.0" y="496" width="375" height="124"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="irZ-0L-X9r" id="t3x-Eb-ktg">
<rect key="frame" x="0.0" y="0.0" width="600" height="124"/>
<frame key="frameInset" width="375" height="124"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="face1" translatesAutoresizingMaskIntoConstraints="NO" id="SY0-ki-F5U">
<rect key="frame" x="40" y="20" width="40" height="40"/>
<constraints>
<constraint firstAttribute="width" constant="40" id="1XW-AC-9LK"/>
<constraint firstAttribute="height" constant="40" id="jDR-B8-a7U"/>
</constraints>
</imageView>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="heand" translatesAutoresizingMaskIntoConstraints="NO" id="g7r-dJ-em9">
<rect key="frame" x="524" y="34" width="14" height="13"/>
</imageView>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="heand" translatesAutoresizingMaskIntoConstraints="NO" id="g7r-dJ-em9"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Amada Iin" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="0sx-fO-Xiy">
<rect key="frame" x="108" y="31" width="68" height="18"/>
<fontDescription key="fontDescription" type="system" pointSize="15"/>
<color key="textColor" red="0.41960784309999999" green="0.41960784309999999" blue="0.41960784309999999" alpha="1" colorSpace="calibratedRGB"/>
<color key="textColor" red="0.41960784309999999" green="0.41960784309999999" blue="0.41960784309999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="FEB 14th" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="SVA-lD-IQs">
<rect key="frame" x="213" y="34" width="43" height="12"/>
<fontDescription key="fontDescription" type="system" pointSize="10"/>
<color key="textColor" red="0.76470588240000004" green="0.76470588240000004" blue="0.76470588240000004" alpha="1" colorSpace="calibratedRGB"/>
<color key="textColor" red="0.76470588240000004" green="0.76470588240000004" blue="0.76470588240000004" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="3" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="kYn-LQ-ReD">
<rect key="frame" x="40" y="57" width="498" height="59"/>
<constraints>
<constraint firstAttribute="height" constant="59" id="sMt-dP-LYh"/>
</constraints>
<string key="text">The federal beach atc requires states that receive funding to develop a risk-based beach evaluation and classification plan and apply it to</string>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<color key="textColor" red="0.4431372549" green="0.4431372549" blue="0.4431372549" alpha="1" colorSpace="calibratedRGB"/>
<color key="textColor" red="0.4431372549" green="0.4431372549" blue="0.4431372549" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
@@ -366,42 +335,36 @@
</tableViewCellContentView>
</tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" rowHeight="124" id="Fj4-n4-S6M">
<rect key="frame" x="0.0" y="620" width="600" height="124"/>
<rect key="frame" x="0.0" y="620" width="375" height="124"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="Fj4-n4-S6M" id="D8J-AG-YUN">
<rect key="frame" x="0.0" y="0.0" width="600" height="124"/>
<frame key="frameInset" width="375" height="124"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="face2" translatesAutoresizingMaskIntoConstraints="NO" id="dRk-IE-zXs">
<rect key="frame" x="40" y="20" width="40" height="40"/>
<constraints>
<constraint firstAttribute="height" constant="40" id="KNl-fy-6Ga"/>
<constraint firstAttribute="width" constant="40" id="hN8-5E-akX"/>
</constraints>
</imageView>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="heand" translatesAutoresizingMaskIntoConstraints="NO" id="hz8-Cp-lQj">
<rect key="frame" x="524" y="34" width="14" height="13"/>
</imageView>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="heand" translatesAutoresizingMaskIntoConstraints="NO" id="hz8-Cp-lQj"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Peter Allan" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="YjL-xf-PcV">
<rect key="frame" x="108" y="31" width="74" height="18"/>
<fontDescription key="fontDescription" type="system" pointSize="15"/>
<color key="textColor" red="0.41960784309999999" green="0.41960784309999999" blue="0.41960784309999999" alpha="1" colorSpace="calibratedRGB"/>
<color key="textColor" red="0.41960784309999999" green="0.41960784309999999" blue="0.41960784309999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="FEB 14th" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="J4t-pX-zbM">
<rect key="frame" x="219" y="34" width="43" height="12"/>
<fontDescription key="fontDescription" type="system" pointSize="10"/>
<color key="textColor" red="0.76470588240000004" green="0.76470588240000004" blue="0.76470588240000004" alpha="1" colorSpace="calibratedRGB"/>
<color key="textColor" red="0.76470588240000004" green="0.76470588240000004" blue="0.76470588240000004" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="3" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Q6w-vY-gMp">
<rect key="frame" x="40" y="57" width="498" height="59"/>
<constraints>
<constraint firstAttribute="height" constant="59" id="T4M-G7-7hc"/>
</constraints>
<string key="text">The federal beach atc requires states that receive funding to develop a risk-based beach evaluation and classification plan and apply it to</string>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<color key="textColor" red="0.4431372549" green="0.4431372549" blue="0.4431372549" alpha="1" colorSpace="calibratedRGB"/>
<color key="textColor" red="0.4431372549" green="0.4431372549" blue="0.4431372549" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
@@ -432,18 +395,17 @@
<nil key="title"/>
<barButtonItem key="leftBarButtonItem" image="searchIcon" id="sSw-AG-wrF"/>
<view key="titleView" contentMode="scaleToFill" id="qyb-Fh-aIr" userLabel="Item View">
<rect key="frame" x="180" y="6" width="240" height="33"/>
<rect key="frame" x="68" y="6" width="240" height="33"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="Title" translatesAutoresizingMaskIntoConstraints="NO" id="a24-t2-9jd">
<rect key="frame" x="95" y="9" width="51" height="16"/>
<constraints>
<constraint firstAttribute="height" constant="16" id="5Zr-Wx-iQB"/>
<constraint firstAttribute="width" constant="51" id="RtX-4m-x9W"/>
</constraints>
</imageView>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="a24-t2-9jd" firstAttribute="centerX" secondItem="qyb-Fh-aIr" secondAttribute="centerX" id="sdW-OO-2BS"/>
<constraint firstItem="a24-t2-9jd" firstAttribute="centerY" secondItem="qyb-Fh-aIr" secondAttribute="centerY" id="xKF-DL-knz"/>
@@ -10,8 +10,8 @@ import UIKit
extension UICollectionView {
func getReusableCellWithIdentifier<T: UICollectionViewCell where T: CollectionViewCellIdentifiable>(indexPath: NSIndexPath) -> T {
guard let cell = dequeueReusableCellWithReuseIdentifier(T.cellIdentifier, forIndexPath: indexPath) as? T else {
func getReusableCellWithIdentifier<T: UICollectionViewCell>(_ indexPath: IndexPath) -> T where T: CollectionViewCellIdentifiable {
guard let cell = dequeueReusableCell(withReuseIdentifier: T.cellIdentifier, for: indexPath) as? T else {
fatalError("Couldn't instantiate view controller with identifier \(T.cellIdentifier) ")
}
@@ -27,7 +27,7 @@ protocol CollectionViewCellIdentifiable {
extension CollectionViewCellIdentifiable where Self: UICollectionViewCell {
static var cellIdentifier: String {
return String(self)
return String(describing: self)
}
}
@@ -14,16 +14,16 @@ extension UIStoryboard {
case Main
}
convenience init(storyboard: Storyboard, bundle: NSBundle? = nil) {
convenience init(storyboard: Storyboard, bundle: Bundle? = nil) {
self.init(name: storyboard.rawValue, bundle: bundle)
}
class func storyboard(storyboard: Storyboard, bundle: NSBundle? = nil) -> UIStoryboard {
class func storyboard(_ storyboard: Storyboard, bundle: Bundle? = nil) -> UIStoryboard {
return UIStoryboard(name: storyboard.rawValue, bundle: bundle)
}
func instantiateViewController<T: UIViewController where T: StoryboardIdentifiable>() -> T {
guard let viewController = instantiateViewControllerWithIdentifier(T.storyboardIdentifier) as? T else {
func instantiateViewController<T: UIViewController>() -> T where T: StoryboardIdentifiable {
guard let viewController = self.instantiateViewController(withIdentifier: T.storyboardIdentifier) as? T else {
fatalError("Couldn't instantiate view controller with identifier \(T.storyboardIdentifier) ")
}
@@ -41,6 +41,6 @@ protocol StoryboardIdentifiable {
extension StoryboardIdentifiable where Self: UIViewController {
static var storyboardIdentifier: String {
return String(self)
return String(describing: self)
}
}
@@ -10,7 +10,7 @@ import UIKit
class DemoTableViewController: ExpandingTableViewController {
private var scrollOffsetY: CGFloat = 0
fileprivate var scrollOffsetY: CGFloat = 0
override func viewDidLoad() {
super.viewDidLoad()
configureNavBar()
@@ -22,9 +22,9 @@ class DemoTableViewController: ExpandingTableViewController {
extension DemoTableViewController {
private func configureNavBar() {
navigationItem.leftBarButtonItem?.image = navigationItem.leftBarButtonItem?.image!.imageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal)
navigationItem.rightBarButtonItem?.image = navigationItem.rightBarButtonItem?.image!.imageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal)
fileprivate func configureNavBar() {
navigationItem.leftBarButtonItem?.image = navigationItem.leftBarButtonItem?.image!.withRenderingMode(UIImageRenderingMode.alwaysOriginal)
navigationItem.rightBarButtonItem?.image = navigationItem.rightBarButtonItem?.image!.withRenderingMode(UIImageRenderingMode.alwaysOriginal)
}
}
@@ -32,7 +32,7 @@ extension DemoTableViewController {
extension DemoTableViewController {
@IBAction func backButtonHandler(sender: AnyObject) {
@IBAction func backButtonHandler(_ sender: AnyObject) {
// buttonAnimation
let viewControllers: [DemoViewController?] = navigationController?.viewControllers.map { $0 as? DemoViewController } ?? []
@@ -49,18 +49,18 @@ extension DemoTableViewController {
extension DemoTableViewController {
override func scrollViewDidScroll(scrollView: UIScrollView) {
if scrollView.contentOffset.y < -25 {
// buttonAnimation
let viewControllers: [DemoViewController?] = navigationController?.viewControllers.map { $0 as? DemoViewController } ?? []
for viewController in viewControllers {
if let rightButton = viewController?.navigationItem.rightBarButtonItem as? AnimatingBarButton {
rightButton.animationSelected(false)
}
}
popTransitionAnimation()
}
override func scrollViewDidScroll(_ scrollView: UIScrollView) {
// if scrollView.contentOffset.y < -25 {
// // buttonAnimation
// let viewControllers: [DemoViewController?] = navigationController?.viewControllers.map { $0 as? DemoViewController } ?? []
//
// for viewController in viewControllers {
// if let rightButton = viewController?.navigationItem.rightBarButtonItem as? AnimatingBarButton {
// rightButton.animationSelected(false)
// }
// }
// popTransitionAnimation()
// }
scrollOffsetY = scrollView.contentOffset.y
}
@@ -1,8 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="10117" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11201" systemVersion="15G1004" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11161"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
@@ -12,45 +13,40 @@
<autoresizingMask key="autoresizingMask"/>
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
<rect key="frame" x="0.0" y="0.0" width="256" height="335"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="rbd-6U-uYZ">
<rect key="frame" x="0.0" y="0.0" width="256" height="335"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="icons" translatesAutoresizingMaskIntoConstraints="NO" id="7zK-Le-Npw">
<rect key="frame" x="20" y="287" width="116" height="40"/>
<constraints>
<constraint firstAttribute="width" constant="116" id="7hq-gd-WaT"/>
<constraint firstAttribute="height" constant="40" id="cUH-6u-zMD"/>
</constraints>
</imageView>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="dots" translatesAutoresizingMaskIntoConstraints="NO" id="Au6-h8-xBa">
<rect key="frame" x="228" y="298" width="4" height="19"/>
<constraints>
<constraint firstAttribute="height" constant="19" id="KJW-6L-1Ol"/>
<constraint firstAttribute="width" constant="4" id="YcW-cL-JpF"/>
</constraints>
</imageView>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="stars" translatesAutoresizingMaskIntoConstraints="NO" id="l9V-6B-rdj">
<rect key="frame" x="159" y="266" width="77" height="12"/>
<constraints>
<constraint firstAttribute="height" constant="12" id="Nl5-u6-NGX"/>
<constraint firstAttribute="width" constant="77" id="NwE-fo-yyB"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="NO. 7911847" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="pMH-Qa-ClW">
<rect key="frame" x="24" y="265" width="68" height="14"/>
<fontDescription key="fontDescription" type="system" pointSize="11"/>
<color key="textColor" red="0.49803921568627452" green="0.51764705882352935" blue="0.53725490196078429" alpha="1" colorSpace="calibratedRGB"/>
<color key="textColor" red="0.49803921568627452" green="0.51764705882352935" blue="0.53725490196078429" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="La Crescenta-Montrose, CA91020" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="eC4-wU-lTH">
<rect key="frame" x="39" y="240" width="179" height="14"/>
<fontDescription key="fontDescription" type="system" pointSize="11"/>
<color key="textColor" red="0.49803921569999998" green="0.51764705879999995" blue="0.53725490200000003" alpha="1" colorSpace="calibratedRGB"/>
<color key="textColor" red="0.49803921569999998" green="0.51764705879999995" blue="0.53725490200000003" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="Au6-h8-xBa" firstAttribute="top" secondItem="l9V-6B-rdj" secondAttribute="bottom" constant="20" id="1qd-Em-ZT9"/>
<constraint firstItem="pMH-Qa-ClW" firstAttribute="leading" secondItem="rbd-6U-uYZ" secondAttribute="leading" constant="24" id="7zn-VD-NCK"/>
@@ -67,33 +63,27 @@
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="4h2-Xv-xjU">
<rect key="frame" x="0.0" y="0.0" width="256" height="335"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="item0" translatesAutoresizingMaskIntoConstraints="NO" id="9FK-FA-F0l">
<rect key="frame" x="0.0" y="0.0" width="256" height="335"/>
</imageView>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="item0" translatesAutoresizingMaskIntoConstraints="NO" id="9FK-FA-F0l"/>
<label opaque="NO" userInteractionEnabled="NO" tag="101" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="ATCOASTAL" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="XFh-D7-eSl">
<rect key="frame" x="62" y="10" width="132" height="29"/>
<accessibility key="accessibilityConfiguration">
<bool key="isElement" value="NO"/>
</accessibility>
<fontDescription key="fontDescription" type="system" pointSize="24"/>
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
<color key="shadowColor" red="0.0" green="0.0" blue="0.0" alpha="0.076029349662162168" colorSpace="calibratedRGB"/>
<color key="shadowColor" red="0.0" green="0.0" blue="0.0" alpha="0.076029349662162168" colorSpace="custom" customColorSpace="sRGB"/>
<size key="shadowOffset" width="0.0" height="0.0"/>
</label>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="oce-vs-fcR" userLabel="LeftView">
<rect key="frame" x="8" y="293" width="110" height="32"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="NORTH LAT 36" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ZG8-y8-Dfi">
<rect key="frame" x="13" y="9" width="85" height="15"/>
<fontDescription key="fontDescription" type="system" weight="thin" pointSize="12"/>
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" red="1" green="0.2070791421" blue="0.80130883779999995" alpha="0.0" colorSpace="calibratedRGB"/>
<color key="backgroundColor" red="1" green="0.2070791421" blue="0.80130883779999995" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="ZG8-y8-Dfi" firstAttribute="centerX" secondItem="oce-vs-fcR" secondAttribute="centerX" id="5kH-aW-2nu"/>
<constraint firstAttribute="height" constant="32" id="Ltd-P2-jig"/>
@@ -101,10 +91,8 @@
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="FVj-GH-Mhw" userLabel="CenterView">
<rect key="frame" x="119" y="293" width="20" height="32"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="pinIcon" translatesAutoresizingMaskIntoConstraints="NO" id="LFF-iv-Z1U">
<rect key="frame" x="2" y="7" width="15" height="18"/>
<accessibility key="accessibilityConfiguration">
<accessibilityTraits key="traits" staticText="YES"/>
<bool key="isElement" value="YES"/>
@@ -115,7 +103,7 @@
</constraints>
</imageView>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<accessibility key="accessibilityConfiguration">
<accessibilityTraits key="traits" staticText="YES"/>
<bool key="isElement" value="NO"/>
@@ -128,16 +116,14 @@
</constraints>
</view>
<view tag="4" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="EKg-XH-vNU" userLabel="RightView">
<rect key="frame" x="140" y="293" width="110" height="32"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="EAST LNG 97" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="zmS-RM-seQ">
<rect key="frame" x="18" y="9" width="75" height="15"/>
<fontDescription key="fontDescription" type="system" weight="thin" pointSize="12"/>
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" red="1" green="0.20707914213106515" blue="0.8013088377544425" alpha="0.0" colorSpace="calibratedRGB"/>
<color key="backgroundColor" red="1" green="0.20707914213106515" blue="0.8013088377544425" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="zmS-RM-seQ" firstAttribute="centerY" secondItem="EKg-XH-vNU" secondAttribute="centerY" id="dxV-Q6-AU9"/>
<constraint firstItem="zmS-RM-seQ" firstAttribute="centerX" secondItem="EKg-XH-vNU" secondAttribute="centerX" id="ls8-YV-n1Q"/>
@@ -145,7 +131,7 @@
</constraints>
</view>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="9FK-FA-F0l" firstAttribute="top" secondItem="4h2-Xv-xjU" secondAttribute="top" id="0HR-8P-WVW"/>
<constraint firstItem="EKg-XH-vNU" firstAttribute="leading" secondItem="FVj-GH-Mhw" secondAttribute="trailing" constant="1" id="6Bb-cJ-uQs"/>
@@ -166,9 +152,8 @@
</constraints>
</view>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
</view>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="4h2-Xv-xjU" firstAttribute="centerY" secondItem="gTV-IL-0wX" secondAttribute="centerY" id="0xA-8H-CCG"/>
<constraint firstItem="rbd-6U-uYZ" firstAttribute="centerX" secondItem="gTV-IL-0wX" secondAttribute="centerX" id="6nN-mZ-xkq"/>
@@ -178,7 +163,7 @@
<size key="customSize" width="275" height="575"/>
<connections>
<outlet property="backConstraintY" destination="dmf-qy-2nS" id="szE-V2-yce"/>
<outlet property="backContainerView" destination="rbd-6U-uYZ" id="bk5-30-huH"/>
<outlet property="backContainerView" destination="rbd-6U-uYZ" id="fl2-yE-o3C"/>
<outlet property="backgroundImageView" destination="9FK-FA-F0l" id="kns-UF-jMo"/>
<outlet property="customTitle" destination="XFh-D7-eSl" id="eia-lY-ptu"/>
<outlet property="frontConstraintY" destination="0xA-8H-CCG" id="qOL-jY-lrP"/>
@@ -11,8 +11,8 @@ import UIKit
class DemoViewController: ExpandingViewController {
typealias ItemInfo = (imageName: String, title: String)
private var cellsIsOpen = [Bool]()
private let items: [ItemInfo] = [("item0", "Boston"),("item1", "New York"),("item2", "San Francisco"),("item3", "Washington")]
fileprivate var cellsIsOpen = [Bool]()
fileprivate let items: [ItemInfo] = [("item0", "Boston"),("item1", "New York"),("item2", "San Francisco"),("item3", "Washington")]
@IBOutlet weak var pageLabel: UILabel!
}
@@ -22,6 +22,7 @@ class DemoViewController: ExpandingViewController {
extension DemoViewController {
override func viewDidLoad() {
itemSize = CGSize(width: 256, height: 335)
super.viewDidLoad()
registerCell()
@@ -35,25 +36,26 @@ extension DemoViewController {
extension DemoViewController {
private func registerCell() {
let nib = UINib(nibName: String(DemoCollectionViewCell), bundle: nil)
collectionView?.registerNib(nib, forCellWithReuseIdentifier: String(DemoCollectionViewCell))
fileprivate func registerCell() {
let nib = UINib(nibName: String(describing: DemoCollectionViewCell.self), bundle: nil)
collectionView?.register(nib, forCellWithReuseIdentifier: String(describing: DemoCollectionViewCell.self))
}
private func fillCellIsOpeenArry() {
fileprivate func fillCellIsOpeenArry() {
for _ in items {
cellsIsOpen.append(false)
}
}
private func getViewController() -> ExpandingTableViewController {
fileprivate func getViewController() -> ExpandingTableViewController {
let storyboard = UIStoryboard(storyboard: .Main)
let toViewController: DemoTableViewController = storyboard.instantiateViewController()
return toViewController
}
private func configureNavBar() {
navigationItem.leftBarButtonItem?.image = navigationItem.leftBarButtonItem?.image!.imageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal)
fileprivate func configureNavBar() {
navigationItem.leftBarButtonItem?.image = navigationItem.leftBarButtonItem?.image!.withRenderingMode(UIImageRenderingMode.alwaysOriginal)
}
}
@@ -61,23 +63,23 @@ extension DemoViewController {
extension DemoViewController {
private func addGestureToView(toView: UIView) {
fileprivate func addGestureToView(_ toView: UIView) {
let gesutereUp = Init(UISwipeGestureRecognizer(target: self, action: #selector(DemoViewController.swipeHandler(_:)))) {
$0.direction = .Up
$0.direction = .up
}
let gesutereDown = Init(UISwipeGestureRecognizer(target: self, action: #selector(DemoViewController.swipeHandler(_:)))) {
$0.direction = .Down
$0.direction = .down
}
toView.addGestureRecognizer(gesutereUp)
toView.addGestureRecognizer(gesutereDown)
}
func swipeHandler(sender: UISwipeGestureRecognizer) {
let indexPath = NSIndexPath(forRow: currentIndex, inSection: 0)
guard let cell = collectionView?.cellForItemAtIndexPath(indexPath) as? DemoCollectionViewCell else { return }
func swipeHandler(_ sender: UISwipeGestureRecognizer) {
let indexPath = IndexPath(row: currentIndex, section: 0)
guard let cell = collectionView?.cellForItem(at: indexPath) as? DemoCollectionViewCell else { return }
// double swipe Up transition
if cell.isOpened == true && sender.direction == .Up {
if cell.isOpened == true && sender.direction == .up {
pushToViewController(getViewController())
if let rightButton = navigationItem.rightBarButtonItem as? AnimatingBarButton {
@@ -85,9 +87,9 @@ extension DemoViewController {
}
}
let open = sender.direction == .Up ? true : false
let open = sender.direction == .up ? true : false
cell.cellIsOpen(open)
cellsIsOpen[indexPath.row] = cell.isOpened
cellsIsOpen[(indexPath as NSIndexPath).row] = cell.isOpened
}
}
@@ -95,7 +97,7 @@ extension DemoViewController {
extension DemoViewController {
func scrollViewDidScroll(scrollView: UIScrollView) {
func scrollViewDidScroll(_ scrollView: UIScrollView) {
pageLabel.text = "\(currentIndex+1)/\(items.count)"
}
}
@@ -104,19 +106,20 @@ extension DemoViewController {
extension DemoViewController {
func collectionView(collectionView: UICollectionView, willDisplayCell cell: UICollectionViewCell, forItemAtIndexPath indexPath: NSIndexPath) {
override func collectionView(_ collectionView: UICollectionView, willDisplay cell: UICollectionViewCell, forItemAt indexPath: IndexPath) {
super.collectionView(collectionView, willDisplay: cell, forItemAt: indexPath)
guard let cell = cell as? DemoCollectionViewCell else { return }
let index = indexPath.row % items.count
let index = (indexPath as NSIndexPath).row % items.count
let info = items[index]
cell.backgroundImageView?.image = UIImage(named: info.imageName)
cell.customTitle.text = info.title
cell.cellIsOpen(cellsIsOpen[index], animated: false)
}
func collectionView(collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: NSIndexPath) {
guard let cell = collectionView.cellForItemAtIndexPath(indexPath) as? DemoCollectionViewCell
where currentIndex == indexPath.row else { return }
func collectionView(_ collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: IndexPath) {
guard let cell = collectionView.cellForItem(at: indexPath) as? DemoCollectionViewCell
, currentIndex == (indexPath as NSIndexPath).row else { return }
if cell.isOpened == false {
cell.cellIsOpen(true)
@@ -131,14 +134,13 @@ extension DemoViewController {
}
// MARK: UICollectionViewDataSource
extension DemoViewController {
override func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
override func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return items.count
}
override func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
return collectionView.dequeueReusableCellWithReuseIdentifier(String(DemoCollectionViewCell), forIndexPath: indexPath)
override func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
return collectionView.dequeueReusableCell(withReuseIdentifier: String(describing: DemoCollectionViewCell.self), for: indexPath)
}
}
@@ -36,7 +36,7 @@ extension AnimatingBarButton {
extension AnimatingBarButton {
func animationSelected(selected: Bool) {
func animationSelected(_ selected: Bool) {
if selected {
rotateAnimationFrom(normalView, toItem: selectedView, duration: duration)
} else {
@@ -49,7 +49,7 @@ extension AnimatingBarButton {
extension AnimatingBarButton {
private func configurateImageViews() {
fileprivate func configurateImageViews() {
configureImageView(normalView, imageName: normalImageName)
configureImageView(selectedView, imageName: selectedImageName)
@@ -57,29 +57,31 @@ extension AnimatingBarButton {
// normalView.hidden = true
}
private func configureImageView(imageView: UIImageView, imageName: String) {
fileprivate func configureImageView(_ imageView: UIImageView, imageName: String) {
guard let customView = customView else { return }
imageView.translatesAutoresizingMaskIntoConstraints = false
imageView.image = UIImage(named: imageName)
imageView.contentMode = .ScaleAspectFit
imageView.contentMode = .scaleAspectFit
// imageView.backgroundColor = .greenColor()
// imageView.layer.anchorPoint = CGPoint(x: 0.5, y: 0.5)
customView.addSubview(imageView)
// add constraints
[(NSLayoutAttribute.CenterX, 12), (.CenterY, -1)].forEach { info in
[(NSLayoutAttribute.centerX, 12), (.centerY, -1)].forEach { info in
(customView, imageView) >>>- {
$0.attribute = info.0
$0.constant = CGFloat(info.1)
return
}
}
[NSLayoutAttribute.Height, .Width].forEach { attribute in
[NSLayoutAttribute.height, .width].forEach { attribute in
imageView >>>- {
$0.attribute = attribute
$0.constant = 20
return
}
}
}
@@ -10,12 +10,12 @@ import UIKit
protocol Rotatable {
func rotateAnimationFrom(fromItem: UIView, toItem: UIView, duration: Double)
func rotateAnimationFrom(_ fromItem: UIView, toItem: UIView, duration: Double)
}
extension Rotatable {
func rotateAnimationFrom(fromItem: UIView, toItem: UIView, duration: Double) {
func rotateAnimationFrom(_ fromItem: UIView, toItem: UIView, duration: Double) {
let fromRotate = animationFrom(0, to: M_PI, key: "transform.rotation", duration: duration)
let fromOpacity = animationFrom(1, to: 0, key: "opacity", duration: duration)
@@ -23,20 +23,20 @@ extension Rotatable {
let toRotate = animationFrom(-M_PI, to: 0, key: "transform.rotation", duration: duration)
let toOpacity = animationFrom(0, to: 1, key: "opacity", duration: duration)
fromItem.layer.addAnimation(fromRotate, forKey: nil)
fromItem.layer.addAnimation(fromOpacity, forKey: nil)
fromItem.layer.add(fromRotate, forKey: nil)
fromItem.layer.add(fromOpacity, forKey: nil)
toItem.layer.addAnimation(toRotate, forKey: nil)
toItem.layer.addAnimation(toOpacity, forKey: nil)
toItem.layer.add(toRotate, forKey: nil)
toItem.layer.add(toOpacity, forKey: nil)
}
private func animationFrom(from: Double, to: Double, key: String, duration: Double) -> CABasicAnimation {
fileprivate func animationFrom(_ from: Double, to: Double, key: String, duration: Double) -> CABasicAnimation {
return Init(CABasicAnimation(keyPath: key)) {
$0.duration = duration
$0.fromValue = from
$0.toValue = to
$0.fillMode = kCAFillModeForwards
$0.removedOnCompletion = false
$0.isRemovedOnCompletion = false
}
}
}
@@ -28,7 +28,7 @@ class DemoExpandingCollectionTests: XCTestCase {
func testPerformanceExample() {
// This is an example of a performance test case.
measureBlock {
measure {
// Put the code you want to measure the time of here.
}
}
+35 -12
View File
@@ -1,23 +1,28 @@
![header](./header.png)
[![header](https://raw.githubusercontent.com/Ramotion/expanding-collection/master/header.png)](https://business.ramotion.com?utm_source=gthb&utm_medium=special&utm_campaign=expanding-collection-logo)
# expanding-collection
[![Twitter](https://img.shields.io/badge/Twitter-@Ramotion-blue.svg?style=flat)](http://twitter.com/Ramotion)
[![CocoaPods](https://img.shields.io/cocoapods/p/expanding-collection.svg)](https://cocoapods.org/pods/expanding-collection)
[![CocoaPods](https://img.shields.io/cocoapods/v/expanding-collection.svg)](http://cocoapods.org/pods/expanding-collection)
[![CocoaPods](https://img.shields.io/cocoapods/metrics/doc-percent/expanding-collection.svg)](https://cdn.rawgit.com/Ramotion/expanding-collection/master/docs/index.html)
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Ramotion/expanding-collection)
[![Travis](https://travis-ci.org/Ramotion/elastic-pull-to-update.svg?branch=master)](https://travis-ci.org/Ramotion/elastic-pull-to-update)
[![codebeat badge](https://codebeat.co/badges/6a009992-5bf2-4730-aa35-f3b20ce7693d)](https://codebeat.co/projects/github-com-ramotion-expanding-collection)
[![Analytics](https://ga-beacon.appspot.com/UA-84973210-1/ramotion/expanding-collection)](https://github.com/igrigorik/ga-beacon)
[shot on dribbble](https://dribbble.com/shots/2741477-iOS-Expanding-Collection-Open-Source):
![Animation](preview.gif)
## About
This project is maintained by Ramotion, an agency specialized in building dedicated engineering teams and developing custom software.<br><br> [Contact our team](https://business.ramotion.com?utm_source=gthb&utm_medium=special&utm_campaign=expanding-collection-contact-us) and we’ll help you work with the best engineers from Eastern Europe.
[![Animation](https://raw.githubusercontent.com/Ramotion/expanding-collection/master/preview.gif)](https://dribbble.com/shots/2741477-iOS-Expanding-Collection-Open-Source)
The [iPhone mockup](https://store.ramotion.com/product/iphone-6-mockups?utm_source=gthb&utm_medium=special&utm_campaign=expanding-collection) available [here](https://store.ramotion.com/product/iphone-6-mockups?utm_source=gthb&utm_medium=special&utm_campaign=expanding-collection).
## Requirements
- iOS 8.0+
- Xcode 7.3
- iOS 9.0+
- Xcode 8
## Installation
@@ -25,7 +30,9 @@ Just add the Source folder to your project.
or use [CocoaPods](https://cocoapods.org) with Podfile:
``` ruby
pod 'expanding-collection'
pod 'expanding-collection', '~> 1.0.1' swift 3
pod 'expanding-collection', '~> 0.3.2' swift 2
```
or [Carthage](https://github.com/Carthage/Carthage) users can simply add to their `Cartfile`:
```
@@ -35,11 +42,11 @@ github "Ramotion/expanding-collection"
## Usage
```swift
import expanding_collection
import ExpandingCollection
```
#### Create CollectionViewCell
![cell](./images/image2.png)
![cell](https://raw.githubusercontent.com/Ramotion/expanding-collection/master/images/image2.png)
1) Create UICollectionViewCell inherit from `BasePageCollectionCell` (recommend create cell with xib file)
@@ -47,7 +54,7 @@ import expanding_collection
- add a view to YOURCELL.xib and connect it to `@IBOutlet weak var frontContainerView: UIView!`
- add width, height, centerX and centerY constraints (width and height constranints must equal cellSize)
![cell](./images/image1.png)
![cell](https://raw.githubusercontent.com/Ramotion/expanding-collection/master/images/image1.png)
- connect centerY constraint to `@IBOutlet weak var frontConstraintY: NSLayoutConstraint!`
- add any desired uiviews to frontView
@@ -111,6 +118,24 @@ func collectionView(collectionView: UICollectionView, didSelectItemAtIndexPath i
}
```
###### if you use this delegates method:
```Swift
func collectionView(collectionView: UICollectionView, willDisplayCell cell: UICollectionViewCell, forItemAtIndexPath indexPath: NSIndexPath)
func scrollViewDidEndDecelerating(scrollView: UIScrollView)
```
###### must call super method:
```Swift
func collectionView(collectionView: UICollectionView, willDisplayCell cell: UICollectionViewCell, forItemAtIndexPath indexPath: NSIndexPath) {
super.collectionView(collectionView: collectionView, willDisplayCell cell: cell, forItemAtIndexPath indexPath: indexPath)
// code
}
func scrollViewDidEndDecelerating(scrollView: UIScrollView) {
super.scrollViewDidEndDecelerating(scrollView: scrollView)
// code
}
```
#### Transition animation
1) Create a UITableViewController inheriting from `ExpandingTableViewController`
@@ -140,9 +165,7 @@ override func viewDidLoad() {
Expanding collection is released under the MIT license.
See [LICENSE](./LICENSE) for details.
## About
The project maintained by [app development agency](https://ramotion.com?utm_source=gthb&utm_medium=special&utm_campaign=expanding-collection) [Ramotion Inc.](https://ramotion.com?utm_source=gthb&utm_medium=special&utm_campaign=expanding-collection)
See our other [open-source projects](https://github.com/ramotion) or [hire](https://ramotion.com?utm_source=gthb&utm_medium=special&utm_campaign=expanding-collection) us to design, develop, and grow your product.
## Follow us
[![Twitter URL](https://img.shields.io/twitter/url/http/shields.io.svg?style=social)](https://twitter.com/intent/tweet?text=https://github.com/ramotion/expanding-collection)
[![Twitter Follow](https://img.shields.io/twitter/follow/ramotion.svg?style=social)](https://twitter.com/ramotion)
@@ -9,11 +9,11 @@
import UIKit
/// Base class for UITableViewcontroller which have back transition method
public class ExpandingTableViewController: UITableViewController {
open class ExpandingTableViewController: UITableViewController {
// MARK: Vars
/// The height of the table view header
public var headerHeight: CGFloat = 236
open var headerHeight: CGFloat = 236
var transitionDriver: TransitionDriver?
}
@@ -22,12 +22,24 @@ public class ExpandingTableViewController: UITableViewController {
extension ExpandingTableViewController {
private func getScreen() -> UIImage? {
fileprivate func getScreen() -> UIImage? {
let height = (headerHeight - tableView.contentOffset.y) < 0 ? 0 : (headerHeight - tableView.contentOffset.y)
let backImageSize = CGSize(width: view.bounds.width, height: view.bounds.height - height)
let backImageSize = CGSize(width: view.bounds.width, height: view.bounds.height - height + getTabBarHeight())
let backImageOrigin = CGPoint(x: 0, y: height + tableView.contentOffset.y)
return view.takeSnapshot(CGRect(origin: backImageOrigin, size: backImageSize))
}
fileprivate func getTabBarHeight() -> CGFloat {
guard let navigationController = self.navigationController else {
return 0
}
let insets = automaticallyAdjustsScrollViewInsets
let tabBarHeight = insets == true ? navigationController.navigationBar.frame.size.height : 0
let stausBarHeight = insets == true ? UIApplication.shared.statusBarFrame.size.height : 0
return tabBarHeight + stausBarHeight
}
}
// MARK: Methods
@@ -43,9 +55,11 @@ extension ExpandingTableViewController {
}
let backImage = getScreen()
let offset = tableView.contentOffset.y > headerHeight ? headerHeight : tableView.contentOffset.y
var offset = tableView.contentOffset.y > headerHeight ? headerHeight : tableView.contentOffset.y
offset += getTabBarHeight()
transitionDriver.popTransitionAnimationContantOffset(offset, backImage: backImage)
self.navigationController?.popViewControllerAnimated(false)
let _ = self.navigationController?.popViewController(animated: false)
}
}
}
@@ -9,10 +9,10 @@
import UIKit
/// Base class for UICollectionViewCell
public class BasePageCollectionCell: UICollectionViewCell {
open class BasePageCollectionCell: UICollectionViewCell {
/// Animation oposition offset when cell is open
@IBInspectable public var yOffset: CGFloat = 40
@IBInspectable open var yOffset: CGFloat = 40
// MARK: Constants
@@ -28,19 +28,19 @@ public class BasePageCollectionCell: UICollectionViewCell {
// MARK: Vars
/// The view used as the face of the cell must connectid from xib or storyboard.
@IBOutlet public weak var frontContainerView: UIView!
@IBOutlet open weak var frontContainerView: UIView!
/// The view used as the back of the cell must connectid from xib or storyboard.
@IBOutlet public weak var backContainerView: UIView!
@IBOutlet open weak var backContainerView: UIView!
/// constraints for backContainerView must connectid from xib or storyboard
@IBOutlet public weak var backConstraintY: NSLayoutConstraint!
@IBOutlet open weak var backConstraintY: NSLayoutConstraint!
/// constraints for frontContainerView must connectid from xib or storyboard
@IBOutlet public weak var frontConstraintY: NSLayoutConstraint!
@IBOutlet open weak var frontConstraintY: NSLayoutConstraint!
var shadowView: UIView?
/// A Boolean value that indicates whether the cell is opened.
public var isOpened = false
open var isOpened = false
// MARK: inits
@@ -75,13 +75,13 @@ public class BasePageCollectionCell: UICollectionViewCell {
extension BasePageCollectionCell {
public override func awakeFromNib() {
open override func awakeFromNib() {
super.awakeFromNib()
commonInit()
}
private func commonInit() {
fileprivate func commonInit() {
configurationViews()
shadowView = createShadowViewOnView(frontContainerView)
}
@@ -98,22 +98,25 @@ extension BasePageCollectionCell {
- parameter isOpen: Contains the value true if the cell should display open state, if false should display close state.
- parameter animated: Set to true if the change in selection state is animated.
*/
public func cellIsOpen(isOpen: Bool, animated: Bool = true) {
public func cellIsOpen(_ isOpen: Bool, animated: Bool = true) {
if isOpen == isOpened { return }
frontConstraintY.constant = isOpen == true ? -bounds.size.height / 5 : 0
backConstraintY.constant = isOpen == true ? bounds.size.height / 5 - yOffset / 2 : 0
frontConstraintY.constant = isOpen == true ? -frontContainerView.bounds.size.height / 5 : 0
backConstraintY.constant = isOpen == true ? frontContainerView.bounds.size.height / 5 - yOffset / 2 : 0
if let widthConstant = backContainerView.getConstraint(.Width) {
widthConstant.constant = isOpen == true ? contentView.bounds.size.width + yOffset : contentView.bounds.size.width
if let widthConstant = backContainerView.getConstraint(.width) {
widthConstant.constant = isOpen == true ? frontContainerView.bounds.size.width + yOffset : frontContainerView.bounds.size.width
}
if let heightConstant = backContainerView.getConstraint(.Height) {
heightConstant.constant = isOpen == true ? contentView.bounds.size.height + yOffset : contentView.bounds.size.height
if let heightConstant = backContainerView.getConstraint(.height) {
heightConstant.constant = isOpen == true ? frontContainerView.bounds.size.height + yOffset : frontContainerView.bounds.size.height
}
configurationCell()
if animated == true {
UIView.animateWithDuration(0.3, delay: 0, options: .CurveEaseInOut, animations: {
UIView.animate(withDuration: 0.3, delay: 0, options: UIViewAnimationOptions(), animations: {
self.contentView.layoutIfNeeded()
}, completion: nil)
} else {
@@ -128,7 +131,7 @@ extension BasePageCollectionCell {
extension BasePageCollectionCell {
private func configurationViews() {
fileprivate func configurationViews() {
backContainerView.layer.masksToBounds = true
backContainerView.layer.cornerRadius = 5
@@ -139,14 +142,14 @@ extension BasePageCollectionCell {
layer.masksToBounds = false
}
private func createShadowViewOnView(view: UIView?) -> UIView? {
fileprivate func createShadowViewOnView(_ view: UIView?) -> UIView? {
guard let view = view else {return nil}
let shadow = Init(UIView(frame: .zero)) {
$0.backgroundColor = .clearColor()
$0.backgroundColor = UIColor(white: 0, alpha: 0)
$0.translatesAutoresizingMaskIntoConstraints = false
$0.layer.masksToBounds = false;
$0.layer.shadowColor = UIColor.blackColor().CGColor
$0.layer.shadowColor = UIColor.black.cgColor
$0.layer.shadowRadius = 10
$0.layer.shadowOpacity = 0.3
$0.layer.shadowOffset = CGSize(width: 0, height:0)
@@ -154,40 +157,67 @@ extension BasePageCollectionCell {
contentView.insertSubview(shadow, belowSubview: view)
// create constraints
for info: (attribute: NSLayoutAttribute, scale: CGFloat) in [(NSLayoutAttribute.Width, 0.8), (NSLayoutAttribute.Height, 0.9)] {
for info: (attribute: NSLayoutAttribute, scale: CGFloat) in [(NSLayoutAttribute.width, 0.8), (NSLayoutAttribute.height, 0.9)] {
if let frontViewConstraint = view.getConstraint(info.attribute) {
shadow >>>- {
$0.attribute = info.attribute
$0.constant = frontViewConstraint.constant * info.scale
return
}
}
}
for info: (attribute: NSLayoutAttribute, offset: CGFloat) in [(NSLayoutAttribute.CenterX, 0), (NSLayoutAttribute.CenterY, 30)] {
for info: (attribute: NSLayoutAttribute, offset: CGFloat) in [(NSLayoutAttribute.centerX, 0), (NSLayoutAttribute.centerY, 30)] {
(contentView, shadow, view) >>>- {
$0.attribute = info.attribute
$0.constant = info.offset
return
}
}
// size shadow
let width = shadow.getConstraint(.Width)?.constant
let height = shadow.getConstraint(.Height)?.constant
let width = shadow.getConstraint(.width)?.constant
let height = shadow.getConstraint(.height)?.constant
shadow.layer.shadowPath = UIBezierPath(roundedRect: CGRect(x: 0, y: 0, width: width!, height: height!), cornerRadius: 0).CGPath
shadow.layer.shadowPath = UIBezierPath(roundedRect: CGRect(x: 0, y: 0, width: width!, height: height!), cornerRadius: 0).cgPath
return shadow
}
func configurationCell() {
// Prevents indefinite growing of the cell issue
let i: CGFloat = self.isOpened ? 1 : -1
let superHeight = superview?.frame.size.height ?? 0
frame.size.height += i * superHeight
frame.origin.y -= i * superHeight / 2
frame.origin.x -= i * yOffset / 2
frame.size.width += i * yOffset
}
func configureCellViewConstraintsWithSize(_ size: CGSize) {
guard isOpened == false && frontContainerView.getConstraint(.width)?.constant != size.width else { return }
[frontContainerView, backContainerView].forEach {
let constraintWidth = $0?.getConstraint(.width)
constraintWidth?.constant = size.width
let constraintHeight = $0?.getConstraint(.height)
constraintHeight?.constant = size.height
}
}
}
// MARK: NSCoding
extension BasePageCollectionCell {
private func highlightedImageFalseOnView(view: UIView) {
fileprivate func highlightedImageFalseOnView(_ view: UIView) {
for item in view.subviews {
if case let imageView as UIImageView = item {
imageView.highlighted = false
imageView.isHighlighted = false
}
if item.subviews.count > 0 {
highlightedImageFalseOnView(item)
@@ -195,7 +225,7 @@ extension BasePageCollectionCell {
}
}
private func copyShadowFromView(fromView: UIView, toView: UIView) {
fileprivate func copyShadowFromView(_ fromView: UIView, toView: UIView) {
fromView.layer.shadowPath = toView.layer.shadowPath
fromView.layer.masksToBounds = toView.layer.masksToBounds
fromView.layer.shadowColor = toView.layer.shadowColor
@@ -208,8 +238,8 @@ extension BasePageCollectionCell {
func copyCell() -> BasePageCollectionCell? {
highlightedImageFalseOnView(contentView)
let data = NSKeyedArchiver.archivedDataWithRootObject(self)
guard case let copyView as BasePageCollectionCell = NSKeyedUnarchiver.unarchiveObjectWithData(data),
let data = NSKeyedArchiver.archivedData(withRootObject: self)
guard case let copyView as BasePageCollectionCell = NSKeyedUnarchiver.unarchiveObject(with: data),
let shadowView = self.shadowView else {
return nil
}
@@ -230,34 +260,34 @@ extension BasePageCollectionCell {
return copyView
}
public override func encodeWithCoder(coder: NSCoder) {
super.encodeWithCoder(coder)
coder.encodeObject(backContainerView, forKey: Constants.backContainer)
coder.encodeObject(frontContainerView, forKey: Constants.frontContainer)
coder.encodeObject(frontConstraintY, forKey: Constants.frontContainerY)
coder.encodeObject(backConstraintY, forKey: Constants.backContainerY)
coder.encodeObject(shadowView, forKey: Constants.shadowView)
open override func encode(with coder: NSCoder) {
super.encode(with: coder)
coder.encode(backContainerView, forKey: Constants.backContainer)
coder.encode(frontContainerView, forKey: Constants.frontContainer)
coder.encode(frontConstraintY, forKey: Constants.frontContainerY)
coder.encode(backConstraintY, forKey: Constants.backContainerY)
coder.encode(shadowView, forKey: Constants.shadowView)
}
private func configureOutletFromDecoder(coder: NSCoder) {
if case let shadowView as UIView = coder.decodeObjectForKey(Constants.shadowView) {
fileprivate func configureOutletFromDecoder(_ coder: NSCoder) {
if case let shadowView as UIView = coder.decodeObject(forKey: Constants.shadowView) {
self.shadowView = shadowView
}
if case let backView as UIView = coder.decodeObjectForKey(Constants.backContainer) {
if case let backView as UIView = coder.decodeObject(forKey: Constants.backContainer) {
backContainerView = backView
}
if case let frontView as UIView = coder.decodeObjectForKey(Constants.frontContainer) {
if case let frontView as UIView = coder.decodeObject(forKey: Constants.frontContainer) {
frontContainerView = frontView
}
if case let constraint as NSLayoutConstraint = coder.decodeObjectForKey(Constants.frontContainerY) {
if case let constraint as NSLayoutConstraint = coder.decodeObject(forKey: Constants.frontContainerY) {
frontConstraintY = constraint
}
if case let constraint as NSLayoutConstraint = coder.decodeObjectForKey(Constants.backContainerY) {
if case let constraint as NSLayoutConstraint = coder.decodeObject(forKey: Constants.backContainerY) {
backConstraintY = constraint
}
}
}
}
@@ -10,7 +10,7 @@ import UIKit
class PageCollectionLayout: UICollectionViewFlowLayout {
private var lastCollectionViewSize: CGSize = CGSizeZero
fileprivate var lastCollectionViewSize: CGSize = CGSize.zero
var scalingOffset: CGFloat = 200
var minimumScaleFactor: CGFloat = 0.9
@@ -31,8 +31,8 @@ class PageCollectionLayout: UICollectionViewFlowLayout {
extension PageCollectionLayout {
private func commonInit(itemSize: CGSize) {
scrollDirection = .Horizontal
fileprivate func commonInit(_ itemSize: CGSize) {
scrollDirection = .horizontal
minimumLineSpacing = 25
self.itemSize = itemSize
}
@@ -42,8 +42,8 @@ extension PageCollectionLayout {
extension PageCollectionLayout {
override func invalidateLayoutWithContext(context: UICollectionViewLayoutInvalidationContext) {
super.invalidateLayoutWithContext(context)
override func invalidateLayout(with context: UICollectionViewLayoutInvalidationContext) {
super.invalidateLayout(with: context)
guard let collectionView = self.collectionView else { return }
@@ -53,13 +53,13 @@ extension PageCollectionLayout {
}
}
override func targetContentOffsetForProposedContentOffset(proposedContentOffset: CGPoint, withScrollingVelocity velocity: CGPoint) -> CGPoint {
override func targetContentOffset(forProposedContentOffset proposedContentOffset: CGPoint, withScrollingVelocity velocity: CGPoint) -> CGPoint {
guard let collectionView = self.collectionView else {
return proposedContentOffset
}
let proposedRect = CGRectMake(proposedContentOffset.x, 0, collectionView.bounds.width, collectionView.bounds.height)
guard let layoutAttributes = self.layoutAttributesForElementsInRect(proposedRect) else {
let proposedRect = CGRect(x: proposedContentOffset.x, y: 0, width: collectionView.bounds.width, height: collectionView.bounds.height)
guard let layoutAttributes = self.layoutAttributesForElements(in: proposedRect) else {
return proposedContentOffset
}
@@ -67,7 +67,7 @@ extension PageCollectionLayout {
let proposedContentOffsetCenterX = proposedContentOffset.x + collectionView.bounds.width / 2
for attributes in layoutAttributes {
if attributes.representedElementCategory != .Cell {
if attributes.representedElementCategory != .cell {
continue
}
@@ -93,27 +93,27 @@ extension PageCollectionLayout {
newOffsetX += velocity.x > 0 ? pageWidth : -pageWidth
}
return CGPointMake(newOffsetX, proposedContentOffset.y)
return CGPoint(x: newOffsetX, y: proposedContentOffset.y)
}
override func shouldInvalidateLayoutForBoundsChange(newBounds: CGRect) -> Bool {
override func shouldInvalidateLayout(forBoundsChange newBounds: CGRect) -> Bool {
return true
}
override func layoutAttributesForElementsInRect(rect: CGRect) -> [UICollectionViewLayoutAttributes]? {
override func layoutAttributesForElements(in rect: CGRect) -> [UICollectionViewLayoutAttributes]? {
guard let collectionView = self.collectionView,
let superAttributes = super.layoutAttributesForElementsInRect(rect) else {
return super.layoutAttributesForElementsInRect(rect)
let superAttributes = super.layoutAttributesForElements(in: rect) else {
return super.layoutAttributesForElements(in: rect)
}
if scaleItems == false{
return super.layoutAttributesForElementsInRect(rect)
return super.layoutAttributesForElements(in: rect)
}
let contentOffset = collectionView.contentOffset
let size = collectionView.bounds.size
let visibleRect = CGRectMake(contentOffset.x, contentOffset.y, size.width, size.height)
let visibleCenterX = CGRectGetMidX(visibleRect)
let visibleRect = CGRect(x: contentOffset.x, y: contentOffset.y, width: size.width, height: size.height)
let visibleCenterX = visibleRect.midX
guard case let newAttributesArray as [UICollectionViewLayoutAttributes] = NSArray(array: superAttributes, copyItems: true) else {
return nil
@@ -137,13 +137,13 @@ extension PageCollectionLayout {
extension PageCollectionLayout {
private func configureInset() -> Void {
fileprivate func configureInset() -> Void {
guard let collectionView = self.collectionView else {
return
}
let inset = collectionView.bounds.size.width / 2 - itemSize.width / 2
collectionView.contentInset = UIEdgeInsetsMake(0, inset, 0, inset)
collectionView.contentOffset = CGPointMake(-inset, 0)
collectionView.contentOffset = CGPoint(x: -inset, y: 0)
}
}
@@ -16,7 +16,7 @@ class PageCollectionView: UICollectionView {
extension PageCollectionView {
class func createOnView(view: UIView,
class func createOnView(_ view: UIView,
layout: UICollectionViewLayout,
height:CGFloat,
dataSource: UICollectionViewDataSource,
@@ -28,20 +28,24 @@ extension PageCollectionView {
$0.showsHorizontalScrollIndicator = false
$0.dataSource = dataSource
$0.delegate = delegate
$0.backgroundColor = .clearColor()
$0.backgroundColor = UIColor(white: 0, alpha: 0)
}
view.addSubview(collectionView)
// add constraints
collectionView >>>- {
$0.attribute = .Height
$0.attribute = .height
$0.constant = height
return
}
[NSLayoutAttribute.Left, .Right, .CenterY].forEach { attribute in
(view, collectionView) >>>- { $0.attribute = attribute }
[NSLayoutAttribute.left, .right, .centerY].forEach { attribute in
(view, collectionView) >>>- {
$0.attribute = attribute
return
}
}
return collectionView
}
}
}
@@ -9,18 +9,18 @@
import UIKit
/// UIViewController with UICollectionView with custom transition method
public class ExpandingViewController: UIViewController {
open class ExpandingViewController: UIViewController {
/// The default size to use for cells.
public var itemSize = CGSize(width: 256, height: 335)
open var itemSize = CGSize(width: 256, height: 335)
/// The collection view object managed by this view controller.
public var collectionView: UICollectionView?
open var collectionView: UICollectionView?
private var transitionDriver: TransitionDriver?
fileprivate var transitionDriver: TransitionDriver?
/// Index of current cell
public var currentIndex: Int {
open var currentIndex: Int {
guard let collectionView = self.collectionView else { return 0 }
let startOffset = (collectionView.bounds.size.width - itemSize.width) / 2
@@ -29,7 +29,9 @@ public class ExpandingViewController: UIViewController {
}
let minimumLineSpacing = collectionLayout.minimumLineSpacing
return Int((collectionView.contentOffset.x + startOffset + itemSize.width / 2) / (itemSize.width + minimumLineSpacing))
let a = collectionView.contentOffset.x + startOffset + itemSize.width / 2
let b = itemSize.width + minimumLineSpacing
return Int(a / b)
}
}
@@ -37,7 +39,7 @@ public class ExpandingViewController: UIViewController {
extension ExpandingViewController {
public override func viewDidLoad() {
open override func viewDidLoad() {
super.viewDidLoad()
commonInit()
}
@@ -52,18 +54,23 @@ public extension ExpandingViewController {
- parameter viewController: The table view controller to push onto the stack.
*/
func pushToViewController(viewController: ExpandingTableViewController) {
guard let collectionView = self.collectionView else {
func pushToViewController(_ viewController: ExpandingTableViewController) {
guard let collectionView = self.collectionView,
let navigationController = self.navigationController else {
return
}
viewController.transitionDriver = transitionDriver
let insets = viewController.automaticallyAdjustsScrollViewInsets
let tabBarHeight = insets == true ? navigationController.navigationBar.frame.size.height : 0
let stausBarHeight = insets == true ? UIApplication.shared.statusBarFrame.size.height : 0
let backImage = getBackImage(viewController, headerHeight: viewController.headerHeight)
transitionDriver?.pushTransitionAnimationIndex(currentIndex,
collecitionView: collectionView,
backImage: backImage,
headerHeight: viewController.headerHeight) { headerView in
headerHeight: viewController.headerHeight,
insets: tabBarHeight + stausBarHeight) { headerView in
viewController.tableView.tableHeaderView = headerView
self.navigationController?.pushViewController(viewController, animated: false)
}
@@ -74,7 +81,7 @@ public extension ExpandingViewController {
extension ExpandingViewController {
private func commonInit() {
fileprivate func commonInit() {
let layout = PageCollectionLayout(itemSize: itemSize)
collectionView = PageCollectionView.createOnView(view,
@@ -90,7 +97,7 @@ extension ExpandingViewController {
extension ExpandingViewController {
private func getBackImage(viewController: UIViewController, headerHeight: CGFloat) -> UIImage? {
fileprivate func getBackImage(_ viewController: UIViewController, headerHeight: CGFloat) -> UIImage? {
let imageSize = CGSize(width: viewController.view.bounds.width, height: viewController.view.bounds.height - headerHeight)
let imageFrame = CGRect(origin: CGPoint(x: 0, y: 0), size: imageSize)
return viewController.view.takeSnapshot(imageFrame)
@@ -100,14 +107,33 @@ extension ExpandingViewController {
// MARK: UICollectionViewDataSource
extension ExpandingViewController: UICollectionViewDataSource, UICollectionViewDelegate{
extension ExpandingViewController: UICollectionViewDataSource, UICollectionViewDelegate {
public func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
open func collectionView(_ collectionView: UICollectionView, willDisplay cell: UICollectionViewCell, forItemAt indexPath: IndexPath) {
guard case let cell as BasePageCollectionCell = cell else {
return
}
cell.configureCellViewConstraintsWithSize(itemSize)
}
open func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
fatalError("need emplementation in subclass")
}
public func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
open func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
fatalError("need emplementation in subclass")
}
}
// MARK: UIScrollViewDelegate
extension ExpandingViewController {
public func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) {
let indexPath = IndexPath(row: currentIndex, section: 0)
if case let currentCell as BasePageCollectionCell = collectionView?.cellForItem(at: indexPath) {
currentCell.configurationCell()
}
}
}
@@ -10,21 +10,21 @@ import UIKit
protocol CornerAnimatable {
func animationCornerRadius(radius: CGFloat, duration: Double)
func animationCornerRadius(_ radius: CGFloat, duration: Double)
}
extension CornerAnimatable where Self: UIView {
func animationCornerRadius(radius: CGFloat, duration: Double) {
func animationCornerRadius(_ radius: CGFloat, duration: Double) {
let animation = Init(CABasicAnimation(keyPath: "cornerRadius")) {
$0.duration = duration
$0.toValue = radius
$0.fillMode = kCAFillModeForwards
$0.removedOnCompletion = false;
$0.isRemovedOnCompletion = false;
}
layer.addAnimation(animation, forKey: nil)
layer.add(animation, forKey: nil)
}
}
extension UIView: CornerAnimatable {}
extension UIView: CornerAnimatable {}
@@ -8,9 +8,9 @@
import Foundation
@warn_unused_result
internal func Init<Type>(value : Type, @noescape block: (object: Type) -> Void) -> Type
internal func Init<Type>(_ value : Type, block: (_ object: Type) -> Void) -> Type
{
block(object: value)
block(value)
return value
}
@@ -9,19 +9,25 @@
import UIKit
struct ConstraintInfo {
var attribute: NSLayoutAttribute = .Left
var secondAttribute: NSLayoutAttribute = .NotAnAttribute
var attribute: NSLayoutAttribute = .left
var secondAttribute: NSLayoutAttribute = .notAnAttribute
var constant: CGFloat = 0
var identifier: String?
var relation: NSLayoutRelation = .Equal
var relation: NSLayoutRelation = .equal
}
infix operator >>>- { associativity left precedence 150 }
precedencegroup ConstOp {
associativity: left
higherThan: AssignmentPrecedence
}
func >>>- <T: UIView> (left: (T, T), @noescape block: (inout ConstraintInfo) -> ()) -> NSLayoutConstraint {
infix operator >>>- : ConstOp
@discardableResult
func >>>- <T: UIView> (left: (T, T), block: (inout ConstraintInfo) -> Void) -> NSLayoutConstraint {
var info = ConstraintInfo()
block(&info)
info.secondAttribute = info.secondAttribute == .NotAnAttribute ? info.attribute : info.secondAttribute
info.secondAttribute = info.secondAttribute == .notAnAttribute ? info.attribute : info.secondAttribute
let constraint = NSLayoutConstraint(item: left.1,
attribute: info.attribute,
@@ -35,7 +41,8 @@ func >>>- <T: UIView> (left: (T, T), @noescape block: (inout ConstraintInfo) ->
return constraint
}
func >>>- <T: UIView> (left: T, @noescape block: (inout ConstraintInfo) -> ()) -> NSLayoutConstraint {
@discardableResult
func >>>- <T: UIView> (left: T, block: (inout ConstraintInfo) -> Void) -> NSLayoutConstraint {
var info = ConstraintInfo()
block(&info)
@@ -51,10 +58,11 @@ func >>>- <T: UIView> (left: T, @noescape block: (inout ConstraintInfo) -> ()) -
return constraint
}
func >>>- <T: UIView> (left: (T, T, T), @noescape block: (inout ConstraintInfo) -> ()) -> NSLayoutConstraint {
@discardableResult
func >>>- <T: UIView> (left: (T, T, T), block: (inout ConstraintInfo) -> Void) -> NSLayoutConstraint {
var info = ConstraintInfo()
block(&info)
info.secondAttribute = info.secondAttribute == .NotAnAttribute ? info.attribute : info.secondAttribute
info.secondAttribute = info.secondAttribute == .notAnAttribute ? info.attribute : info.secondAttribute
let constraint = NSLayoutConstraint(item: left.1,
attribute: info.attribute,
@@ -72,13 +80,16 @@ func >>>- <T: UIView> (left: (T, T, T), @noescape block: (inout ConstraintInfo)
extension UIView {
func addScaleToFillConstratinsOnView(view: UIView) {
[NSLayoutAttribute.Left, .Right, .Top, .Bottom].forEach { attribute in
(self, view) >>>- { $0.attribute = attribute }
func addScaleToFillConstratinsOnView(_ view: UIView) {
[NSLayoutAttribute.left, .right, .top, .bottom].forEach { attribute in
(self, view) >>>- {
$0.attribute = attribute
return
}
}
}
func getConstraint(attributes: NSLayoutAttribute) -> NSLayoutConstraint? {
func getConstraint(_ attributes: NSLayoutAttribute) -> NSLayoutConstraint? {
return constraints.filter {
if $0.firstAttribute == attributes && $0.secondItem == nil {
return true
@@ -9,20 +9,20 @@
import UIKit
extension UIView {
func takeSnapshot(frame: CGRect) -> UIImage? {
func takeSnapshot(_ frame: CGRect) -> UIImage? {
UIGraphicsBeginImageContextWithOptions(frame.size, false, 0.0)
let context = UIGraphicsGetCurrentContext();
CGContextTranslateCTM(context, frame.origin.x * -1, frame.origin.y * -1)
context?.translateBy(x: frame.origin.x * -1, y: frame.origin.y * -1)
guard let currentContext = UIGraphicsGetCurrentContext() else {
return nil
}
self.layer.renderInContext(currentContext)
self.layer.render(in: currentContext)
let image = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
return image
}
}
}
@@ -9,16 +9,16 @@
import UIKit
protocol SubviewsForEach {
func subviewsForEach(f: UIView -> Void)
func subviewsForEach(_ f: (UIView) -> Void)
}
extension SubviewsForEach where Self: UIView {
func subviewsForEach(f: UIView -> Void) {
func subviewsForEach(_ f: (UIView) -> Void) {
forEachView(self, f: f)
}
private func forEachView(view: UIView, f: UIView -> Void) {
fileprivate func forEachView(_ view: UIView, f: (UIView) -> Void) {
view.subviews.forEach {
f($0)
@@ -29,4 +29,4 @@ extension SubviewsForEach where Self: UIView {
}
}
extension UIView: SubviewsForEach {}
extension UIView: SubviewsForEach {}
+60 -51
View File
@@ -17,20 +17,20 @@ class TransitionDriver {
// MARK: Vars
private let view: UIView
private let duration: Double = 0.4
fileprivate let view: UIView
fileprivate let duration: Double = 0.4
// for push animation
private var copyCell: BasePageCollectionCell?
private var currentCell: BasePageCollectionCell?
private var backImageView: UIImageView?
fileprivate var copyCell: BasePageCollectionCell?
fileprivate var currentCell: BasePageCollectionCell?
fileprivate var backImageView: UIImageView?
private var leftCell: UICollectionViewCell?
private var rightCell: UICollectionViewCell?
private var step: CGFloat = 0
fileprivate var leftCell: UICollectionViewCell?
fileprivate var rightCell: UICollectionViewCell?
fileprivate var step: CGFloat = 0
private var frontViewFrame = CGRect.zero
private var backViewFrame = CGRect.zero
fileprivate var frontViewFrame = CGRect.zero
fileprivate var backViewFrame = CGRect.zero
init(view: UIView) {
self.view = view
@@ -41,13 +41,14 @@ class TransitionDriver {
extension TransitionDriver {
func pushTransitionAnimationIndex(currentIndex: Int,
func pushTransitionAnimationIndex(_ currentIndex: Int,
collecitionView: UICollectionView,
backImage: UIImage?,
headerHeight: CGFloat,
completion: UIView -> Void) {
insets: CGFloat,
completion: @escaping (UIView) -> Void) {
guard case let cell as BasePageCollectionCell = collecitionView.cellForItemAtIndexPath(NSIndexPath(forRow: currentIndex, inSection: 0)),
guard case let cell as BasePageCollectionCell = collecitionView.cellForItem(at: IndexPath(row: currentIndex, section: 0)),
let copyView = cell.copyCell() else { return }
copyCell = copyView
@@ -55,34 +56,35 @@ extension TransitionDriver {
moveCellsCurrentIndex(currentIndex, collectionView: collecitionView)
currentCell = cell
cell.hidden = true
cell.isHidden = true
configurateCell(copyView, backImage: backImage)
backImageView = addImageToView(copyView.backContainerView, image: backImage)
openBackViewConfigureConstraints(copyView, height: headerHeight)
openFrontViewConfigureConstraints(copyView, height: headerHeight)
openBackViewConfigureConstraints(copyView, height: headerHeight, insets: insets)
openFrontViewConfigureConstraints(copyView, height: headerHeight, insets: insets)
// corner animation
copyView.backContainerView.animationCornerRadius(0, duration: duration)
copyView.frontContainerView.animationCornerRadius(0, duration: duration)
copyView.center = view.center
// constraints animation
UIView.animateWithDuration(duration, delay: 0, options: .CurveEaseInOut, animations: {
UIView.animate(withDuration: duration, delay: 0, options: UIViewAnimationOptions(), animations: {
self.view.layoutIfNeeded()
self.backImageView?.alpha = 1
self.copyCell?.shadowView?.alpha = 0
copyView.frontContainerView.subviewsForEach { if $0.tag == Constants.HideKey { $0.alpha = 0 } }
}, completion: { success in
let data = NSKeyedArchiver.archivedDataWithRootObject(copyView.frontContainerView)
guard case let headerView as UIView = NSKeyedUnarchiver.unarchiveObjectWithData(data) else {
let data = NSKeyedArchiver.archivedData(withRootObject: copyView.frontContainerView)
guard case let headerView as UIView = NSKeyedUnarchiver.unarchiveObject(with: data) else {
fatalError("must copy")
}
completion(headerView)
})
}
func popTransitionAnimationContantOffset(offset: CGFloat, backImage: UIImage?) {
func popTransitionAnimationContantOffset(_ offset: CGFloat, backImage: UIImage?) {
guard let copyCell = self.copyCell else {
return
}
@@ -98,7 +100,7 @@ extension TransitionDriver {
copyCell.backContainerView.animationCornerRadius(copyCell.backContainerView.layer.cornerRadius, duration: duration)
copyCell.frontContainerView.animationCornerRadius(copyCell.frontContainerView.layer.cornerRadius, duration: duration)
UIView.animateWithDuration(duration, delay: 0, options: .CurveEaseInOut, animations: {
UIView.animate(withDuration: duration, delay: 0, options: UIViewAnimationOptions(), animations: {
self.rightCell?.center.x -= self.step
self.leftCell?.center.x += self.step
@@ -108,7 +110,7 @@ extension TransitionDriver {
copyCell.frontContainerView.subviewsForEach { if $0.tag == Constants.HideKey { $0.alpha = 1 } }
}, completion: { success in
self.currentCell?.hidden = false
self.currentCell?.isHidden = false
self.removeCurrentCell()
})
}
@@ -118,31 +120,35 @@ extension TransitionDriver {
extension TransitionDriver {
private func removeCurrentCell() {
fileprivate func removeCurrentCell() {
if case let currentCell as UIView = self.copyCell {
currentCell.removeFromSuperview()
}
}
private func configurateCell(cell: BasePageCollectionCell, backImage: UIImage?) {
fileprivate func configurateCell(_ cell: BasePageCollectionCell, backImage: UIImage?) {
cell.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(cell)
// add constraints
[(NSLayoutAttribute.Width, cell.bounds.size.width), (NSLayoutAttribute.Height, cell.bounds.size.height)].forEach { info in
[(NSLayoutAttribute.width, cell.bounds.size.width), (NSLayoutAttribute.height, cell.bounds.size.height)].forEach { info in
cell >>>- {
$0.attribute = info.0
$0.constant = info.1
return
}
}
[NSLayoutAttribute.CenterX, .CenterY].forEach { attribute in
(view, cell) >>>- { $0.attribute = attribute }
[NSLayoutAttribute.centerX, .centerY].forEach { attribute in
(view, cell) >>>- {
$0.attribute = attribute
return
}
}
cell.layoutIfNeeded()
}
private func addImageToView(view: UIView, image: UIImage?) -> UIImageView? {
fileprivate func addImageToView(_ view: UIView, image: UIImage?) -> UIImageView? {
guard let image = image else { return nil }
let imageView = Init(UIImageView(image: image)) {
@@ -152,30 +158,33 @@ extension TransitionDriver {
view.addSubview(imageView)
// add constraints
[NSLayoutAttribute.Left, .Right, .Top, .Bottom].forEach { attribute in
(view, imageView) >>>- { $0.attribute = attribute }
[NSLayoutAttribute.left, .right, .top, .bottom].forEach { attribute in
(view, imageView) >>>- {
$0.attribute = attribute
return
}
}
imageView.layoutIfNeeded()
return imageView
}
private func moveCellsCurrentIndex(currentIndex: Int, collectionView: UICollectionView) {
fileprivate func moveCellsCurrentIndex(_ currentIndex: Int, collectionView: UICollectionView) {
self.leftCell = nil
self.rightCell = nil
if let leftCell = collectionView.cellForItemAtIndexPath(NSIndexPath(forRow: currentIndex - 1, inSection: 0)) {
if let leftCell = collectionView.cellForItem(at: IndexPath(row: currentIndex - 1, section: 0)) {
let step = leftCell.frame.size.width + (leftCell.frame.origin.x - collectionView.contentOffset.x)
UIView.animateWithDuration(0.2, animations: {
UIView.animate(withDuration: 0.2, animations: {
leftCell.center.x -= step
})
self.leftCell = leftCell
self.step = step
}
if let rightCell = collectionView.cellForItemAtIndexPath(NSIndexPath(forRow: currentIndex + 1, inSection: 0)) {
if let rightCell = collectionView.cellForItem(at: IndexPath(row: currentIndex + 1, section: 0)) {
let step = collectionView.frame.size.width - (rightCell.frame.origin.x - collectionView.contentOffset.x)
UIView.animateWithDuration(0.2, animations: {
UIView.animate(withDuration: 0.2, animations: {
rightCell.center.x += step
})
self.rightCell = rightCell
@@ -188,68 +197,68 @@ extension TransitionDriver {
extension TransitionDriver {
private func openFrontViewConfigureConstraints(cell: BasePageCollectionCell, height: CGFloat) {
fileprivate func openFrontViewConfigureConstraints(_ cell: BasePageCollectionCell, height: CGFloat, insets: CGFloat) {
if let heightConstraint = cell.frontContainerView.getConstraint(.Height) {
if let heightConstraint = cell.frontContainerView.getConstraint(.height) {
frontViewFrame.size.height = heightConstraint.constant
heightConstraint.constant = height
}
if let widthConstraint = cell.frontContainerView.getConstraint(.Width) {
if let widthConstraint = cell.frontContainerView.getConstraint(.width) {
frontViewFrame.size.width = widthConstraint.constant
widthConstraint.constant = view.bounds.size.width
}
frontViewFrame.origin.y = cell.frontConstraintY.constant
cell.frontConstraintY.constant = -view.bounds.size.height / 2 + height / 2
cell.frontConstraintY.constant = -view.bounds.size.height / 2 + height / 2 + insets
}
private func openBackViewConfigureConstraints(cell: BasePageCollectionCell, height: CGFloat) {
fileprivate func openBackViewConfigureConstraints(_ cell: BasePageCollectionCell, height: CGFloat, insets: CGFloat) {
if let heightConstraint = cell.backContainerView.getConstraint(.Height) {
if let heightConstraint = cell.backContainerView.getConstraint(.height) {
backViewFrame.size.height = heightConstraint.constant
heightConstraint.constant = view.bounds.size.height - height
}
if let widthConstraint = cell.backContainerView.getConstraint(.Width) {
if let widthConstraint = cell.backContainerView.getConstraint(.width) {
backViewFrame.size.width = widthConstraint.constant
widthConstraint.constant = view.bounds.size.width
}
backViewFrame.origin.y = cell.backConstraintY.constant
cell.backConstraintY.constant = view.bounds.size.height / 2 - (view.bounds.size.height - 236) / 2
cell.backConstraintY.constant = view.bounds.size.height / 2 - (view.bounds.size.height - 236) / 2 + insets
}
private func closeBackViewConfigurationConstraints(cell: BasePageCollectionCell?) {
fileprivate func closeBackViewConfigurationConstraints(_ cell: BasePageCollectionCell?) {
guard let cell = cell else { return }
let heightConstraint = cell.backContainerView.getConstraint(.Height)
let heightConstraint = cell.backContainerView.getConstraint(.height)
heightConstraint?.constant = backViewFrame.size.height
let widthConstraint = cell.backContainerView.getConstraint(.Width)
let widthConstraint = cell.backContainerView.getConstraint(.width)
widthConstraint?.constant = backViewFrame.size.width
cell.backConstraintY.constant = backViewFrame.origin.y
}
private func closeFrontViewConfigurationConstraints(cell: BasePageCollectionCell?) {
fileprivate func closeFrontViewConfigurationConstraints(_ cell: BasePageCollectionCell?) {
guard let cell = cell else { return }
if let heightConstraint = cell.frontContainerView.getConstraint(.Height) {
if let heightConstraint = cell.frontContainerView.getConstraint(.height) {
heightConstraint.constant = frontViewFrame.size.height
}
if let widthConstraint = cell.frontContainerView.getConstraint(.Width) {
if let widthConstraint = cell.frontContainerView.getConstraint(.width) {
widthConstraint.constant = frontViewFrame.size.width
}
cell.frontConstraintY.constant = frontViewFrame.origin.y
}
private func configureCellBeforeClose(cell: BasePageCollectionCell, offset: CGFloat) {
fileprivate func configureCellBeforeClose(_ cell: BasePageCollectionCell, offset: CGFloat) {
cell.frontConstraintY.constant -= offset
cell.backConstraintY.constant -= offset / 2.0
if let heightConstraint = cell.backContainerView.getConstraint(.Height) {
if let heightConstraint = cell.backContainerView.getConstraint(.height) {
heightConstraint.constant += offset
}
cell.contentView.layoutIfNeeded()
+1 -1
View File
@@ -149,7 +149,7 @@
</section>
</section>
<section id="footer">
<p>&copy; 2016 <a class="link" href="" target="_blank" rel="external">AlexKalinkin</a>. All rights reserved. (Last updated: 2016-06-07)</p>
<p>&copy; 2016 <a class="link" href="" target="_blank" rel="external">AlexKalinkin</a>. All rights reserved. (Last updated: 2016-06-10)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.5.0</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
+1 -1
View File
@@ -364,7 +364,7 @@
</section>
</section>
<section id="footer">
<p>&copy; 2016 <a class="link" href="" target="_blank" rel="external">AlexKalinkin</a>. All rights reserved. (Last updated: 2016-06-07)</p>
<p>&copy; 2016 <a class="link" href="" target="_blank" rel="external">AlexKalinkin</a>. All rights reserved. (Last updated: 2016-06-10)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.5.0</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
@@ -129,7 +129,7 @@
</section>
</section>
<section id="footer">
<p>&copy; 2016 <a class="link" href="" target="_blank" rel="external">AlexKalinkin</a>. All rights reserved. (Last updated: 2016-06-07)</p>
<p>&copy; 2016 <a class="link" href="" target="_blank" rel="external">AlexKalinkin</a>. All rights reserved. (Last updated: 2016-06-10)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.5.0</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
+1 -1
View File
@@ -196,7 +196,7 @@
</section>
</section>
<section id="footer">
<p>&copy; 2016 <a class="link" href="" target="_blank" rel="external">AlexKalinkin</a>. All rights reserved. (Last updated: 2016-06-07)</p>
<p>&copy; 2016 <a class="link" href="" target="_blank" rel="external">AlexKalinkin</a>. All rights reserved. (Last updated: 2016-06-10)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.5.0</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
@@ -149,7 +149,7 @@
</section>
</section>
<section id="footer">
<p>&copy; 2016 <a class="link" href="" target="_blank" rel="external">AlexKalinkin</a>. All rights reserved. (Last updated: 2016-06-07)</p>
<p>&copy; 2016 <a class="link" href="" target="_blank" rel="external">AlexKalinkin</a>. All rights reserved. (Last updated: 2016-06-10)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.5.0</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
@@ -364,7 +364,7 @@
</section>
</section>
<section id="footer">
<p>&copy; 2016 <a class="link" href="" target="_blank" rel="external">AlexKalinkin</a>. All rights reserved. (Last updated: 2016-06-07)</p>
<p>&copy; 2016 <a class="link" href="" target="_blank" rel="external">AlexKalinkin</a>. All rights reserved. (Last updated: 2016-06-10)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.5.0</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
@@ -129,7 +129,7 @@
</section>
</section>
<section id="footer">
<p>&copy; 2016 <a class="link" href="" target="_blank" rel="external">AlexKalinkin</a>. All rights reserved. (Last updated: 2016-06-07)</p>
<p>&copy; 2016 <a class="link" href="" target="_blank" rel="external">AlexKalinkin</a>. All rights reserved. (Last updated: 2016-06-10)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.5.0</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
@@ -196,7 +196,7 @@
</section>
</section>
<section id="footer">
<p>&copy; 2016 <a class="link" href="" target="_blank" rel="external">AlexKalinkin</a>. All rights reserved. (Last updated: 2016-06-07)</p>
<p>&copy; 2016 <a class="link" href="" target="_blank" rel="external">AlexKalinkin</a>. All rights reserved. (Last updated: 2016-06-10)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.5.0</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
@@ -46,15 +46,157 @@
<section>
<section class="section">
<a href='#demoexpandingcollection' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h1 id='demoexpandingcollection'>DemoExpandingCollection</h1>
<a href='#authors' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h3 id='authors'>Authors</h3>
<p><img src="https://raw.githubusercontent.com/Ramotion/expanding-collection/master/header.png" alt="header"></p>
<a href='#expanding_collection' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h1 id='expanding_collection'>expanding-collection</h1>
<p>AlexKalinkin</p>
<p><a href="http://twitter.com/Ramotion"><img src="https://img.shields.io/badge/Twitter-@Ramotion-blue.svg?style=flat" alt="Twitter"></a>
<a href="https://cocoapods.org/pods/expanding-collection"><img src="https://img.shields.io/cocoapods/p/expanding-collection.svg" alt="CocoaPods"></a>
<a href="http://cocoapods.org/pods/expanding-collection"><img src="https://img.shields.io/cocoapods/v/expanding-collection.svg" alt="CocoaPods"></a>
<a href="https://cdn.rawgit.com/Ramotion/expanding-collection/master/docs/index.html"><img src="https://img.shields.io/cocoapods/metrics/doc-percent/expanding-collection.svg" alt="CocoaPods"></a></p>
<p><a href="https://github.com/Ramotion/expanding-collection"><img src="https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat" alt="Carthage compatible"></a>
<a href="https://travis-ci.org/Ramotion/elastic-pull-to-update"><img src="https://travis-ci.org/Ramotion/elastic-pull-to-update.svg?branch=master" alt="Travis"></a>
<a href="https://codebeat.co/projects/github-com-ramotion-expanding-collection"><img src="https://codebeat.co/badges/6a009992-5bf2-4730-aa35-f3b20ce7693d" alt="codebeat badge"></a></p>
<p><a href="https://dribbble.com/shots/2741477-iOS-Expanding-Collection-Open-Source">shot on dribbble</a>:
<img src="https://raw.githubusercontent.com/Ramotion/expanding-collection/master/preview.gif" alt="Animation"></p>
<p>The <a href="https://store.ramotion.com/product/iphone-6-mockups?utm_source=gthb&amp;utm_medium=special&amp;utm_campaign=expanding-collection">iPhone mockup</a> available <a href="https://store.ramotion.com/product/iphone-6-mockups?utm_source=gthb&amp;utm_medium=special&amp;utm_campaign=expanding-collection">here</a>.</p>
<a href='#requirements' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h2 id='requirements'>Requirements</h2>
<ul>
<li>iOS 8.0+</li>
<li>Xcode 7.3</li>
</ul>
<a href='#installation' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h2 id='installation'>Installation</h2>
<p>Just add the Source folder to your project.</p>
<p>or use <a href="https://cocoapods.org">CocoaPods</a> with Podfile:
<code>ruby
pod &#39;expanding-collection&#39;
</code>
or <a href="https://github.com/Carthage/Carthage">Carthage</a> users can simply add to their <code>Cartfile</code>:
<code>
github &quot;Ramotion/expanding-collection&quot;
</code></p>
<a href='#usage' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h2 id='usage'>Usage</h2>
<pre class="highlight swift"><code><span class="kd">import</span> <span class="kt">ExpandingCollection</span>
</code></pre>
<a href='#create_collectionviewcell' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h4 id='create_collectionviewcell'>Create CollectionViewCell</h4>
<p><img src="https://raw.githubusercontent.com/Ramotion/expanding-collection/master/images/image2.png" alt="cell"></p>
<p>1) Create UICollectionViewCell inherit from <code>BasePageCollectionCell</code> (recommend create cell with xib file)</p>
<p>2) Adding FrontView
- add a view to YOURCELL.xib and connect it to <code>@IBOutlet weak var frontContainerView: UIView!</code><br>
- add width, height, centerX and centerY constraints (width and height constranints must equal cellSize)</p>
<p><img src="https://raw.githubusercontent.com/Ramotion/expanding-collection/master/images/image1.png" alt="cell"><br>
- connect centerY constraint to <code>@IBOutlet weak var frontConstraintY: NSLayoutConstraint!</code>
- add any desired uiviews to frontView</p>
<p>3) Adding BackView
- repeat step 2 (connect outlets to <code>@IBOutlet weak var backContainerView: UIView!</code>, <code>@IBOutlet weak var backConstraintY: NSLayoutConstraint!</code>)</p>
<p>4) Cell example <a href="https://github.com/Ramotion/expanding-collection/tree/master/DemoExpandingCollection/DemoExpandingCollection/ViewControllers/DemoViewController/Cells">DemoCell</a></p>
<a href='#if_set_code_tag_101_code_for_any_code_frontview_subviews_code_this_view_will_be_hidden_during_the_transition_animation' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h6 id='if_set_code_tag_101_code_for_any_code_frontview_subviews_code_this_view_will_be_hidden_during_the_transition_animation'>If set <code>tag = 101</code> for any <code>FrontView.subviews</code> this view will be hidden during the transition animation</h6>
<a href='#create_collectionviewcontroller' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h4 id='create_collectionviewcontroller'>Create CollectionViewController</h4>
<p>1) Create a UIViewController inheriting from <code>ExpandingViewController</code></p>
<p>2) Register Cell and set Cell size:</p>
<pre class="highlight swift"><code><span class="k">override</span> <span class="kd">func</span> <span class="nf">viewDidLoad</span><span class="p">()</span> <span class="p">{</span>
<span class="n">itemSize</span> <span class="o">=</span> <span class="kt">CGSize</span><span class="p">(</span><span class="nv">width</span><span class="p">:</span> <span class="mi">214</span><span class="p">,</span> <span class="nv">height</span><span class="p">:</span> <span class="mi">264</span><span class="p">)</span>
<span class="k">super</span><span class="o">.</span><span class="nf">viewDidLoad</span><span class="p">()</span>
<span class="c1">// register cell</span>
<span class="k">let</span> <span class="nv">nib</span> <span class="o">=</span> <span class="kt">UINib</span><span class="p">(</span><span class="nv">nibName</span><span class="p">:</span> <span class="s">"NibName"</span><span class="p">,</span> <span class="nv">bundle</span><span class="p">:</span> <span class="kc">nil</span><span class="p">)</span>
<span class="n">collectionView</span><span class="p">?</span><span class="o">.</span><span class="nf">registerNib</span><span class="p">(</span><span class="n">nib</span><span class="p">,</span> <span class="nv">forCellWithReuseIdentifier</span><span class="p">:</span> <span class="s">"CellIdentifier"</span><span class="p">)</span>
<span class="p">}</span>
</code></pre>
<p>3) Add UICollectionViewDataSource methods</p>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">YourViewController</span> <span class="p">{</span>
<span class="k">override</span> <span class="kd">func</span> <span class="nf">collectionView</span><span class="p">(</span><span class="nv">collectionView</span><span class="p">:</span> <span class="kt">UICollectionView</span><span class="p">,</span> <span class="n">numberOfItemsInSection</span> <span class="nv">section</span><span class="p">:</span> <span class="kt">Int</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">Int</span> <span class="p">{</span>
<span class="k">return</span> <span class="n">items</span><span class="o">.</span><span class="n">count</span>
<span class="p">}</span>
<span class="k">override</span> <span class="kd">func</span> <span class="nf">collectionView</span><span class="p">(</span><span class="nv">collectionView</span><span class="p">:</span> <span class="kt">UICollectionView</span><span class="p">,</span> <span class="n">cellForItemAtIndexPath</span> <span class="nv">indexPath</span><span class="p">:</span> <span class="kt">NSIndexPath</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">UICollectionViewCell</span> <span class="p">{</span>
<span class="k">let</span> <span class="nv">cell</span> <span class="o">=</span> <span class="n">collectionView</span><span class="o">.</span><span class="nf">dequeueReusableCellWithReuseIdentifier</span><span class="p">(</span><span class="s">"CellIdentifier"</span><span class="p">),</span> <span class="nv">forIndexPath</span><span class="p">:</span> <span class="n">indexPath</span><span class="p">)</span>
<span class="c1">// configure cell</span>
<span class="k">return</span> <span class="n">cell</span>
<span class="p">}</span>
<span class="p">}</span>
</code></pre>
<p>4) Open Cell animation</p>
<pre class="highlight swift"><code><span class="k">override</span> <span class="kd">func</span> <span class="nf">viewDidLoad</span><span class="p">()</span> <span class="p">{</span>
<span class="n">itemSize</span> <span class="o">=</span> <span class="kt">CGSize</span><span class="p">(</span><span class="nv">width</span><span class="p">:</span> <span class="mi">214</span><span class="p">,</span> <span class="nv">height</span><span class="p">:</span> <span class="mi">264</span><span class="p">)</span>
<span class="k">super</span><span class="o">.</span><span class="nf">viewDidLoad</span><span class="p">()</span>
<span class="c1">// register cell</span>
<span class="k">let</span> <span class="nv">nib</span> <span class="o">=</span> <span class="kt">UINib</span><span class="p">(</span><span class="nv">nibName</span><span class="p">:</span> <span class="s">"CellIdentifier"</span><span class="p">,</span> <span class="nv">bundle</span><span class="p">:</span> <span class="kc">nil</span><span class="p">)</span>
<span class="n">collectionView</span><span class="p">?</span><span class="o">.</span><span class="nf">registerNib</span><span class="p">(</span><span class="n">nib</span><span class="p">,</span> <span class="nv">forCellWithReuseIdentifier</span><span class="p">:</span> <span class="kt">String</span><span class="p">(</span><span class="kt">DemoCollectionViewCell</span><span class="p">))</span>
<span class="p">}</span>
</code></pre>
<pre class="highlight swift"><code><span class="kd">func</span> <span class="nf">collectionView</span><span class="p">(</span><span class="nv">collectionView</span><span class="p">:</span> <span class="kt">UICollectionView</span><span class="p">,</span> <span class="n">didSelectItemAtIndexPath</span> <span class="nv">indexPath</span><span class="p">:</span> <span class="kt">NSIndexPath</span><span class="p">)</span> <span class="p">{</span>
<span class="n">cell</span><span class="o">.</span><span class="nf">cellIsOpen</span><span class="p">(</span><span class="o">!</span><span class="n">cell</span><span class="o">.</span><span class="n">isOpened</span><span class="p">)</span>
<span class="p">}</span>
</code></pre>
<a href='#if_you_use_this_delegates_method' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h6 id='if_you_use_this_delegates_method'>if you use this delegates method:</h6>
<pre class="highlight plaintext"><code>func collectionView(collectionView: UICollectionView, willDisplayCell cell: UICollectionViewCell, forItemAtIndexPath indexPath: NSIndexPath)
func scrollViewDidEndDecelerating(scrollView: UIScrollView)
</code></pre>
<a href='#must_call_super_method' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h6 id='must_call_super_method'>must call super method:</h6>
<pre class="highlight plaintext"><code>func collectionView(collectionView: UICollectionView, willDisplayCell cell: UICollectionViewCell, forItemAtIndexPath indexPath: NSIndexPath) {
super.collectionView(collectionView: collectionView, willDisplayCell cell: cell, forItemAtIndexPath indexPath: indexPath)
// code
}
func scrollViewDidEndDecelerating(scrollView: UIScrollView) {
super.scrollViewDidEndDecelerating(scrollView: scrollView)
// code
}
</code></pre>
<a href='#transition_animation' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h4 id='transition_animation'>Transition animation</h4>
<p>1) Create a UITableViewController inheriting from <code>ExpandingTableViewController</code></p>
<p>2) Set header height default 236</p>
<pre class="highlight swift"><code><span class="k">override</span> <span class="kd">func</span> <span class="nf">viewDidLoad</span><span class="p">()</span> <span class="p">{</span>
<span class="k">super</span><span class="o">.</span><span class="nf">viewDidLoad</span><span class="p">()</span>
<span class="n">headerHeight</span> <span class="o">=</span> <span class="o">***</span>
<span class="p">}</span>
</code></pre>
<p>3) Call the push method in YourViewController to YourTableViewController</p>
<pre class="highlight swift"><code> <span class="k">if</span> <span class="n">cell</span><span class="o">.</span><span class="n">isOpened</span> <span class="o">==</span> <span class="kc">true</span> <span class="p">{</span>
<span class="k">let</span> <span class="nv">vc</span><span class="p">:</span> <span class="kt">YourTableViewController</span> <span class="o">=</span> <span class="c1">// ... create view controller </span>
<span class="nf">pushToViewController</span><span class="p">(</span><span class="n">vc</span><span class="p">)</span>
<span class="p">}</span>
</code></pre>
<p>4) For back transition use <code>popTransitionAnimation()</code></p>
<a href='#license' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h2 id='license'>License</h2>
<p>Expanding collection is released under the MIT license.
See <a href="./LICENSE">LICENSE</a> for details.</p>
<a href='#about' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h2 id='about'>About</h2>
<p>The project maintained by <a href="https://ramotion.com?utm_source=gthb&amp;utm_medium=special&amp;utm_campaign=expanding-collection">app development agency</a> <a href="https://ramotion.com?utm_source=gthb&amp;utm_medium=special&amp;utm_campaign=expanding-collection">Ramotion Inc.</a>
See our other <a href="https://github.com/ramotion">open-source projects</a> or <a href="https://ramotion.com?utm_source=gthb&amp;utm_medium=special&amp;utm_campaign=expanding-collection">hire</a> us to design, develop, and grow your product.</p>
<p><a href="https://twitter.com/intent/tweet?text=https://github.com/ramotion/expanding-collection"><img src="https://img.shields.io/twitter/url/http/shields.io.svg?style=social" alt="Twitter URL"></a>
<a href="https://twitter.com/ramotion"><img src="https://img.shields.io/twitter/follow/ramotion.svg?style=social" alt="Twitter Follow"></a></p>
</section>
</section>
<section id="footer">
<p>&copy; 2016 <a class="link" href="" target="_blank" rel="external">AlexKalinkin</a>. All rights reserved. (Last updated: 2016-06-07)</p>
<p>&copy; 2016 <a class="link" href="" target="_blank" rel="external">AlexKalinkin</a>. All rights reserved. (Last updated: 2016-06-10)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.5.0</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
Binary file not shown.
+146 -4
View File
@@ -46,15 +46,157 @@
<section>
<section class="section">
<a href='#demoexpandingcollection' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h1 id='demoexpandingcollection'>DemoExpandingCollection</h1>
<a href='#authors' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h3 id='authors'>Authors</h3>
<p><img src="https://raw.githubusercontent.com/Ramotion/expanding-collection/master/header.png" alt="header"></p>
<a href='#expanding_collection' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h1 id='expanding_collection'>expanding-collection</h1>
<p>AlexKalinkin</p>
<p><a href="http://twitter.com/Ramotion"><img src="https://img.shields.io/badge/Twitter-@Ramotion-blue.svg?style=flat" alt="Twitter"></a>
<a href="https://cocoapods.org/pods/expanding-collection"><img src="https://img.shields.io/cocoapods/p/expanding-collection.svg" alt="CocoaPods"></a>
<a href="http://cocoapods.org/pods/expanding-collection"><img src="https://img.shields.io/cocoapods/v/expanding-collection.svg" alt="CocoaPods"></a>
<a href="https://cdn.rawgit.com/Ramotion/expanding-collection/master/docs/index.html"><img src="https://img.shields.io/cocoapods/metrics/doc-percent/expanding-collection.svg" alt="CocoaPods"></a></p>
<p><a href="https://github.com/Ramotion/expanding-collection"><img src="https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat" alt="Carthage compatible"></a>
<a href="https://travis-ci.org/Ramotion/elastic-pull-to-update"><img src="https://travis-ci.org/Ramotion/elastic-pull-to-update.svg?branch=master" alt="Travis"></a>
<a href="https://codebeat.co/projects/github-com-ramotion-expanding-collection"><img src="https://codebeat.co/badges/6a009992-5bf2-4730-aa35-f3b20ce7693d" alt="codebeat badge"></a></p>
<p><a href="https://dribbble.com/shots/2741477-iOS-Expanding-Collection-Open-Source">shot on dribbble</a>:
<img src="https://raw.githubusercontent.com/Ramotion/expanding-collection/master/preview.gif" alt="Animation"></p>
<p>The <a href="https://store.ramotion.com/product/iphone-6-mockups?utm_source=gthb&amp;utm_medium=special&amp;utm_campaign=expanding-collection">iPhone mockup</a> available <a href="https://store.ramotion.com/product/iphone-6-mockups?utm_source=gthb&amp;utm_medium=special&amp;utm_campaign=expanding-collection">here</a>.</p>
<a href='#requirements' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h2 id='requirements'>Requirements</h2>
<ul>
<li>iOS 8.0+</li>
<li>Xcode 7.3</li>
</ul>
<a href='#installation' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h2 id='installation'>Installation</h2>
<p>Just add the Source folder to your project.</p>
<p>or use <a href="https://cocoapods.org">CocoaPods</a> with Podfile:
<code>ruby
pod &#39;expanding-collection&#39;
</code>
or <a href="https://github.com/Carthage/Carthage">Carthage</a> users can simply add to their <code>Cartfile</code>:
<code>
github &quot;Ramotion/expanding-collection&quot;
</code></p>
<a href='#usage' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h2 id='usage'>Usage</h2>
<pre class="highlight swift"><code><span class="kd">import</span> <span class="kt">ExpandingCollection</span>
</code></pre>
<a href='#create_collectionviewcell' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h4 id='create_collectionviewcell'>Create CollectionViewCell</h4>
<p><img src="https://raw.githubusercontent.com/Ramotion/expanding-collection/master/images/image2.png" alt="cell"></p>
<p>1) Create UICollectionViewCell inherit from <code>BasePageCollectionCell</code> (recommend create cell with xib file)</p>
<p>2) Adding FrontView
- add a view to YOURCELL.xib and connect it to <code>@IBOutlet weak var frontContainerView: UIView!</code><br>
- add width, height, centerX and centerY constraints (width and height constranints must equal cellSize)</p>
<p><img src="https://raw.githubusercontent.com/Ramotion/expanding-collection/master/images/image1.png" alt="cell"><br>
- connect centerY constraint to <code>@IBOutlet weak var frontConstraintY: NSLayoutConstraint!</code>
- add any desired uiviews to frontView</p>
<p>3) Adding BackView
- repeat step 2 (connect outlets to <code>@IBOutlet weak var backContainerView: UIView!</code>, <code>@IBOutlet weak var backConstraintY: NSLayoutConstraint!</code>)</p>
<p>4) Cell example <a href="https://github.com/Ramotion/expanding-collection/tree/master/DemoExpandingCollection/DemoExpandingCollection/ViewControllers/DemoViewController/Cells">DemoCell</a></p>
<a href='#if_set_code_tag_101_code_for_any_code_frontview_subviews_code_this_view_will_be_hidden_during_the_transition_animation' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h6 id='if_set_code_tag_101_code_for_any_code_frontview_subviews_code_this_view_will_be_hidden_during_the_transition_animation'>If set <code>tag = 101</code> for any <code>FrontView.subviews</code> this view will be hidden during the transition animation</h6>
<a href='#create_collectionviewcontroller' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h4 id='create_collectionviewcontroller'>Create CollectionViewController</h4>
<p>1) Create a UIViewController inheriting from <code>ExpandingViewController</code></p>
<p>2) Register Cell and set Cell size:</p>
<pre class="highlight swift"><code><span class="k">override</span> <span class="kd">func</span> <span class="nf">viewDidLoad</span><span class="p">()</span> <span class="p">{</span>
<span class="n">itemSize</span> <span class="o">=</span> <span class="kt">CGSize</span><span class="p">(</span><span class="nv">width</span><span class="p">:</span> <span class="mi">214</span><span class="p">,</span> <span class="nv">height</span><span class="p">:</span> <span class="mi">264</span><span class="p">)</span>
<span class="k">super</span><span class="o">.</span><span class="nf">viewDidLoad</span><span class="p">()</span>
<span class="c1">// register cell</span>
<span class="k">let</span> <span class="nv">nib</span> <span class="o">=</span> <span class="kt">UINib</span><span class="p">(</span><span class="nv">nibName</span><span class="p">:</span> <span class="s">"NibName"</span><span class="p">,</span> <span class="nv">bundle</span><span class="p">:</span> <span class="kc">nil</span><span class="p">)</span>
<span class="n">collectionView</span><span class="p">?</span><span class="o">.</span><span class="nf">registerNib</span><span class="p">(</span><span class="n">nib</span><span class="p">,</span> <span class="nv">forCellWithReuseIdentifier</span><span class="p">:</span> <span class="s">"CellIdentifier"</span><span class="p">)</span>
<span class="p">}</span>
</code></pre>
<p>3) Add UICollectionViewDataSource methods</p>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">YourViewController</span> <span class="p">{</span>
<span class="k">override</span> <span class="kd">func</span> <span class="nf">collectionView</span><span class="p">(</span><span class="nv">collectionView</span><span class="p">:</span> <span class="kt">UICollectionView</span><span class="p">,</span> <span class="n">numberOfItemsInSection</span> <span class="nv">section</span><span class="p">:</span> <span class="kt">Int</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">Int</span> <span class="p">{</span>
<span class="k">return</span> <span class="n">items</span><span class="o">.</span><span class="n">count</span>
<span class="p">}</span>
<span class="k">override</span> <span class="kd">func</span> <span class="nf">collectionView</span><span class="p">(</span><span class="nv">collectionView</span><span class="p">:</span> <span class="kt">UICollectionView</span><span class="p">,</span> <span class="n">cellForItemAtIndexPath</span> <span class="nv">indexPath</span><span class="p">:</span> <span class="kt">NSIndexPath</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">UICollectionViewCell</span> <span class="p">{</span>
<span class="k">let</span> <span class="nv">cell</span> <span class="o">=</span> <span class="n">collectionView</span><span class="o">.</span><span class="nf">dequeueReusableCellWithReuseIdentifier</span><span class="p">(</span><span class="s">"CellIdentifier"</span><span class="p">),</span> <span class="nv">forIndexPath</span><span class="p">:</span> <span class="n">indexPath</span><span class="p">)</span>
<span class="c1">// configure cell</span>
<span class="k">return</span> <span class="n">cell</span>
<span class="p">}</span>
<span class="p">}</span>
</code></pre>
<p>4) Open Cell animation</p>
<pre class="highlight swift"><code><span class="k">override</span> <span class="kd">func</span> <span class="nf">viewDidLoad</span><span class="p">()</span> <span class="p">{</span>
<span class="n">itemSize</span> <span class="o">=</span> <span class="kt">CGSize</span><span class="p">(</span><span class="nv">width</span><span class="p">:</span> <span class="mi">214</span><span class="p">,</span> <span class="nv">height</span><span class="p">:</span> <span class="mi">264</span><span class="p">)</span>
<span class="k">super</span><span class="o">.</span><span class="nf">viewDidLoad</span><span class="p">()</span>
<span class="c1">// register cell</span>
<span class="k">let</span> <span class="nv">nib</span> <span class="o">=</span> <span class="kt">UINib</span><span class="p">(</span><span class="nv">nibName</span><span class="p">:</span> <span class="s">"CellIdentifier"</span><span class="p">,</span> <span class="nv">bundle</span><span class="p">:</span> <span class="kc">nil</span><span class="p">)</span>
<span class="n">collectionView</span><span class="p">?</span><span class="o">.</span><span class="nf">registerNib</span><span class="p">(</span><span class="n">nib</span><span class="p">,</span> <span class="nv">forCellWithReuseIdentifier</span><span class="p">:</span> <span class="kt">String</span><span class="p">(</span><span class="kt">DemoCollectionViewCell</span><span class="p">))</span>
<span class="p">}</span>
</code></pre>
<pre class="highlight swift"><code><span class="kd">func</span> <span class="nf">collectionView</span><span class="p">(</span><span class="nv">collectionView</span><span class="p">:</span> <span class="kt">UICollectionView</span><span class="p">,</span> <span class="n">didSelectItemAtIndexPath</span> <span class="nv">indexPath</span><span class="p">:</span> <span class="kt">NSIndexPath</span><span class="p">)</span> <span class="p">{</span>
<span class="n">cell</span><span class="o">.</span><span class="nf">cellIsOpen</span><span class="p">(</span><span class="o">!</span><span class="n">cell</span><span class="o">.</span><span class="n">isOpened</span><span class="p">)</span>
<span class="p">}</span>
</code></pre>
<a href='#if_you_use_this_delegates_method' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h6 id='if_you_use_this_delegates_method'>if you use this delegates method:</h6>
<pre class="highlight plaintext"><code>func collectionView(collectionView: UICollectionView, willDisplayCell cell: UICollectionViewCell, forItemAtIndexPath indexPath: NSIndexPath)
func scrollViewDidEndDecelerating(scrollView: UIScrollView)
</code></pre>
<a href='#must_call_super_method' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h6 id='must_call_super_method'>must call super method:</h6>
<pre class="highlight plaintext"><code>func collectionView(collectionView: UICollectionView, willDisplayCell cell: UICollectionViewCell, forItemAtIndexPath indexPath: NSIndexPath) {
super.collectionView(collectionView: collectionView, willDisplayCell cell: cell, forItemAtIndexPath indexPath: indexPath)
// code
}
func scrollViewDidEndDecelerating(scrollView: UIScrollView) {
super.scrollViewDidEndDecelerating(scrollView: scrollView)
// code
}
</code></pre>
<a href='#transition_animation' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h4 id='transition_animation'>Transition animation</h4>
<p>1) Create a UITableViewController inheriting from <code>ExpandingTableViewController</code></p>
<p>2) Set header height default 236</p>
<pre class="highlight swift"><code><span class="k">override</span> <span class="kd">func</span> <span class="nf">viewDidLoad</span><span class="p">()</span> <span class="p">{</span>
<span class="k">super</span><span class="o">.</span><span class="nf">viewDidLoad</span><span class="p">()</span>
<span class="n">headerHeight</span> <span class="o">=</span> <span class="o">***</span>
<span class="p">}</span>
</code></pre>
<p>3) Call the push method in YourViewController to YourTableViewController</p>
<pre class="highlight swift"><code> <span class="k">if</span> <span class="n">cell</span><span class="o">.</span><span class="n">isOpened</span> <span class="o">==</span> <span class="kc">true</span> <span class="p">{</span>
<span class="k">let</span> <span class="nv">vc</span><span class="p">:</span> <span class="kt">YourTableViewController</span> <span class="o">=</span> <span class="c1">// ... create view controller </span>
<span class="nf">pushToViewController</span><span class="p">(</span><span class="n">vc</span><span class="p">)</span>
<span class="p">}</span>
</code></pre>
<p>4) For back transition use <code>popTransitionAnimation()</code></p>
<a href='#license' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h2 id='license'>License</h2>
<p>Expanding collection is released under the MIT license.
See <a href="./LICENSE">LICENSE</a> for details.</p>
<a href='#about' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h2 id='about'>About</h2>
<p>The project maintained by <a href="https://ramotion.com?utm_source=gthb&amp;utm_medium=special&amp;utm_campaign=expanding-collection">app development agency</a> <a href="https://ramotion.com?utm_source=gthb&amp;utm_medium=special&amp;utm_campaign=expanding-collection">Ramotion Inc.</a>
See our other <a href="https://github.com/ramotion">open-source projects</a> or <a href="https://ramotion.com?utm_source=gthb&amp;utm_medium=special&amp;utm_campaign=expanding-collection">hire</a> us to design, develop, and grow your product.</p>
<p><a href="https://twitter.com/intent/tweet?text=https://github.com/ramotion/expanding-collection"><img src="https://img.shields.io/twitter/url/http/shields.io.svg?style=social" alt="Twitter URL"></a>
<a href="https://twitter.com/ramotion"><img src="https://img.shields.io/twitter/follow/ramotion.svg?style=social" alt="Twitter Follow"></a></p>
</section>
</section>
<section id="footer">
<p>&copy; 2016 <a class="link" href="" target="_blank" rel="external">AlexKalinkin</a>. All rights reserved. (Last updated: 2016-06-07)</p>
<p>&copy; 2016 <a class="link" href="" target="_blank" rel="external">AlexKalinkin</a>. All rights reserved. (Last updated: 2016-06-10)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.5.0</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
+1 -2
View File
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'expanding-collection'
s.version = '0.0.6'
s.version = '1.0.1'
s.summary = 'Transition animtion from CollectionView to TableView'
s.license = 'MIT'
s.homepage = 'https://github.com/Ramotion/expanding-collection'
@@ -8,5 +8,4 @@ Pod::Spec.new do |s|
s.ios.deployment_target = '8.0'
s.source = { :git => 'https://github.com/Ramotion/expanding-collection.git', :tag => s.version.to_s }
s.source_files = 'Source/**/*.swift'
s.requires_arc = true
end