Compare commits

..
44 Commits
Author SHA1 Message Date
Alex K 5d062e7afb sections example 2019-06-12 11:34:53 +03:00
Alex K cad71f1978 add comments to demo project 2019-05-21 09:31:10 +03:00
Alex K 1a2e00efb8 bump version 2019-05-13 09:43:16 +03:00
Alex K 2187548e04 Fixes #169 2019-04-22 10:22:38 +03:00
Alex 21400b213b Merge pull request #159 from PeterStaev/fix-overridable-objc-method
mark method with dynamic so it can be inherited in objc
2019-04-18 17:57:08 +03:00
Alex K e94aea843f bump deployment target 2019-04-11 11:55:22 +03:00
Alex K 6f1a6fa9b6 update travis 2019-04-04 10:21:45 +03:00
Alex K 8aeec37d98 update readme 2019-03-28 10:06:06 +03:00
Alex K 29e7a6488e converted to swift 5 2019-03-28 09:56:35 +03:00
Alex K 5e21e0ef11 code improvements 2019-03-21 09:21:01 +03:00
Alex K 1b4659d06c small improves 2019-03-14 12:42:54 +03:00
Alex K e1ce24444f small fix 2019-03-07 16:27:02 +03:00
Alex K dc889f787d bump version 2019-03-01 09:20:55 +03:00
Alex K 5afa9a0fa9 code improvements 2019-02-22 09:33:36 +03:00
Alex K 851de6ba7d clean up tests 2019-02-15 09:55:32 +03:00
Alex K 0ab9b0e6a2 Cleaning tests 2019-02-08 11:17:18 +03:00
Alex K ed1785d514 test case refactor 2019-02-01 12:31:05 +03:00
Alex K d310932e45 fileprivate to private 2019-01-25 09:59:22 +03:00
Alex K 8e1d1040df clean tests 2019-01-18 09:56:15 +03:00
Alex K f5847da4fb Merge branch 'master' of github.com:Ramotion/folding-cell 2019-01-11 10:26:34 +03:00
Alex K faf95986ac add test method testRotateX 2019-01-11 10:26:03 +03:00
Ramotion 71708c994e Update README.md 2019-01-04 12:31:02 +03:00
Ramotion 0b403320fa Add files via upload 2018-12-27 07:45:31 -08:00
Ramotion 5d041c1bac Update README.md 2018-12-27 18:05:24 +03:00
Ramotion 8e56e7cd18 Update README.md 2018-12-27 17:03:37 +03:00
Ramotion a056df2e23 Update Header 2018-12-27 06:01:04 -08:00
Ramotion 6bb7bc1051 Update README.md 2018-12-27 16:57:08 +03:00
Ramotion 68c1c15831 Update README.md 2018-12-21 12:50:32 +03:00
Ramotion 2ab14733a5 Update README.md 2018-12-20 14:15:02 +03:00
Alex K 2900fcb254 Merge branch 'master' of github.com:Ramotion/folding-cell 2018-12-17 10:30:40 +03:00
Alex K 5f11f00043 add test 2018-12-17 10:30:10 +03:00
Ramotion 7f0951ca09 Update README.md 2018-12-10 11:57:24 +03:00
Ramotion 08908652c1 Update README.md 2018-12-10 10:16:11 +03:00
Alex K 3981f6930b add test file for RotationView class 2018-12-04 10:07:14 +03:00
Alex K c6c6dd6254 change deployment target 2018-11-27 10:46:46 +03:00
Alex K f6121df6eb add test scheme 2018-11-20 09:58:45 +03:00
Alex K 86ced39c50 update travis 2018-11-20 09:50:35 +03:00
Alex K 7648567b0a travis 2018-11-20 09:43:08 +03:00
Alex K f325b3c7c0 update travis yml 2018-11-13 10:27:05 +03:00
Alex K 50e0ebbf97 improve test unfold method 2018-11-06 10:25:46 +03:00
Alex K 3d7e47951f update podspec 2018-10-30 10:13:52 +03:00
Alex K 5d31dfa9bf Merge branch 'master' of github.com:Ramotion/folding-cell 2018-10-23 09:25:56 +03:00
Juri Vasylenko 42ef7ce2f2 Update README.md 2018-10-16 19:35:02 +03:00
Peter Staev a4ea00866e mark method with dynamic so it can be inherited in objc 2018-09-14 16:37:12 +03:00
11 changed files with 189 additions and 106 deletions
+2 -4
View File
@@ -1,11 +1,9 @@
osx_image: xcode9.2
osx_image: xcode10.2
language: objective-c
xcode_project: FoldingCell/FoldingCell.xcodeproj
xcode_scheme: FoldingCell
xcode_sdk: iphonesimulator11.2
# SWIFT_VERSION: 4.0
xcode_sdk: iphonesimulator12.2
# whitelist
branches:
+1 -1
View File
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'FoldingCell'
s.version = '4.0.1'
s.version = '5.0.1'
s.summary = 'UITableViewCell with folding animation.'
s.homepage = 'https://github.com/Ramotion/folding-cell'
s.license = 'MIT'
@@ -1,37 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13771" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="0cn-rv-Emg">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="F7s-7m-uhL">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13772"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14490.49"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<customFonts key="customFonts">
<array key="OpenSans-Light.ttf">
<string>OpenSans-Light</string>
</array>
<array key="OpenSans-Regular.ttf">
<string>OpenSans</string>
</array>
<array key="OpenSans-Semibold.ttf">
<string>OpenSans-Semibold</string>
</array>
</customFonts>
<scenes>
<!--Main Table View Controller-->
<scene sceneID="Q2d-BE-geS">
<objects>
<tableViewController storyboardIdentifier="MainTableViewController" id="0cn-rv-Emg" customClass="MainTableViewController" customModule="FoldingCell_Demo" customModuleProvider="target" sceneMemberID="viewController">
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" dataMode="prototypes" style="plain" separatorStyle="none" rowHeight="667" sectionHeaderHeight="28" sectionFooterHeight="28" id="MwZ-K3-six">
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" dataMode="prototypes" style="grouped" separatorStyle="none" rowHeight="667" sectionHeaderHeight="18" sectionFooterHeight="18" id="MwZ-K3-six">
<rect key="frame" x="0.0" y="0.0" width="600" height="708"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
<color key="sectionIndexBackgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="FoldingCell" rowHeight="667" id="fgm-B1-nUi" customClass="DemoCell" customModule="FoldingCell_Demo" customModuleProvider="target">
<rect key="frame" x="0.0" y="28" width="600" height="667"/>
<rect key="frame" x="0.0" y="55.5" width="600" height="667"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="fgm-B1-nUi" id="MxP-E5-nua">
<rect key="frame" x="0.0" y="0.0" width="600" height="667"/>
@@ -381,7 +370,7 @@
<rect key="frame" x="79" y="50.5" width="97" height="17"/>
</imageView>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="photo" translatesAutoresizingMaskIntoConstraints="NO" id="Nm8-JU-yEj" userLabel="photo">
<rect key="frame" x="22" y="28" width="49" height="49"/>
<rect key="frame" x="22" y="28" width="49.000000000000028" height="49.000000000000028"/>
<constraints>
<constraint firstAttribute="height" constant="49" id="JNu-y1-BLY"/>
<constraint firstAttribute="width" constant="49" id="qpi-cG-s4a"/>
@@ -693,19 +682,38 @@
<outlet property="delegate" destination="0cn-rv-Emg" id="o83-eX-gao"/>
</connections>
</tableView>
<navigationItem key="navigationItem" id="Nrx-NB-MRU"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<size key="freeformSize" width="600" height="708"/>
</tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="WxO-6i-Q9B" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="43" y="296"/>
<point key="canvasLocation" x="980.79999999999995" y="295.95202398800603"/>
</scene>
<!--Navigation Controller-->
<scene sceneID="vcD-Fk-7r9">
<objects>
<navigationController automaticallyAdjustsScrollViewInsets="NO" id="F7s-7m-uhL" sceneMemberID="viewController">
<toolbarItems/>
<navigationBar key="navigationBar" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" id="sRx-TU-YI7">
<rect key="frame" x="0.0" y="20" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
<nil name="viewControllers"/>
<connections>
<segue destination="0cn-rv-Emg" kind="relationship" relationship="rootViewController" id="ibO-U9-Alo"/>
</connections>
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="XoX-zC-yNs" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="42.399999999999999" y="295.50224887556226"/>
</scene>
</scenes>
<resources>
<image name="arrow" width="16" height="25"/>
<image name="burger" width="38" height="29"/>
<image name="dots" width="14" height="84"/>
<image name="image" width="340" height="165"/>
<image name="image" width="340.5" height="165"/>
<image name="photo" width="98" height="98"/>
<image name="stars" width="97" height="17"/>
</resources>
@@ -30,17 +30,20 @@ class MainTableViewController: UITableViewController {
static let closeCellHeight: CGFloat = 179
static let openCellHeight: CGFloat = 488
static let rowsCount = 10
static let sectionCount = 5
}
var cellHeights: [CGFloat] = []
private var cellHeights: [[CGFloat]] = (0..<Const.sectionCount).map { _ in Array(repeating: Const.closeCellHeight, count: Const.rowsCount) }
// MARK: Life Cycle
override func viewDidLoad() {
super.viewDidLoad()
setup()
tableView.sectionFooterHeight = 0
}
// MARK: Helpers
private func setup() {
cellHeights = Array(repeating: Const.closeCellHeight, count: Const.rowsCount)
tableView.estimatedRowHeight = Const.closeCellHeight
tableView.rowHeight = UITableView.automaticDimension
tableView.backgroundColor = UIColor(patternImage: #imageLiteral(resourceName: "background"))
@@ -50,6 +53,7 @@ class MainTableViewController: UITableViewController {
}
}
// MARK: Actions
@objc func refreshHandler() {
let deadlineTime = DispatchTime.now() + .seconds(1)
DispatchQueue.main.asyncAfter(deadline: deadlineTime, execute: { [weak self] in
@@ -64,9 +68,23 @@ class MainTableViewController: UITableViewController {
// MARK: - TableView
extension MainTableViewController {
override func numberOfSections(in tableView: UITableView) -> Int {
return cellHeights.count
}
override func tableView(_: UITableView, numberOfRowsInSection _: Int) -> Int {
return 10
override func tableView(_: UITableView, numberOfRowsInSection section: Int) -> Int {
return cellHeights[section].count
}
override func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let view = UIView()
view.backgroundColor = .red
return view
}
override func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
return 44
}
override func tableView(_: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {
@@ -76,7 +94,7 @@ extension MainTableViewController {
cell.backgroundColor = .clear
if cellHeights[indexPath.row] == Const.closeCellHeight {
if cellHeights[indexPath.section][indexPath.row] == Const.closeCellHeight {
cell.unfold(false, animated: false, completion: nil)
} else {
cell.unfold(true, animated: false, completion: nil)
@@ -94,7 +112,7 @@ extension MainTableViewController {
}
override func tableView(_: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return cellHeights[indexPath.row]
return cellHeights[indexPath.section][indexPath.row]
}
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
@@ -106,13 +124,13 @@ extension MainTableViewController {
}
var duration = 0.0
let cellIsCollapsed = cellHeights[indexPath.row] == Const.closeCellHeight
let cellIsCollapsed = cellHeights[indexPath.section][indexPath.row] == Const.closeCellHeight
if cellIsCollapsed {
cellHeights[indexPath.row] = Const.openCellHeight
cellHeights[indexPath.section][indexPath.row] = Const.openCellHeight
cell.unfold(true, animated: true, completion: nil)
duration = 0.5
} else {
cellHeights[indexPath.row] = Const.closeCellHeight
cellHeights[indexPath.section][indexPath.row] = Const.closeCellHeight
cell.unfold(false, animated: true, completion: nil)
duration = 0.8
}
@@ -120,6 +138,11 @@ extension MainTableViewController {
UIView.animate(withDuration: duration, delay: 0, options: .curveEaseOut, animations: { () -> Void in
tableView.beginUpdates()
tableView.endUpdates()
// fix https://github.com/Ramotion/folding-cell/issues/169
if cell.frame.maxY > tableView.frame.maxY {
tableView.scrollToRow(at: indexPath, at: UITableView.ScrollPosition.bottom, animated: true)
}
}, completion: nil)
}
}
@@ -8,6 +8,7 @@
/* Begin PBXBuildFile section */
5A0E1C3021414940006A0374 /* FoldingCellDemoTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5A0E1C2F21414940006A0374 /* FoldingCellDemoTests.swift */; };
5A1225D821B65E8E005BBB26 /* RotationViewTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5A1225D721B65E8E005BBB26 /* RotationViewTests.swift */; };
8499D8881D0054A8004B5B37 /* FoldingCell.h in Headers */ = {isa = PBXBuildFile; fileRef = 8499D8871D0054A8004B5B37 /* FoldingCell.h */; settings = {ATTRIBUTES = (Public, ); }; };
9D57F31F1EDC7A6F0004599F /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9D57F31E1EDC7A6F0004599F /* AppDelegate.swift */; };
9D57F3241EDC7A6F0004599F /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9D57F3221EDC7A6F0004599F /* Main.storyboard */; };
@@ -81,6 +82,7 @@
5A0E1C2D21414940006A0374 /* FoldingCellDemoTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = FoldingCellDemoTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
5A0E1C2F21414940006A0374 /* FoldingCellDemoTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FoldingCellDemoTests.swift; sourceTree = "<group>"; };
5A0E1C3121414940006A0374 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
5A1225D721B65E8E005BBB26 /* RotationViewTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RotationViewTests.swift; sourceTree = "<group>"; };
8499D8851D0054A8004B5B37 /* FoldingCell.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = FoldingCell.framework; sourceTree = BUILT_PRODUCTS_DIR; };
8499D8871D0054A8004B5B37 /* FoldingCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FoldingCell.h; sourceTree = "<group>"; };
8499D8891D0054A8004B5B37 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
@@ -144,6 +146,7 @@
children = (
5A0E1C2F21414940006A0374 /* FoldingCellDemoTests.swift */,
5A0E1C3121414940006A0374 /* Info.plist */,
5A1225D721B65E8E005BBB26 /* RotationViewTests.swift */,
);
path = FoldingCellDemoTests;
sourceTree = "<group>";
@@ -313,24 +316,24 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0940;
LastUpgradeCheck = 0940;
LastUpgradeCheck = 1020;
ORGANIZATIONNAME = "Alex K.";
TargetAttributes = {
5A0E1C2C21414940006A0374 = {
CreatedOnToolsVersion = 9.4;
LastSwiftMigration = 1000;
LastSwiftMigration = 1020;
ProvisioningStyle = Automatic;
TestTargetID = 9D57F31B1EDC7A6F0004599F;
};
8499D8841D0054A8004B5B37 = {
CreatedOnToolsVersion = 7.3.1;
DevelopmentTeam = LEAZS7L33U;
LastSwiftMigration = 1000;
LastSwiftMigration = 1020;
};
9D57F31B1EDC7A6F0004599F = {
CreatedOnToolsVersion = 8.3.2;
DevelopmentTeam = 34MUF9YXTA;
LastSwiftMigration = 1000;
DevelopmentTeam = LEAZS7L33U;
LastSwiftMigration = 1020;
ProvisioningStyle = Automatic;
};
9DAA51531EDDBAD700DFC539 = {
@@ -342,7 +345,7 @@
};
buildConfigurationList = 847A57FF1C294F750028FB84 /* Build configuration list for PBXProject "FoldingCell" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
@@ -403,6 +406,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
5A1225D821B65E8E005BBB26 /* RotationViewTests.swift in Sources */,
5A0E1C3021414940006A0374 /* FoldingCellDemoTests.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
@@ -509,7 +513,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.ramotion.FoldingCellDemoTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/FoldingCell-Demo.app/FoldingCell-Demo";
};
@@ -532,7 +536,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.ramotion.FoldingCellDemoTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/FoldingCell-Demo.app/FoldingCell-Demo";
};
@@ -542,6 +546,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
@@ -584,7 +589,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.4;
IPHONEOS_DEPLOYMENT_TARGET = 12.2;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
@@ -596,6 +601,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
@@ -632,7 +638,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.4;
IPHONEOS_DEPLOYMENT_TARGET = 12.2;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
@@ -661,7 +667,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
@@ -688,7 +694,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.ramotion.FoldingCell;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
@@ -705,15 +711,15 @@
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
DEVELOPMENT_TEAM = 34MUF9YXTA;
DEVELOPMENT_TEAM = LEAZS7L33U;
INFOPLIST_FILE = "FoldingCell-Demo/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "ramotion.com.FoldingCell-Demo";
PRODUCT_BUNDLE_IDENTIFIER = "ramotion.com.FoldingCell-Demo-ser";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
@@ -727,14 +733,14 @@
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
DEVELOPMENT_TEAM = 34MUF9YXTA;
DEVELOPMENT_TEAM = LEAZS7L33U;
INFOPLIST_FILE = "FoldingCell-Demo/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "ramotion.com.FoldingCell-Demo";
PRODUCT_BUNDLE_IDENTIFIER = "ramotion.com.FoldingCell-Demo-ser";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
};
name = Release;
};
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0940"
LastUpgradeVersion = "1020"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@@ -28,7 +28,26 @@
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "5A0E1C2C21414940006A0374"
BuildableName = "FoldingCellDemoTests.xctest"
BlueprintName = "FoldingCellDemoTests"
ReferencedContainer = "container:FoldingCell.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "8499D8841D0054A8004B5B37"
BuildableName = "FoldingCell.framework"
BlueprintName = "FoldingCell"
ReferencedContainer = "container:FoldingCell.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
+8 -12
View File
@@ -26,6 +26,8 @@ import UIKit
/// UITableViewCell with folding animation
open class FoldingCell: UITableViewCell {
@objc open var isUnfolded = false
/// UIView is displayed when cell open
@IBOutlet open var containerView: UIView!
@IBOutlet open var containerViewTop: NSLayoutConstraint!
@@ -76,7 +78,7 @@ open class FoldingCell: UITableViewCell {
// MARK: configure
func configureDefaultState() {
private func configureDefaultState() {
guard let foregroundViewTop = self.foregroundViewTop,
let containerViewTop = self.containerViewTop else {
@@ -96,7 +98,7 @@ open class FoldingCell: UITableViewCell {
contentView.bringSubviewToFront(foregroundView)
}
func createAnimationItemView() -> [RotatedView] {
private func createAnimationItemView() -> [RotatedView] {
var items = [RotatedView]()
items.append(foregroundView)
@@ -129,12 +131,8 @@ open class FoldingCell: UITableViewCell {
.lazy
.compactMap { $0 as? RotatedView }
.forEach {
if animationType == .open {
$0.alpha = 0
} else {
$0.alpha = 1
$0.backView?.alpha = 0
}
$0.alpha = animationType == .open ? 0 : 1
if animationType != .open { $0.backView?.alpha = 0 }
}
}
}
@@ -279,11 +277,9 @@ open class FoldingCell: UITableViewCell {
return animationView?.alpha == 1 ? true : false
}
@objc open var isUnfolded = false
// MARK: Animations
@objc open func animationDuration(_ itemIndex: NSInteger, type: AnimationType) -> TimeInterval {
@objc open dynamic func animationDuration(_ itemIndex: NSInteger, type: AnimationType) -> TimeInterval {
return type == .close ? durationsForCollapsedState[itemIndex] : durationsForExpandedState[itemIndex]
}
@@ -404,7 +400,7 @@ open class FoldingCell: UITableViewCell {
open class RotatedView: UIView {
fileprivate enum Const {
private enum Const {
static let rotationX = "rotation.x"
static let transformRotationX = "transform.rotation.x"
}
@@ -1,11 +1,3 @@
//
// FoldingCellDemoTests.swift
// FoldingCellDemoTests
//
// Created by Alex K on 06/09/2018.
// Copyright © 2018 Alex K. All rights reserved.
//
import XCTest
import UIKit
@testable import FoldingCell
@@ -24,11 +16,6 @@ class FoldingCellDemoTests: XCTestCase {
foldingCell = vc.tableView.dequeueReusableCell(withIdentifier: "FoldingCell", for: IndexPath(row: 0, section: 0)) as? FoldingCell
}
override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
super.tearDown()
}
func testCreateFoldingCell() {
XCTAssertNotNil(foldingCell)
}
@@ -37,5 +24,7 @@ class FoldingCellDemoTests: XCTestCase {
XCTAssertEqual(foldingCell.isUnfolded, false)
foldingCell.unfold(true)
XCTAssertEqual(foldingCell.isUnfolded, true)
foldingCell.unfold(false)
XCTAssertEqual(foldingCell.isUnfolded, false)
}
}
@@ -0,0 +1,37 @@
import XCTest
import UIKit
@testable import FoldingCell
class RotationViewTests: XCTestCase {
var rotationView: RotatedView!
override func setUp() {
rotationView = RotatedView()
}
func testCreateRotationView() {
XCTAssertNotNil(rotationView)
}
func testAddBackView() {
XCTAssertNil(rotationView.backView)
let color = UIColor.red
rotationView.addBackView(100, color: color)
XCTAssertNotNil(rotationView.backView)
XCTAssertEqual(rotationView.backView?.backgroundColor, color)
}
func testRotateX() {
let key = "layer.transform.rotation.x"
let startX = (rotationView.value(forKeyPath: key) as? NSNumber)?.floatValue
XCTAssertEqual(startX, 0)
let angel: CGFloat = 0.5
rotationView.rotatedX(angel)
let x = (rotationView.value(forKeyPath: key) as? NSNumber)?.floatValue
XCTAssertEqual(x, Float(angel))
}
}
+36 -29
View File
@@ -1,35 +1,42 @@
![header](./header.png)
<img src="https://github.com/Ramotion/folding-cell/blob/master/Screenshots/foldingCell.gif" width="600" height="450" /></a>
<br><br/>
<img src="https://github.com/Ramotion/folding-cell/blob/master/header.png">
<a href="https://github.com/Ramotion/folding-cell">
<img align="left" src="https://github.com/Ramotion/folding-cell/blob/master/Screenshots/foldingCell.gif" width="480" height="360" /></a>
<p><h1 align="left">FOLDING CELL</h1></p>
<h4>Expanding content cell with animation inspired by folding paper card material design.</h4>
___
<p><h6>We specialize in the designing and coding of custom UI for Mobile Apps and Websites.</h6>
<a href="https://dev.ramotion.com?utm_source=gthb&utm_medium=repo&utm_campaign=folding-cell">
<img src="https://github.com/ramotion/gliding-collection/raw/master/contact_our_team@2x.png" width="187" height="34"></a>
</p>
<p><h6>Stay tuned for the latest updates:</h6>
<a href="https://goo.gl/rPFpid" >
<img src="https://i.imgur.com/ziSqeSo.png/" width="156" height="28"></a></p>
<h6><a href="https://store.ramotion.com/product/iphone-x-clay-mockups?utm_source=gthb&utm_medium=special&utm_campaign=folding-cell#demo">Get Free Mockup For your project →</a></h6>
</br>
# FoldingCell
[![CocoaPods](https://img.shields.io/cocoapods/p/FoldingCell.svg)](https://cocoapods.org/pods/FoldingCell)
[![CocoaPods](https://img.shields.io/cocoapods/v/FoldingCell.svg)](http://cocoapods.org/pods/FoldingCell)
[![Twitter](https://img.shields.io/badge/Twitter-@Ramotion-blue.svg?style=flat)](http://twitter.com/Ramotion)
[![Travis](https://img.shields.io/travis/Ramotion/folding-cell.svg)](https://travis-ci.org/Ramotion/folding-cell)
[![codebeat badge](https://codebeat.co/badges/6f67da5d-c416-4bac-9fb7-c2dc938feedc)](https://codebeat.co/projects/github-com-ramotion-folding-cell)
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)
[![Swift 4.0](https://img.shields.io/badge/Swift-4.0-green.svg?style=flat)](https://developer.apple.com/swift/)
[![Swift 4.0](https://img.shields.io/badge/Swift-5.0-green.svg?style=flat)](https://developer.apple.com/swift/)
[![Analytics](https://ga-beacon.appspot.com/UA-84973210-1/ramotion/folding-cell)](https://github.com/igrigorik/ga-beacon)
[![Donate](https://img.shields.io/badge/Donate-PayPal-blue.svg)](https://paypal.me/Ramotion)
# Check this library on other platforms:
<a href="https://github.com/Ramotion/folding-cell-android">
<img src="https://github.com/ramotion/navigation-stack/raw/master/Android_Java@2x.png" width="178" height="81"></a>
**Looking for developers for your project?**<br>
This project is maintained by Ramotion, Inc. We specialize in the designing and coding of custom UI for Mobile Apps and Websites.
<a href="mailto:alex.a@ramotion.com?subject=Project%20inquiry%20from%20Github">
<img src="https://github.com/ramotion/gliding-collection/raw/master/contact_our_team@2x.png" width="187" height="34"></a> <br>
The [iPhone mockup](https://store.ramotion.com/product/iphone-x-clay-mockups?utm_source=gthb&utm_medium=special&utm_campaign=folding-cell) available [here](https://store.ramotion.com?utm_source=gthb&utm_medium=special&utm_campaign=folding-cell).
## Requirements
- iOS 8.0+
- Xcode 9.0+
- Xcode 10.2
## Installation
@@ -42,7 +49,6 @@ pod 'FoldingCell'
or [Carthage](https://github.com/Carthage/Carthage) users can simply add Mantle to their `Cartfile`:
```
github "Ramotion/folding-cell"
```
or just drag and drop FoldingCell.swift file to your project
@@ -156,24 +162,25 @@ fileprivate struct C {
Create foregroundView and containerView from code (steps 2 - 3) look example:
[Folding-cell-programmatically](https://github.com/ober01/Folding-cell-programmatically)
## Licence
## 🗂 Check this library on other language:
<a href="https://github.com/Ramotion/folding-cell-android">
<img src="https://github.com/ramotion/navigation-stack/raw/master/Android_Java@2x.png" width="178" height="81"></a>
## 📄 License
Folding cell is released under the MIT license.
See [LICENSE](./LICENSE) for details.
This library is a part of a <a href="https://github.com/Ramotion/swift-ui-animation-components-and-libraries"><b>selection of our best UI open-source projects.</b></a>
# Get the Showroom App for iOS to give it a try
If you use the open-source library in your project, please make sure to credit and backlink to www.ramotion.com
## 📱 Get the Showroom App for iOS to give it a try
Try this UI component and more like this in our iOS app. Contact us if interested.
<a href="https://itunes.apple.com/app/apple-store/id1182360240?pt=550053&ct=folding-cell&mt=8" >
<img src="https://github.com/ramotion/gliding-collection/raw/master/app_store@2x.png" width="117" height="34"></a>
<a href="mailto:alex.a@ramotion.com?subject=Project%20inquiry%20from%20Github">
<a href="https://dev.ramotion.com?utm_source=gthb&utm_medium=repo&utm_campaign=folding-cell">
<img src="https://github.com/ramotion/gliding-collection/raw/master/contact_our_team@2x.png" width="187" height="34"></a>
<br>
<br>
## Follow us for the latest update<br>
<a href="https://goo.gl/rPFpid" >
<img src="https://i.imgur.com/ziSqeSo.png/" width="156" height="28"></a>
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 16 KiB