Compare commits

..
10 Commits
Author SHA1 Message Date
Ramotion 0888558eee Update README.md 2020-04-06 09:53:35 +03:00
igor.k 85f8d426b5 add SPM config 2019-11-13 03:07:48 +03:00
Ramotion 5ff14c942c Update README.md 2019-10-12 21:15:15 +03:00
Alex K 63c89a9f05 bump version 2019-04-03 15:02:24 +03:00
Alex K fd2324ae6e converted to swift 5 2019-04-03 14:55:21 +03:00
Ramotion f5e532d949 Update README.md 2018-12-29 15:12:07 +03:00
Ramotion cf8350773e Update README.md 2018-12-10 12:04:59 +03:00
Alex K 4578946501 no message 2018-09-27 09:34:30 +03:00
Alex K 2e5971c53b update podspec 2018-09-21 09:52:46 +03:00
Alex K 4b03b8ec0f converting to swift 4.2 Fixes #85 2018-09-21 09:41:36 +03:00
17 changed files with 118 additions and 75 deletions
+1 -1
View File
@@ -1 +1 @@
4.0
4.2
@@ -440,24 +440,24 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0730;
LastUpgradeCheck = 0930;
LastUpgradeCheck = 1020;
ORGANIZATIONNAME = "Alex K.";
TargetAttributes = {
848596271CF585F3000BCC74 = {
CreatedOnToolsVersion = 7.3.1;
DevelopmentTeam = 34MUF9YXTA;
LastSwiftMigration = 0920;
LastSwiftMigration = 1020;
};
8499D8131D001B82004B5B37 = {
CreatedOnToolsVersion = 7.3.1;
DevelopmentTeam = LEAZS7L33U;
LastSwiftMigration = 0920;
LastSwiftMigration = 1020;
};
};
};
buildConfigurationList = 848596231CF585F3000BCC74 /* Build configuration list for PBXProject "DemoExpandingCollection" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
@@ -575,6 +575,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
@@ -630,6 +631,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
@@ -689,8 +691,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.ramotion.dev1;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
@@ -708,8 +709,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.ramotion.dev1;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
};
name = Release;
};
@@ -730,8 +730,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 = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
@@ -755,8 +754,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 = 5.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 = "0930"
LastUpgradeVersion = "1020"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@@ -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,
]
}
}
@@ -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)
}
}
@@ -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)
}
}
@@ -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
@@ -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
}
}
+43
View File
@@ -0,0 +1,43 @@
// swift-tools-version:5.1
//
// Package.swift
//
// Copyright (c) Ramotion (https://www.ramotion.com/)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
import PackageDescription
let package = Package(
name: "ExpandingCollection",
platforms: [
.iOS(.v9)
],
products: [
.library(name: "ExpandingCollection",
targets: ["ExpandingCollection"]),
],
targets: [
.target(name: "ExpandingCollection",
path: "Source")
],
swiftLanguageVersions: [.v5]
)
+33 -31
View File
@@ -1,9 +1,26 @@
![header](./header.png)
<img src="https://github.com/Ramotion/expanding-collection/blob/master/expanding-collection.gif" width="600" height="450" />
<br><br/>
<a href="https://www.ramotion.com/agency/app-development/?utm_source=gthb&utm_medium=repo&utm_campaign=expanding-collection"><img src="https://github.com/Ramotion/folding-cell/blob/master/header.png"></a>
<a href="https://github.com/Ramotion/expanding-collection">
<img align="left" src="https://github.com/Ramotion/expanding-collection/blob/master/expanding-collection.gif" width="480" height="360" /></a>
<p><h1 align="left">EXPANDING COLLECTION</h1></p>
<h4>An animated material design UI card peek/pop controller</h4>
# expanding-collection
___
<p><h6>We specialize in the designing and coding of custom UI for Mobile Apps and Websites.</h6>
<a href="https://www.ramotion.com/agency/app-development/?utm_source=gthb&utm_medium=repo&utm_campaign=expanding-collection">
<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>
</br>
[![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)
@@ -13,23 +30,6 @@
[![codebeat badge](https://codebeat.co/badges/6a009992-5bf2-4730-aa35-f3b20ce7693d)](https://codebeat.co/projects/github-com-ramotion-expanding-collection)
[![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/expanding-collection-android">
<img src="https://github.com/ramotion/navigation-stack/raw/master/Android_Java@2x.png" width="178" height="81"></a>
## About
This project is maintained by Ramotion, Inc.<br>
We specialize in the designing and coding of custom UI for Mobile Apps and Websites.<br>
**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=expanding-collection) available [here](https://store.ramotion.com?utm_source=gthb&utm_medium=special&utm_campaign=expanding-collection).
## Requirements
- iOS 9.0+
@@ -178,25 +178,27 @@ required init?(coder aDecoder: NSCoder) {
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>
## 🗂 Check this library on other language:
<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>
## License
Expanding collection is released under the MIT license.
## 📄 License
Expanding Collection is released under the MIT license.
See [LICENSE](./LICENSE) for details.
<br>
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=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="mailto:alex.a@ramotion.com?subject=Project%20inquiry%20from%20Github">
<a href="https://www.ramotion.com/agency/app-development/?utm_source=gthb&utm_medium=repo&utm_campaign=expanding-collection">
<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>
<a href="https://goo.gl/rPFpid" >
<img src="https://i.imgur.com/ziSqeSo.png/" width="156" height="28"></a>
@@ -135,7 +135,7 @@ extension BasePageCollectionCell {
isOpened = isOpen
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 {
@@ -176,8 +176,8 @@ extension BasePageCollectionCell {
contentView.insertSubview(shadow, belowSubview: view)
// create constraints
let sizeConstaints: [(NSLayoutAttribute, CGFloat)] = [(NSLayoutAttribute.width, 0.8), (NSLayoutAttribute.height, 0.9)]
for info: (attribute: NSLayoutAttribute, scale: CGFloat) in sizeConstaints {
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
@@ -187,8 +187,8 @@ extension BasePageCollectionCell {
}
}
let centerConstraints: [(NSLayoutAttribute, CGFloat)] = [(NSLayoutAttribute.centerX, 0), (NSLayoutAttribute.centerY, 30)]
for info: (attribute: NSLayoutAttribute, offset: CGFloat) in centerConstraints {
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
@@ -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
@@ -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,13 +71,13 @@ 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
copyView.frontContainerView.subviewsForEach { if $0.tag == Constants.HideKey { $0.alpha = 0 } }
}, completion: { _ in
let data = NSKeyedArchiver.archivedData(withRootObject: copyView.frontContainerView)
let data = NSKeyedArchiver.archivedData(withRootObject: copyView.frontContainerView!)
guard case let headerView as UIView = NSKeyedUnarchiver.unarchiveObject(with: data) else {
fatalError("must copy")
}
@@ -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
+1 -1
View File
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'expanding-collection'
s.version = '2.1.0'
s.version = '3.1.0'
s.summary = 'Transition animtion from CollectionView to TableView'
s.license = 'MIT'
s.homepage = 'https://github.com/Ramotion/expanding-collection'