Compare commits

...
17 Commits
Author SHA1 Message Date
Alex K 2285009361 small improvements 2018-10-23 09:24:41 +03:00
Alex K f6d649a79c update podspec 2018-10-16 09:16:56 +03:00
Alex K 2bc6905e3a make openAnimation and closeAnimation functions private 2018-10-09 09:23:41 +03:00
Alex K f279359721 update swift-version file 2018-10-01 11:29:22 +03:00
Alex K 859a868aa4 add unfold test 2018-09-24 10:01:20 +03:00
Alex K c9c516dc19 update podspec 2018-09-17 10:34:01 +03:00
Alex K 3335c26e78 converted to swift 4.2 2018-09-17 10:32:37 +03:00
Alex K 27d2bc7a62 update podspec 2018-09-17 10:30:41 +03:00
Alex 882a279d56 Merge pull request #157 from PeterStaev/nativescript
Export important APIs to ObjC
2018-09-10 09:51:04 +03:00
Alex K 959c31e2c5 add firs test create folding cell 2018-09-06 14:45:13 +03:00
Peter Staev 8777fc4410 expose enum to ObjC 2018-09-03 16:31:56 +03:00
Peter Staev 27b748230b export animationDuration to ObjC 2018-09-03 16:23:36 +03:00
Peter Staev f887081e42 export isUnfolded to ObjC 2018-09-03 16:23:25 +03:00
Peter Staev 370b3dae99 expose commonInit to ObjC 2018-08-31 19:08:20 +03:00
Alex K d6e2b6cebb test init 2018-08-30 17:42:21 +03:00
Alex K a102990f70 add Tests target 2018-08-24 10:58:25 +03:00
Alex K 78f726da6b update podspec 2018-08-17 09:59:14 +03:00
11 changed files with 212 additions and 89 deletions
+1 -1
View File
@@ -1 +1 @@
4.0
4.2
+1 -1
View File
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'FoldingCell'
s.version = '3.1.3'
s.version = '4.0.1'
s.summary = 'UITableViewCell with folding animation.'
s.homepage = 'https://github.com/Ramotion/folding-cell'
s.license = 'MIT'
@@ -28,7 +28,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_: UIApplication, didFinishLaunchingWithOptions _: [UIApplicationLaunchOptionsKey: Any]? = nil) -> Bool {
func application(_: UIApplication, didFinishLaunchingWithOptions _: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
return true
}
}
@@ -39,6 +39,11 @@
"idiom" : "iphone",
"size" : "60x60",
"scale" : "3x"
},
{
"idiom" : "ios-marketing",
"size" : "1024x1024",
"scale" : "1x"
}
],
"info" : {
@@ -42,7 +42,7 @@ class MainTableViewController: UITableViewController {
private func setup() {
cellHeights = Array(repeating: Const.closeCellHeight, count: Const.rowsCount)
tableView.estimatedRowHeight = Const.closeCellHeight
tableView.rowHeight = UITableViewAutomaticDimension
tableView.rowHeight = UITableView.automaticDimension
tableView.backgroundColor = UIColor(patternImage: #imageLiteral(resourceName: "background"))
if #available(iOS 10.0, *) {
tableView.refreshControl = UIRefreshControl()
@@ -1,10 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12120" systemVersion="16F73" 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="14113" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="0cn-rv-Emg">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12088"/>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<customFonts key="customFonts">
@@ -22,7 +23,7 @@
<!--Item-->
<scene sceneID="Q2d-BE-geS">
<objects>
<tableViewController storyboardIdentifier="TableViewController" id="0cn-rv-Emg" customClass="TableViewController" sceneMemberID="viewController">
<tableViewController storyboardIdentifier="TableViewController" id="0cn-rv-Emg" customClass="MainTableViewController" customModule="FoldingCell_Demo" 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">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+110 -68
View File
@@ -7,6 +7,7 @@
objects = {
/* Begin PBXBuildFile section */
5A0E1C3021414940006A0374 /* FoldingCellDemoTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5A0E1C2F21414940006A0374 /* FoldingCellDemoTests.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 */; };
@@ -28,6 +29,13 @@
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
5A0E1C3221414940006A0374 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 847A57FC1C294F750028FB84 /* Project object */;
proxyType = 1;
remoteGlobalIDString = 9D57F31B1EDC7A6F0004599F;
remoteInfo = "FoldingCell-Demo";
};
9D57F3361EDC7AD80004599F /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 847A57FC1C294F750028FB84 /* Project object */;
@@ -70,7 +78,9 @@
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
8498513C1C5639F9006FA400 /* FoldingCellTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = FoldingCellTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
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>"; };
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>"; };
@@ -96,7 +106,7 @@
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
849851391C5639F9006FA400 /* Frameworks */ = {
5A0E1C2A21414940006A0374 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
@@ -129,12 +139,22 @@
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
5A0E1C2E21414940006A0374 /* FoldingCellDemoTests */ = {
isa = PBXGroup;
children = (
5A0E1C2F21414940006A0374 /* FoldingCellDemoTests.swift */,
5A0E1C3121414940006A0374 /* Info.plist */,
);
path = FoldingCellDemoTests;
sourceTree = "<group>";
};
847A57FB1C294F750028FB84 = {
isa = PBXGroup;
children = (
8499D8861D0054A8004B5B37 /* FoldingCell */,
9D57F31D1EDC7A6F0004599F /* FoldingCell-Demo */,
9DAA51551EDDBAD700DFC539 /* FoldingCell-DemoObjc */,
5A0E1C2E21414940006A0374 /* FoldingCellDemoTests */,
847A58051C294F750028FB84 /* Products */,
);
sourceTree = "<group>";
@@ -142,10 +162,10 @@
847A58051C294F750028FB84 /* Products */ = {
isa = PBXGroup;
children = (
8498513C1C5639F9006FA400 /* FoldingCellTests.xctest */,
8499D8851D0054A8004B5B37 /* FoldingCell.framework */,
9D57F31C1EDC7A6F0004599F /* FoldingCell-Demo.app */,
9DAA51541EDDBAD700DFC539 /* FoldingCell-DemoObjc.app */,
5A0E1C2D21414940006A0374 /* FoldingCellDemoTests.xctest */,
);
name = Products;
sourceTree = "<group>";
@@ -212,21 +232,22 @@
/* End PBXHeadersBuildPhase section */
/* Begin PBXNativeTarget section */
8498513B1C5639F9006FA400 /* FoldingCellTests */ = {
5A0E1C2C21414940006A0374 /* FoldingCellDemoTests */ = {
isa = PBXNativeTarget;
buildConfigurationList = 849851431C5639F9006FA400 /* Build configuration list for PBXNativeTarget "FoldingCellTests" */;
buildConfigurationList = 5A0E1C3421414940006A0374 /* Build configuration list for PBXNativeTarget "FoldingCellDemoTests" */;
buildPhases = (
849851381C5639F9006FA400 /* Sources */,
849851391C5639F9006FA400 /* Frameworks */,
8498513A1C5639F9006FA400 /* Resources */,
5A0E1C2921414940006A0374 /* Sources */,
5A0E1C2A21414940006A0374 /* Frameworks */,
5A0E1C2B21414940006A0374 /* Resources */,
);
buildRules = (
);
dependencies = (
5A0E1C3321414940006A0374 /* PBXTargetDependency */,
);
name = FoldingCellTests;
productName = FoldingCellTests;
productReference = 8498513C1C5639F9006FA400 /* FoldingCellTests.xctest */;
name = FoldingCellDemoTests;
productName = FoldingCellDemoTests;
productReference = 5A0E1C2D21414940006A0374 /* FoldingCellDemoTests.xctest */;
productType = "com.apple.product-type.bundle.unit-test";
};
8499D8841D0054A8004B5B37 /* FoldingCell */ = {
@@ -291,25 +312,25 @@
847A57FC1C294F750028FB84 /* Project object */ = {
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0830;
LastUpgradeCheck = 0930;
LastSwiftUpdateCheck = 0940;
LastUpgradeCheck = 0940;
ORGANIZATIONNAME = "Alex K.";
TargetAttributes = {
8498513B1C5639F9006FA400 = {
CreatedOnToolsVersion = 7.2;
DevelopmentTeam = 2VFCBFYPFW;
LastSwiftMigration = 0800;
TestTargetID = 847A58031C294F750028FB84;
5A0E1C2C21414940006A0374 = {
CreatedOnToolsVersion = 9.4;
LastSwiftMigration = 1000;
ProvisioningStyle = Automatic;
TestTargetID = 9D57F31B1EDC7A6F0004599F;
};
8499D8841D0054A8004B5B37 = {
CreatedOnToolsVersion = 7.3.1;
DevelopmentTeam = LEAZS7L33U;
LastSwiftMigration = 0830;
LastSwiftMigration = 1000;
};
9D57F31B1EDC7A6F0004599F = {
CreatedOnToolsVersion = 8.3.2;
DevelopmentTeam = 34MUF9YXTA;
LastSwiftMigration = 0920;
LastSwiftMigration = 1000;
ProvisioningStyle = Automatic;
};
9DAA51531EDDBAD700DFC539 = {
@@ -335,13 +356,13 @@
8499D8841D0054A8004B5B37 /* FoldingCell */,
9D57F31B1EDC7A6F0004599F /* FoldingCell-Demo */,
9DAA51531EDDBAD700DFC539 /* FoldingCell-DemoObjc */,
8498513B1C5639F9006FA400 /* FoldingCellTests */,
5A0E1C2C21414940006A0374 /* FoldingCellDemoTests */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
8498513A1C5639F9006FA400 /* Resources */ = {
5A0E1C2B21414940006A0374 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
@@ -378,10 +399,11 @@
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
849851381C5639F9006FA400 /* Sources */ = {
5A0E1C2921414940006A0374 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
5A0E1C3021414940006A0374 /* FoldingCellDemoTests.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -416,6 +438,11 @@
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
5A0E1C3321414940006A0374 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 9D57F31B1EDC7A6F0004599F /* FoldingCell-Demo */;
targetProxy = 5A0E1C3221414940006A0374 /* PBXContainerItemProxy */;
};
9D57F3371EDC7AD80004599F /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 8499D8841D0054A8004B5B37 /* FoldingCell */;
@@ -464,6 +491,53 @@
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
5A0E1C3521414940006A0374 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_IDENTITY = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
GCC_C_LANGUAGE_STANDARD = gnu11;
INFOPLIST_FILE = FoldingCellDemoTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.ramotion.FoldingCellDemoTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/FoldingCell-Demo.app/FoldingCell-Demo";
};
name = Debug;
};
5A0E1C3621414940006A0374 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_IDENTITY = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
GCC_C_LANGUAGE_STANDARD = gnu11;
INFOPLIST_FILE = FoldingCellDemoTests/Info.plist;
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;
TARGETED_DEVICE_FAMILY = "1,2";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/FoldingCell-Demo.app/FoldingCell-Demo";
};
name = Release;
};
847A58141C294F750028FB84 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
@@ -566,36 +640,6 @@
};
name = Release;
};
849851441C5639F9006FA400 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = 2VFCBFYPFW;
INFOPLIST_FILE = FoldingCellTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.ramotion.FoldingCellTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/FoldingCellDemo.app/FoldingCellDemo";
};
name = Debug;
};
849851451C5639F9006FA400 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = 2VFCBFYPFW;
INFOPLIST_FILE = FoldingCellTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.ramotion.FoldingCellTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/FoldingCellDemo.app/FoldingCellDemo";
};
name = Release;
};
8499D88F1D0054A8004B5B37 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
@@ -617,7 +661,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
@@ -644,7 +688,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.ramotion.FoldingCell;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
@@ -669,8 +713,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
};
name = Debug;
};
@@ -691,8 +734,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "ramotion.com.FoldingCell-Demo";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
};
name = Release;
};
@@ -739,6 +781,15 @@
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
5A0E1C3421414940006A0374 /* Build configuration list for PBXNativeTarget "FoldingCellDemoTests" */ = {
isa = XCConfigurationList;
buildConfigurations = (
5A0E1C3521414940006A0374 /* Debug */,
5A0E1C3621414940006A0374 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
847A57FF1C294F750028FB84 /* Build configuration list for PBXProject "FoldingCell" */ = {
isa = XCConfigurationList;
buildConfigurations = (
@@ -748,15 +799,6 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
849851431C5639F9006FA400 /* Build configuration list for PBXNativeTarget "FoldingCellTests" */ = {
isa = XCConfigurationList;
buildConfigurations = (
849851441C5639F9006FA400 /* Debug */,
849851451C5639F9006FA400 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
8499D88E1D0054A8004B5B37 /* Build configuration list for PBXNativeTarget "FoldingCell" */ = {
isa = XCConfigurationList;
buildConfigurations = (
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0930"
LastUpgradeVersion = "0940"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
+25 -13
View File
@@ -49,7 +49,7 @@ open class FoldingCell: UITableViewCell {
- Open: Open direction
- Close: Close direction
*/
public enum AnimationType {
@objc public enum AnimationType : Int {
case open
case close
}
@@ -65,7 +65,7 @@ open class FoldingCell: UITableViewCell {
/**
Call this method in methods init(style: UITableViewCellStyle, reuseIdentifier: String?) after creating Views
*/
open func commonInit() {
@objc open func commonInit() {
configureDefaultState()
selectionStyle = .none
@@ -93,7 +93,7 @@ open class FoldingCell: UITableViewCell {
foregroundView.layer.transform = foregroundView.transform3d()
createAnimationView()
contentView.bringSubview(toFront: foregroundView)
contentView.bringSubviewToFront(foregroundView)
}
func createAnimationItemView() -> [RotatedView] {
@@ -121,10 +121,12 @@ open class FoldingCell: UITableViewCell {
if animationType == .open {
animationView?.subviews
.lazy
.compactMap { $0 as? RotatedView }
.forEach { $0.alpha = 0 }
} else {
animationView?.subviews
.lazy
.compactMap { $0 as? RotatedView }
.forEach {
if animationType == .open {
@@ -277,11 +279,11 @@ open class FoldingCell: UITableViewCell {
return animationView?.alpha == 1 ? true : false
}
open var isUnfolded = false
@objc open var isUnfolded = false
// MARK: Animations
open func animationDuration(_ itemIndex: NSInteger, type: AnimationType) -> TimeInterval {
@objc open func animationDuration(_ itemIndex: NSInteger, type: AnimationType) -> TimeInterval {
return type == .close ? durationsForCollapsedState[itemIndex] : durationsForExpandedState[itemIndex]
}
@@ -298,7 +300,7 @@ open class FoldingCell: UITableViewCell {
return durations
}
public func openAnimation(_ completion: (() -> Void)?) {
func openAnimation(_ completion: (() -> Void)?) {
isUnfolded = true
removeImageItemsFromAnimationView()
addImageItemsToAnimationView()
@@ -309,7 +311,7 @@ open class FoldingCell: UITableViewCell {
let durations = durationSequence(.open)
var delay: TimeInterval = 0
var timing = kCAMediaTimingFunctionEaseIn
var timing = convertFromCAMediaTimingFunctionName(CAMediaTimingFunctionName.easeIn)
var from: CGFloat = 0.0
var to: CGFloat = -CGFloat.pi / 2
var hidden = true
@@ -326,7 +328,7 @@ open class FoldingCell: UITableViewCell {
from = from == 0.0 ? CGFloat.pi / 2 : 0.0
to = to == 0.0 ? -CGFloat.pi / 2 : 0.0
timing = timing == kCAMediaTimingFunctionEaseIn ? kCAMediaTimingFunctionEaseOut : kCAMediaTimingFunctionEaseIn
timing = timing == convertFromCAMediaTimingFunctionName(CAMediaTimingFunctionName.easeIn) ? convertFromCAMediaTimingFunctionName(CAMediaTimingFunctionName.easeOut) : convertFromCAMediaTimingFunctionName(CAMediaTimingFunctionName.easeIn)
hidden = !hidden
delay += durations[index]
}
@@ -345,7 +347,7 @@ open class FoldingCell: UITableViewCell {
}
}
public func closeAnimation(_ completion: (() -> Void)?) {
func closeAnimation(_ completion: (() -> Void)?) {
isUnfolded = false
removeImageItemsFromAnimationView()
addImageItemsToAnimationView()
@@ -360,7 +362,7 @@ open class FoldingCell: UITableViewCell {
var durations: [TimeInterval] = durationSequence(.close).reversed()
var delay: TimeInterval = 0
var timing = kCAMediaTimingFunctionEaseIn
var timing = convertFromCAMediaTimingFunctionName(CAMediaTimingFunctionName.easeIn)
var from: CGFloat = 0.0
var to: CGFloat = CGFloat.pi / 2
var hidden = true
@@ -376,7 +378,7 @@ open class FoldingCell: UITableViewCell {
to = to == 0.0 ? CGFloat.pi / 2 : 0.0
from = from == 0.0 ? -CGFloat.pi / 2 : 0.0
timing = timing == kCAMediaTimingFunctionEaseIn ? kCAMediaTimingFunctionEaseOut : kCAMediaTimingFunctionEaseIn
timing = timing == convertFromCAMediaTimingFunctionName(CAMediaTimingFunctionName.easeIn) ? convertFromCAMediaTimingFunctionName(CAMediaTimingFunctionName.easeOut) : convertFromCAMediaTimingFunctionName(CAMediaTimingFunctionName.easeIn)
hidden = !hidden
delay += durations[index]
}
@@ -454,12 +456,12 @@ extension RotatedView: CAAnimationDelegate {
func foldingAnimation(_ timing: String, from: CGFloat, to: CGFloat, duration: TimeInterval, delay: TimeInterval, hidden: Bool) {
let rotateAnimation = CABasicAnimation(keyPath: Const.transformRotationX)
rotateAnimation.timingFunction = CAMediaTimingFunction(name: timing)
rotateAnimation.timingFunction = CAMediaTimingFunction(name: convertToCAMediaTimingFunctionName(timing))
rotateAnimation.fromValue = from
rotateAnimation.toValue = to
rotateAnimation.duration = duration
rotateAnimation.delegate = self
rotateAnimation.fillMode = kCAFillModeForwards
rotateAnimation.fillMode = CAMediaTimingFillMode.forwards
rotateAnimation.isRemovedOnCompletion = false
rotateAnimation.beginTime = CACurrentMediaTime() + delay
@@ -499,3 +501,13 @@ private extension UIView {
return image
}
}
// Helper function inserted by Swift 4.2 migrator.
fileprivate func convertFromCAMediaTimingFunctionName(_ input: CAMediaTimingFunctionName) -> String {
return input.rawValue
}
// Helper function inserted by Swift 4.2 migrator.
fileprivate func convertToCAMediaTimingFunctionName(_ input: String) -> CAMediaTimingFunctionName {
return CAMediaTimingFunctionName(rawValue: input)
}
@@ -0,0 +1,41 @@
//
// 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
@testable import FoldingCell_Demo
class FoldingCellDemoTests: XCTestCase {
var foldingCell: FoldingCell!
override func setUp() {
super.setUp()
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let vc = storyboard.instantiateViewController(withIdentifier: "MainTableViewController") as! MainTableViewController
_ = vc.view
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)
}
func testUnfold() {
XCTAssertEqual(foldingCell.isUnfolded, false)
foldingCell.unfold(true)
XCTAssertEqual(foldingCell.isUnfolded, true)
}
}
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>