Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4b03b8ec0f | ||
|
|
f077711d1f | ||
|
|
8c2a5bb31b | ||
|
|
bfd276ac68 | ||
|
|
799fba5bcf | ||
|
|
9f55d701a1 | ||
|
|
c9a00bba92 | ||
|
|
2315429724 | ||
|
|
d71ab75f6f | ||
|
|
09ae1b08dd | ||
|
|
988f36f4bd | ||
|
|
56298faab4 | ||
|
|
8a712f23bc | ||
|
|
c0fcff5202 | ||
|
|
f2f31ba167 | ||
|
|
56bf333791 | ||
|
|
e8e36b9804 | ||
|
|
5986f1c286 | ||
|
|
fc70562947 | ||
|
|
03704d1227 | ||
|
|
e72546bc43 | ||
|
|
436bba428a |
@@ -400,7 +400,6 @@
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 848596451CF585F3000BCC74 /* Build configuration list for PBXNativeTarget "DemoExpandingCollection" */;
|
||||
buildPhases = (
|
||||
8485968F1CF58B8A000BCC74 /* Images Generator */,
|
||||
848596241CF585F3000BCC74 /* Sources */,
|
||||
848596251CF585F3000BCC74 /* Frameworks */,
|
||||
848596261CF585F3000BCC74 /* Resources */,
|
||||
@@ -441,18 +440,18 @@
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastSwiftUpdateCheck = 0730;
|
||||
LastUpgradeCheck = 0920;
|
||||
LastUpgradeCheck = 0930;
|
||||
ORGANIZATIONNAME = "Alex K.";
|
||||
TargetAttributes = {
|
||||
848596271CF585F3000BCC74 = {
|
||||
CreatedOnToolsVersion = 7.3.1;
|
||||
DevelopmentTeam = 34MUF9YXTA;
|
||||
LastSwiftMigration = 0920;
|
||||
LastSwiftMigration = 1000;
|
||||
};
|
||||
8499D8131D001B82004B5B37 = {
|
||||
CreatedOnToolsVersion = 7.3.1;
|
||||
DevelopmentTeam = LEAZS7L33U;
|
||||
LastSwiftMigration = 0920;
|
||||
LastSwiftMigration = 1000;
|
||||
};
|
||||
};
|
||||
};
|
||||
@@ -496,23 +495,6 @@
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXShellScriptBuildPhase section */
|
||||
8485968F1CF58B8A000BCC74 /* Images Generator */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "Images Generator";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "if which swiftgen >/dev/null; then\nswiftgen images \"$PROJECT_DIR/DemoExpandingCollection/Assets.xcassets\" -t swift3 --output \"$PROJECT_DIR/DemoExpandingCollection/Constants/Images.swift\"\nelse\necho \"warning: SwiftGen not installed, download it from https://github.com/AliSoftware/SwiftGen\"\nfi";
|
||||
};
|
||||
/* End PBXShellScriptBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
848596241CF585F3000BCC74 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
@@ -602,12 +584,14 @@
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
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_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
@@ -655,12 +639,14 @@
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
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_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
@@ -703,8 +689,7 @@
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.ramotion.dev1;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE = "";
|
||||
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
|
||||
SWIFT_VERSION = 4.0;
|
||||
SWIFT_VERSION = 4.2;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
@@ -722,8 +707,7 @@
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.ramotion.dev1;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE = "";
|
||||
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
|
||||
SWIFT_VERSION = 4.0;
|
||||
SWIFT_VERSION = 4.2;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
@@ -744,8 +728,7 @@
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.ramotion.dev;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
|
||||
SWIFT_VERSION = 4.0;
|
||||
SWIFT_VERSION = 4.2;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
VERSION_INFO_PREFIX = "";
|
||||
@@ -769,8 +752,7 @@
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.ramotion.dev;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
|
||||
SWIFT_VERSION = 4.0;
|
||||
SWIFT_VERSION = 4.2;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
VERSION_INFO_PREFIX = "";
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
<?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>IDEDidComputeMac32BitWarning</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
+1
-3
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0920"
|
||||
LastUpgradeVersion = "0930"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
@@ -26,7 +26,6 @@
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
language = ""
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
@@ -37,7 +36,6 @@
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
language = ""
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
|
||||
@@ -13,7 +13,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
|
||||
|
||||
var window: UIWindow?
|
||||
|
||||
func application(_: UIApplication, didFinishLaunchingWithOptions _: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
|
||||
func application(_: UIApplication, didFinishLaunchingWithOptions _: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
|
||||
configureNavigationTabBar()
|
||||
return true
|
||||
}
|
||||
@@ -32,8 +32,8 @@ extension AppDelegate {
|
||||
shadow.shadowColor = UIColor(red: 0, green: 0, blue: 0, alpha: 0.1)
|
||||
|
||||
UINavigationBar.appearance().titleTextAttributes = [
|
||||
NSAttributedStringKey.foregroundColor: UIColor.white,
|
||||
NSAttributedStringKey.shadow: shadow,
|
||||
NSAttributedString.Key.foregroundColor: UIColor.white,
|
||||
NSAttributedString.Key.shadow: shadow,
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
+11
-14
@@ -27,8 +27,8 @@ class DemoTableViewController: ExpandingTableViewController {
|
||||
extension DemoTableViewController {
|
||||
|
||||
fileprivate func configureNavBar() {
|
||||
navigationItem.leftBarButtonItem?.image = navigationItem.leftBarButtonItem?.image!.withRenderingMode(UIImageRenderingMode.alwaysOriginal)
|
||||
navigationItem.rightBarButtonItem?.image = navigationItem.rightBarButtonItem?.image!.withRenderingMode(UIImageRenderingMode.alwaysOriginal)
|
||||
navigationItem.leftBarButtonItem?.image = navigationItem.leftBarButtonItem?.image!.withRenderingMode(UIImage.RenderingMode.alwaysOriginal)
|
||||
navigationItem.rightBarButtonItem?.image = navigationItem.rightBarButtonItem?.image!.withRenderingMode(UIImage.RenderingMode.alwaysOriginal)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,18 +54,15 @@ 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()
|
||||
// }
|
||||
|
||||
if scrollView.contentOffset.y < -25 , let navigationController = navigationController {
|
||||
// buttonAnimation
|
||||
for case let viewController as DemoViewController in navigationController.viewControllers {
|
||||
if case let rightButton as AnimatingBarButton = viewController.navigationItem.rightBarButtonItem {
|
||||
rightButton.animationSelected(false)
|
||||
}
|
||||
}
|
||||
popTransitionAnimation()
|
||||
}
|
||||
scrollOffsetY = scrollView.contentOffset.y
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -22,7 +22,7 @@ class DemoViewController: ExpandingViewController {
|
||||
extension DemoViewController {
|
||||
|
||||
override func viewDidLoad() {
|
||||
itemSize = CGSize(width: 256, height: 335)
|
||||
itemSize = CGSize(width: 256, height: 460)
|
||||
super.viewDidLoad()
|
||||
|
||||
registerCell()
|
||||
@@ -53,7 +53,7 @@ extension DemoViewController {
|
||||
}
|
||||
|
||||
fileprivate func configureNavBar() {
|
||||
navigationItem.leftBarButtonItem?.image = navigationItem.leftBarButtonItem?.image!.withRenderingMode(UIImageRenderingMode.alwaysOriginal)
|
||||
navigationItem.leftBarButtonItem?.image = navigationItem.leftBarButtonItem?.image!.withRenderingMode(UIImage.RenderingMode.alwaysOriginal)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ extension DemoViewController {
|
||||
cell.cellIsOpen(cellsIsOpen[index], animated: false)
|
||||
}
|
||||
|
||||
func collectionView(_ collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: IndexPath) {
|
||||
override func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
|
||||
guard let cell = collectionView.cellForItem(at: indexPath) as? DemoCollectionViewCell
|
||||
, currentIndex == indexPath.row else { return }
|
||||
|
||||
|
||||
+1
-1
@@ -66,7 +66,7 @@ extension AnimatingBarButton {
|
||||
|
||||
fileprivate func configureImageView(_ imageView: UIImageView, imageName: String) {
|
||||
guard let customView = customView else { return }
|
||||
guard let image = UIImage(named: imageName)?.withRenderingMode(UIImageRenderingMode.alwaysTemplate) else { return }
|
||||
guard let image = UIImage(named: imageName)?.withRenderingMode(UIImage.RenderingMode.alwaysTemplate) else { return }
|
||||
|
||||
imageView.image = image
|
||||
imageView.contentMode = .scaleAspectFit
|
||||
|
||||
+1
-1
@@ -35,7 +35,7 @@ extension Rotatable {
|
||||
$0.duration = duration
|
||||
$0.fromValue = from
|
||||
$0.toValue = to
|
||||
$0.fillMode = kCAFillModeForwards
|
||||
$0.fillMode = CAMediaTimingFillMode.forwards
|
||||
$0.isRemovedOnCompletion = false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||

|
||||

|
||||
<img src="https://github.com/Ramotion/expanding-collection/blob/master/expanding-collection.gif" width="600" height="450" />
|
||||
<br><br/>
|
||||
|
||||
|
||||
# expanding-collection
|
||||
@@ -10,9 +11,10 @@
|
||||
[](https://github.com/Ramotion/expanding-collection)
|
||||
[](https://travis-ci.org/Ramotion/expanding-collection)
|
||||
[](https://codebeat.co/projects/github-com-ramotion-expanding-collection)
|
||||
[](https://paypal.me/Ramotion)
|
||||
|
||||
# Check this library on other platforms:
|
||||
<a href="https://github.com/Ramotion/expanding-collection-android">
|
||||
<a href="https://github.com/Ramotion/expanding-collection-android">
|
||||
<img src="https://github.com/ramotion/navigation-stack/raw/master/Android_Java@2x.png" width="178" height="81"></a>
|
||||
|
||||
## About
|
||||
@@ -22,16 +24,16 @@ We specialize in the designing and coding of custom UI for Mobile Apps and Websi
|
||||
**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="https://ramotion.com/?utm_source=gthb&utm_medium=special&utm_campaign=expanding-collection-contact-us/#Get_in_Touch">
|
||||
<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?utm_source=gthb&utm_medium=special&utm_campaign=expanding-collection) available [here](https://store.ramotion.com?utm_source=gthb&utm_medium=special&utm_campaign=expanding-collection).
|
||||
The [iPhone mockup](https://store.ramotion.com/product/iphone-x-clay-mockups?utm_source=gthb&utm_medium=special&utm_campaign=expanding-collection) available [here](https://store.ramotion.com?utm_source=gthb&utm_medium=special&utm_campaign=expanding-collection).
|
||||
|
||||
## Requirements
|
||||
|
||||
- iOS 9.0+
|
||||
- Xcode 8
|
||||
- Xcode 9.0+
|
||||
|
||||
## Installation
|
||||
|
||||
@@ -39,12 +41,9 @@ Just add the Source folder to your project.
|
||||
|
||||
or use [CocoaPods](https://cocoapods.org) with Podfile:
|
||||
``` ruby
|
||||
pod 'expanding-collection', '~> 1.1.2' swift 4
|
||||
|
||||
pod 'expanding-collection', '~> 1.0.3' swift 3
|
||||
|
||||
pod 'expanding-collection', '~> 0.3.2' swift 2
|
||||
pod 'expanding-collection'
|
||||
```
|
||||
|
||||
or [Carthage](https://github.com/Carthage/Carthage) users can simply add to their `Cartfile`:
|
||||
```
|
||||
github "Ramotion/expanding-collection"
|
||||
@@ -84,7 +83,7 @@ import expanding_collection
|
||||
|
||||
``` swift
|
||||
override func viewDidLoad() {
|
||||
itemSize = CGSize(width: 214, height: 264)
|
||||
itemSize = CGSize(width: 214, height: 460) //IMPORTANT!!! Height of open state cell
|
||||
super.viewDidLoad()
|
||||
|
||||
// register cell
|
||||
@@ -154,10 +153,18 @@ func scrollViewDidEndDecelerating(scrollView: UIScrollView) {
|
||||
2) Set header height default 236
|
||||
|
||||
``` swift
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
|
||||
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
|
||||
headerHeight = ***
|
||||
}
|
||||
}
|
||||
```
|
||||
OR
|
||||
|
||||
``` swift
|
||||
required init?(coder aDecoder: NSCoder) {
|
||||
super.init(coder: aDecoder)
|
||||
headerHeight = ***
|
||||
}
|
||||
```
|
||||
|
||||
3) Call the push method in YourViewController to YourTableViewController
|
||||
@@ -171,6 +178,8 @@ override func viewDidLoad() {
|
||||
4) For back transition use `popTransitionAnimation()`
|
||||
|
||||
|
||||
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>
|
||||
|
||||
## License
|
||||
|
||||
Expanding collection is released under the MIT license.
|
||||
@@ -181,13 +190,13 @@ See [LICENSE](./LICENSE) for details.
|
||||
# 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=expanding-collection&mt=8" >
|
||||
<a href="https://itunes.apple.com/app/apple-store/id1182360240?pt=550053&ct=expanding-collection&mt=8" >
|
||||
<img src="https://github.com/ramotion/gliding-collection/raw/master/app_store@2x.png" width="117" height="34"></a>
|
||||
<a href="https://ramotion.com/?utm_source=gthb&utm_medium=special&utm_campaign=expanding-collection-contact-us/#Get_in_Touch">
|
||||
<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>
|
||||
<br>
|
||||
|
||||
Follow us for the latest updates<br>
|
||||
[](https://twitter.com/intent/tweet?text=https://github.com/ramotion/expanding-collection)
|
||||
[](https://twitter.com/ramotion)
|
||||
<a href="https://goo.gl/rPFpid" >
|
||||
<img src="https://i.imgur.com/ziSqeSo.png/" width="156" height="28"></a>
|
||||
|
||||
@@ -109,8 +109,8 @@ extension BasePageCollectionCell {
|
||||
if isOpen == isOpened { return }
|
||||
|
||||
if ySpacing == .greatestFiniteMagnitude {
|
||||
frontConstraintY.constant = isOpen == true ? -frontContainerView.bounds.size.height / 5 : 0
|
||||
backConstraintY.constant = isOpen == true ? frontContainerView.bounds.size.height / 5 - yOffset / 2 : 0
|
||||
frontConstraintY.constant = isOpen == true ? -frontContainerView.bounds.size.height / 6 : 0
|
||||
backConstraintY.constant = isOpen == true ? frontContainerView.bounds.size.height / 6 - yOffset / 2 : 0
|
||||
} else {
|
||||
frontConstraintY.constant = isOpen == true ? -ySpacing / 2 : 0
|
||||
backConstraintY.constant = isOpen == true ? ySpacing / 2 : 0
|
||||
@@ -133,10 +133,9 @@ extension BasePageCollectionCell {
|
||||
}
|
||||
|
||||
isOpened = isOpen
|
||||
configurationCell()
|
||||
|
||||
if animated == true {
|
||||
UIView.animate(withDuration: 0.3, delay: 0, options: UIViewAnimationOptions(), animations: {
|
||||
UIView.animate(withDuration: 0.3, delay: 0, options: UIView.AnimationOptions(), animations: {
|
||||
self.contentView.layoutIfNeeded()
|
||||
}, completion: nil)
|
||||
} else {
|
||||
@@ -177,7 +176,8 @@ extension BasePageCollectionCell {
|
||||
contentView.insertSubview(shadow, belowSubview: view)
|
||||
|
||||
// create constraints
|
||||
for info: (attribute: NSLayoutAttribute, scale: CGFloat) in [(NSLayoutAttribute.width, 0.8), (NSLayoutAttribute.height, 0.9)] {
|
||||
let sizeConstaints: [(NSLayoutConstraint.Attribute, CGFloat)] = [(NSLayoutConstraint.Attribute.width, 0.8), (NSLayoutConstraint.Attribute.height, 0.9)]
|
||||
for info: (attribute: NSLayoutConstraint.Attribute, scale: CGFloat) in sizeConstaints {
|
||||
if let frontViewConstraint = view.getConstraint(info.attribute) {
|
||||
shadow >>>- {
|
||||
$0.attribute = info.attribute
|
||||
@@ -186,8 +186,9 @@ extension BasePageCollectionCell {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for info: (attribute: NSLayoutAttribute, offset: CGFloat) in [(NSLayoutAttribute.centerX, 0), (NSLayoutAttribute.centerY, 30)] {
|
||||
|
||||
let centerConstraints: [(NSLayoutConstraint.Attribute, CGFloat)] = [(NSLayoutConstraint.Attribute.centerX, 0), (NSLayoutConstraint.Attribute.centerY, 30)]
|
||||
for info: (attribute: NSLayoutConstraint.Attribute, offset: CGFloat) in centerConstraints {
|
||||
(contentView, shadow, view) >>>- {
|
||||
$0.attribute = info.attribute
|
||||
$0.constant = info.offset
|
||||
@@ -204,22 +205,6 @@ extension BasePageCollectionCell {
|
||||
return shadow
|
||||
}
|
||||
|
||||
func configurationCell() {
|
||||
// Prevents indefinite growing of the cell issue
|
||||
let i: CGFloat = isOpened ? 1 : -1
|
||||
let superHeight = superview?.frame.size.height ?? 0
|
||||
|
||||
frame.size.height += i * superHeight
|
||||
frame.origin.y -= i * superHeight / 2
|
||||
if additionalWidth == .greatestFiniteMagnitude {
|
||||
frame.origin.x -= i * yOffset / 2
|
||||
frame.size.width += i * yOffset
|
||||
} else {
|
||||
frame.origin.x -= i * additionalWidth / 2
|
||||
frame.size.width += i * additionalWidth
|
||||
}
|
||||
}
|
||||
|
||||
func configureCellViewConstraintsWithSize(_ size: CGSize) {
|
||||
guard isOpened == false && frontContainerView.getConstraint(.width)?.constant != size.width else { return }
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ extension PageCollectionLayout {
|
||||
continue
|
||||
}
|
||||
|
||||
if fabs(attributes.center.x - proposedContentOffsetCenterX) < fabs(candidateAttributes!.center.x - proposedContentOffsetCenterX) {
|
||||
if abs(attributes.center.x - proposedContentOffsetCenterX) < abs(candidateAttributes!.center.x - proposedContentOffsetCenterX) {
|
||||
candidateAttributes = attributes
|
||||
}
|
||||
}
|
||||
@@ -143,7 +143,7 @@ extension PageCollectionLayout {
|
||||
}
|
||||
|
||||
let inset = collectionView.bounds.size.width / 2 - itemSize.width / 2
|
||||
collectionView.contentInset = UIEdgeInsetsMake(0, inset, 0, inset)
|
||||
collectionView.contentInset = UIEdgeInsets.init(top: 0, left: inset, bottom: 0, right: inset)
|
||||
collectionView.contentOffset = CGPoint(x: -inset, y: 0)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ extension PageCollectionView {
|
||||
|
||||
let collectionView = Init(PageCollectionView(frame: CGRect.zero, collectionViewLayout: layout)) {
|
||||
$0.translatesAutoresizingMaskIntoConstraints = false
|
||||
$0.decelerationRate = UIScrollViewDecelerationRateFast
|
||||
$0.decelerationRate = UIScrollView.DecelerationRate.fast
|
||||
$0.showsHorizontalScrollIndicator = false
|
||||
$0.dataSource = dataSource
|
||||
$0.delegate = delegate
|
||||
@@ -37,7 +37,7 @@ extension PageCollectionView {
|
||||
$0.constant = height
|
||||
return
|
||||
}
|
||||
[NSLayoutAttribute.left, .right, .centerY].forEach { attribute in
|
||||
[NSLayoutConstraint.Attribute.left, .right, .centerY].forEach { attribute in
|
||||
(view, collectionView) >>>- {
|
||||
$0.attribute = attribute
|
||||
return
|
||||
|
||||
@@ -11,8 +11,8 @@ import UIKit
|
||||
/// UIViewController with UICollectionView with custom transition method
|
||||
open class ExpandingViewController: UIViewController {
|
||||
|
||||
/// The default size to use for cells.
|
||||
open var itemSize = CGSize(width: 256, height: 335)
|
||||
/// The default size to use for cells. Height of open cell state
|
||||
open var itemSize = CGSize(width: 256, height: 460)
|
||||
|
||||
/// The collection view object managed by this view controller.
|
||||
open var collectionView: UICollectionView?
|
||||
@@ -86,7 +86,7 @@ extension ExpandingViewController {
|
||||
let layout = PageCollectionLayout(itemSize: itemSize)
|
||||
collectionView = PageCollectionView.createOnView(view,
|
||||
layout: layout,
|
||||
height: itemSize.height + itemSize.height / 5 * 2,
|
||||
height: itemSize.height,
|
||||
dataSource: self,
|
||||
delegate: self)
|
||||
if #available(iOS 10.0, *) {
|
||||
@@ -118,6 +118,9 @@ extension ExpandingViewController: UICollectionViewDataSource, UICollectionViewD
|
||||
|
||||
cell.configureCellViewConstraintsWithSize(itemSize)
|
||||
}
|
||||
|
||||
open func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
|
||||
}
|
||||
|
||||
open func collectionView(_: UICollectionView, numberOfItemsInSection _: Int) -> Int {
|
||||
fatalError("need emplementation in subclass")
|
||||
|
||||
@@ -18,7 +18,7 @@ extension CornerAnimatable where Self: UIView {
|
||||
let animation = Init(CABasicAnimation(keyPath: "cornerRadius")) {
|
||||
$0.duration = duration
|
||||
$0.toValue = radius
|
||||
$0.fillMode = kCAFillModeForwards
|
||||
$0.fillMode = CAMediaTimingFillMode.forwards
|
||||
$0.isRemovedOnCompletion = false
|
||||
}
|
||||
|
||||
|
||||
@@ -9,11 +9,11 @@
|
||||
import UIKit
|
||||
|
||||
struct ConstraintInfo {
|
||||
var attribute: NSLayoutAttribute = .left
|
||||
var secondAttribute: NSLayoutAttribute = .notAnAttribute
|
||||
var attribute: NSLayoutConstraint.Attribute = .left
|
||||
var secondAttribute: NSLayoutConstraint.Attribute = .notAnAttribute
|
||||
var constant: CGFloat = 0
|
||||
var identifier: String?
|
||||
var relation: NSLayoutRelation = .equal
|
||||
var relation: NSLayoutConstraint.Relation = .equal
|
||||
}
|
||||
|
||||
precedencegroup ConstOp {
|
||||
@@ -81,7 +81,7 @@ func >>>- <T: UIView>(left: (T, T, T), block: (inout ConstraintInfo) -> Void) ->
|
||||
extension UIView {
|
||||
|
||||
func addScaleToFillConstratinsOnView(_ view: UIView) {
|
||||
[NSLayoutAttribute.left, .right, .top, .bottom].forEach { attribute in
|
||||
[NSLayoutConstraint.Attribute.left, .right, .top, .bottom].forEach { attribute in
|
||||
(self, view) >>>- {
|
||||
$0.attribute = attribute
|
||||
return
|
||||
@@ -89,7 +89,7 @@ extension UIView {
|
||||
}
|
||||
}
|
||||
|
||||
func getConstraint(_ attributes: NSLayoutAttribute) -> NSLayoutConstraint? {
|
||||
func getConstraint(_ attributes: NSLayoutConstraint.Attribute) -> NSLayoutConstraint? {
|
||||
return constraints.filter {
|
||||
if $0.firstAttribute == attributes && $0.secondItem == nil {
|
||||
return true
|
||||
|
||||
@@ -71,7 +71,7 @@ extension TransitionDriver {
|
||||
copyView.center = view.center
|
||||
|
||||
// constraints animation
|
||||
UIView.animate(withDuration: duration, delay: 0, options: UIViewAnimationOptions(), animations: {
|
||||
UIView.animate(withDuration: duration, delay: 0, options: UIView.AnimationOptions(), animations: {
|
||||
self.view.layoutIfNeeded()
|
||||
self.backImageView?.alpha = 1
|
||||
self.copyCell?.shadowView?.alpha = 0
|
||||
@@ -101,7 +101,7 @@ extension TransitionDriver {
|
||||
copyCell.backContainerView.animationCornerRadius(copyCell.backContainerView.layer.cornerRadius, duration: duration)
|
||||
copyCell.frontContainerView.animationCornerRadius(copyCell.frontContainerView.layer.cornerRadius, duration: duration)
|
||||
|
||||
UIView.animate(withDuration: duration, delay: 0, options: UIViewAnimationOptions(), animations: {
|
||||
UIView.animate(withDuration: duration, delay: 0, options: UIView.AnimationOptions(), animations: {
|
||||
self.rightCell?.center.x -= self.step
|
||||
self.leftCell?.center.x += self.step
|
||||
|
||||
@@ -132,7 +132,7 @@ extension TransitionDriver {
|
||||
view.addSubview(cell)
|
||||
|
||||
// add constraints
|
||||
[(NSLayoutAttribute.width, cell.bounds.size.width), (NSLayoutAttribute.height, cell.bounds.size.height)].forEach { info in
|
||||
[(NSLayoutConstraint.Attribute.width, cell.bounds.size.width), (NSLayoutConstraint.Attribute.height, cell.bounds.size.height)].forEach { info in
|
||||
cell >>>- {
|
||||
$0.attribute = info.0
|
||||
$0.constant = info.1
|
||||
@@ -140,7 +140,7 @@ extension TransitionDriver {
|
||||
}
|
||||
}
|
||||
|
||||
[NSLayoutAttribute.centerX, .centerY].forEach { attribute in
|
||||
[NSLayoutConstraint.Attribute.centerX, .centerY].forEach { attribute in
|
||||
(view, cell) >>>- {
|
||||
$0.attribute = attribute
|
||||
return
|
||||
@@ -159,7 +159,7 @@ extension TransitionDriver {
|
||||
view.addSubview(imageView)
|
||||
|
||||
// add constraints
|
||||
[NSLayoutAttribute.left, .right, .top, .bottom].forEach { attribute in
|
||||
[NSLayoutConstraint.Attribute.left, .right, .top, .bottom].forEach { attribute in
|
||||
(view, imageView) >>>- {
|
||||
$0.attribute = attribute
|
||||
return
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 14 MiB |
@@ -1,6 +1,6 @@
|
||||
Pod::Spec.new do |s|
|
||||
s.name = 'expanding-collection'
|
||||
s.version = '1.1.4'
|
||||
s.version = '2.1.1'
|
||||
s.summary = 'Transition animtion from CollectionView to TableView'
|
||||
s.license = 'MIT'
|
||||
s.homepage = 'https://github.com/Ramotion/expanding-collection'
|
||||
|
||||
Reference in New Issue
Block a user