diff --git a/README.md b/README.md index f687e0e..e2849d6 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,15 @@ -

- ScrollStackController +

+ + + logo-library +

-

Easy scrollable layouts in UIKit

+[![Swift](https://img.shields.io/badge/Swift-5.3_5.4_5.5_5.6-orange?style=flat-square)](https://img.shields.io/badge/Swift-5.3_5.4_5.5_5.6-Orange?style=flat-square) +[![Platform](https://img.shields.io/badge/Platforms-iOS-4E4E4E.svg?colorA=28a745)](#installation) +[![Swift Package Manager](https://img.shields.io/badge/Swift_Package_Manager-compatible-orange?style=flat-square)](https://img.shields.io/badge/Swift_Package_Manager-compatible-orange?style=flat-square) +[![CocoaPods Compatible](https://img.shields.io/cocoapods/v/ScrollStackController.svg?style=flat-square)](https://img.shields.io/cocoapods/v/ScrollStackController.svg) + Create complex scrollable layout using UIViewControllers or plain UIViews and simplify your code! @@ -32,41 +39,43 @@ You can think of it as `UITableView` but with several differences: *Hi fellow developer!* You know, maintaing and developing tools consumes resources and time. While I enjoy making them **your support is foundamental to allow me continue its development**. -If you are using SwiftLocation or any other of my creations please consider the following options: +If you are using `ScrollStackController` or any other of my creations please consider the following options: - [**Make a donation with PayPal**](https://www.paypal.com/paypalme/danielemargutti/20) - [**Become a Sponsor**](https://github.com/sponsors/malcommac) - - [Follow Me](https://github.com/malcommac) ## Table of Contents -- [When to use `ScrollStackController` and when not](#whentousescrollstackcontrollerandwhennot) -- [How to use it](#howtouseit) - - [Adding Rows](#addingrows) - - [Removing / Replacing Rows](#removingreplacingrows) - - [Move Rows](#moverows) - - [Hide / Show Rows](#hideshowrows) - - [Hide / Show Rows with custom animations](#customanimations) - - [Reload Rows](#reloadrows) - - [Sizing Rows](#sizingrows) - - [Fixed Row Size](#fixedrowsize) - - [Fitting Layout Row Size](#fittinglayoutrowsize) - - [Collapsible Rows](#collapsiblerows) - - [Working with dynamic UICollectionView/UITableView/UITextView](#workingwithdynamicuicollectionviewuitableviewuitextview) - - [Using plain UIViews instead of view controllers](#lightweightplainuiview) - - [Rows Separator](#rowsseparator) - - [Tap On Rows](#taponrows) - - [Get the row/controller](#utilsmethods) - - [Set Row Insets](#setrowinsets) - - [Change ScrollStack scrolling axis](#changescrollaxis) - - [Subscribe to Events](#rowevents) -- [Example App](#exampleapp) -- [Installation](#installation) -- [System Requirements](#systemrequirements) -- [Author & License](#authorlicense) +- [❤️ Your Support](#️-your-support) +- [Table of Contents](#table-of-contents) + - [When to use `ScrollStackController` and when not](#when-to-use-scrollstackcontroller-and-when-not) + - [How to use it](#how-to-use-it) + - [Adding Rows](#adding-rows) + - [Removing / Replacing Rows](#removing--replacing-rows) + - [Move Rows](#move-rows) + - [Hide / Show Rows](#hide--show-rows) + - [Hide / Show Rows with custom animations](#hide--show-rows-with-custom-animations) + - [Reload Rows](#reload-rows) + - [Sizing Rows](#sizing-rows) + - [Fixed Row Size](#fixed-row-size) + - [Fitting Layout Row Size](#fitting-layout-row-size) + - [Collapsible Rows](#collapsible-rows) + - [Working with dynamic UICollectionView/UITableView/UITextView](#working-with-dynamic-uicollectionviewuitableviewuitextview) + - [Rows Separator](#rows-separator) + - [Using plain UIViews instead of view controllers](#using-plain-uiviews-instead-of-view-controllers) + - [Tap On Rows](#tap-on-rows) + - [Get the row/controller](#get-the-rowcontroller) + - [Set Row Insets](#set-row-insets) + - [Change ScrollStack scrolling axis](#change-scrollstack-scrolling-axis) + - [Subscribe to Row Events](#subscribe-to-row-events) + - [System Requirements](#system-requirements) + - [Example App](#example-app) + - [Installation](#installation) +- [Contributing](#contributing) +- [Copyright \& Acknowledgements](#copyright--acknowledgements) diff --git a/Resources/scrollstack-dark.png b/Resources/scrollstack-dark.png new file mode 100644 index 0000000..5c68519 Binary files /dev/null and b/Resources/scrollstack-dark.png differ diff --git a/Resources/scrollstack-light.png b/Resources/scrollstack-light.png new file mode 100644 index 0000000..9d2beb7 Binary files /dev/null and b/Resources/scrollstack-light.png differ diff --git a/ScrollStackController.podspec b/ScrollStackController.podspec index 3c42951..00eb216 100644 --- a/ScrollStackController.podspec +++ b/ScrollStackController.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "ScrollStackController" - s.version = "1.5.1" + s.version = "1.6.0" s.summary = "Create complex scrollable layout using UIViewController and simplify your code" s.homepage = "https://github.com/malcommac/ScrollStackController" s.license = { :type => "MIT", :file => "LICENSE" } @@ -10,5 +10,5 @@ Pod::Spec.new do |s| s.source = { :git => "https://github.com/malcommac/ScrollStackController.git", :tag => s.version.to_s } s.frameworks = "Foundation", "UIKit" s.source_files = 'Sources/**/*.swift' - s.swift_versions = ['5.0', '5.1', '5.3', '5.4', '5.5', '5.7', '5.8'] + s.swift_versions = ['5.0', '5.1', '5.3', '5.4', '5.5', '5.7', '5.8', '5.9'] end diff --git a/ScrollStackController.xcodeproj/project.xcworkspace/xcuserdata/daniele.xcuserdatad/UserInterfaceState.xcuserstate b/ScrollStackController.xcodeproj/project.xcworkspace/xcuserdata/daniele.xcuserdatad/UserInterfaceState.xcuserstate index 25fc294..07a8032 100644 Binary files a/ScrollStackController.xcodeproj/project.xcworkspace/xcuserdata/daniele.xcuserdatad/UserInterfaceState.xcuserstate and b/ScrollStackController.xcodeproj/project.xcworkspace/xcuserdata/daniele.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/Sources/ScrollStackController/ScrollStackRow.swift b/Sources/ScrollStackController/ScrollStackRow.swift index 35c4a22..03be664 100644 --- a/Sources/ScrollStackController/ScrollStackRow.swift +++ b/Sources/ScrollStackController/ScrollStackRow.swift @@ -130,12 +130,6 @@ open class ScrollStackRow: UIView, UIGestureRecognizerDelegate { didSet { separatorView.isHidden = isSeparatorHidden } -// get { -// return separatorView.isHidden -// } -// set { -// separatorView.isHidden = newValue -// } } // MARK: Private Properties @@ -245,9 +239,10 @@ open class ScrollStackRow: UIView, UIGestureRecognizerDelegate { setNeedsUpdateConstraints() } - open override func updateConstraints() { + open override func layoutSubviews() { + super.layoutSubviews() + // called the event to update the height of the row. askForCutomizedSizeOfContentView(animated: false) - super.updateConstraints() } private func applyParentStackAttributes() { @@ -366,16 +361,25 @@ open class ScrollStackRow: UIView, UIGestureRecognizerDelegate { var bestSize: CGSize! if stackView.axis == .vertical { - let maxAllowedSize = CGSize(width: stackView.bounds.size.width, height: CGFloat.greatestFiniteMagnitude) - bestSize = contentView.systemLayoutSizeFitting(maxAllowedSize, withHorizontalFittingPriority: .required, verticalFittingPriority: .defaultLow) + let maxAllowedSize = CGSize(width: contentView.bounds.width, height: 0) + bestSize = contentView.systemLayoutSizeFitting( + maxAllowedSize, + withHorizontalFittingPriority: .required, + verticalFittingPriority: .fittingSizeLevel + ) } else { - let maxAllowedSize = CGSize(width: CGFloat.greatestFiniteMagnitude, height: stackView.bounds.size.height) - bestSize = contentView.systemLayoutSizeFitting(maxAllowedSize, withHorizontalFittingPriority: .defaultLow, verticalFittingPriority: .required) + let maxAllowedSize = CGSize(width: 0, height: contentView.bounds.height) + bestSize = contentView.systemLayoutSizeFitting( + maxAllowedSize, + withHorizontalFittingPriority: .fittingSizeLevel, + verticalFittingPriority: .required + ) } setupRowToFixedValue(bestSize.height) } + // MARK: - Handle Touch public func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldReceive touch: UITouch) -> Bool { diff --git a/banner.png b/banner.png deleted file mode 100644 index 1f0bdbb..0000000 Binary files a/banner.png and /dev/null differ