Skip to content

Commit d0de3e6

Browse files
committed
Merge branch 'release/1.3.0'
2 parents aeeb41b + 3ad23a9 commit d0de3e6

File tree

9 files changed

+278
-97
lines changed

9 files changed

+278
-97
lines changed

README.md

Lines changed: 36 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
[![Twitter Follow](https://img.shields.io/twitter/follow/danielemargutti?label=Follow%20Me&style=social)](https://twitter.com/danielemargutti)
1111

1212
# ScrollStackController
13-
Create complex scrollable layout using UIViewController and simplify your code!
13+
Create complex scrollable layout using UIViewControllers or plain UIViews and simplify your code!
1414

1515
ScrollStackController was created and maintaned by [Daniele Margutti](https://twitter.com/danielemargutti)[Web Site](https://www.danielemargutti.com)
1616

@@ -19,7 +19,8 @@ ScrollStackController is a class you can use to create complex layouts using scr
1919

2020
You can think of it as `UITableView` but with several differences:
2121

22-
- **Each row is a different `UIViewController` you can manage independently**: no more massive controllers, a much cleaner and maintainable architecture.
22+
- **Each row can a different `UIViewController` you can manage independently**: no more massive controllers, a much cleaner and maintainable architecture.
23+
- **You can still use plain `UIView` instances if need a lightweight solution**: this is especially useful when you are using ScrollStackController as layout-helper or your view don't have a complex logic and you can still use the main controller.
2324
- **Powered by AutoLayout since the beginning**; it uses a combination of `UIScrollView + UIStackView` to offer an animation friendly controller ideal for fixed and dynamic row sizing.
2425
- **You don't need to struggle yourself with view recycling**: suppose you have a layout composed by several different screens. There is no need of view recycling but it cause a more difficult managment of the layout. With a simpler and safer APIs set `ScrollStackView` is the ideal way to implement such layouts.
2526

@@ -30,6 +31,7 @@ You can think of it as `UITableView` but with several differences:
3031
|--- |--------------------------------------------------------------------------------- |
3132
| 🕺 | Create complex layout without the boilerplate required by view recyling of `UICollectionView` or `UITableView`. |
3233
| 🧩 | Simplify your architecture by thinking each screen as a separate-indipendent `UIVIewController`. |
34+
| 🧩 | Support for lightweight mode to layout `UIView` without `UIViewController`. |
3335
| 🌈 | Animate show/hide and resize of rows easily even with custom animations! |
3436
|| Compact code base, less than 1k LOC with no external dependencies. |
3537
| 🎯 | Easy to use and extensible APIs set. |
@@ -49,16 +51,17 @@ You can think of it as `UITableView` but with several differences:
4951
- [Hide / Show Rows with custom animations](#customanimations)
5052
- [Reload Rows](#reloadrows)
5153
- [Sizing Rows](#sizingrows)
52-
- [Fixed Row Size](#fixedrowsize)
53-
- [Fitting Layout Row Size](#fittinglayoutrowsize)
54-
- [Collapsible Rows](#collapsiblerows)
55-
- [Working with dynamic UICollectionView/UITableView/UITextView](#workingwithdynamicuicollectionviewuitableviewuitextview)
56-
- [Rows Separator](#rowsseparator)
57-
- [Tap On Rows](#taponrows)
58-
- [Get the row/controller](#utilsmethods)
59-
- [Set Row Insets](#setrowinsets)
60-
- [Change ScrollStack scrolling axis](#changescrollaxis)
61-
- [Subscribe to Events](#rowevents)
54+
- [Fixed Row Size](#fixedrowsize)
55+
- [Fitting Layout Row Size](#fittinglayoutrowsize)
56+
- [Collapsible Rows](#collapsiblerows)
57+
- [Working with dynamic UICollectionView/UITableView/UITextView](#workingwithdynamicuicollectionviewuitableviewuitextview)
58+
- [Using plain UIViews instead of view controllers](#lightweightplainuiview)
59+
- [Rows Separator](#rowsseparator)
60+
- [Tap On Rows](#taponrows)
61+
- [Get the row/controller](#utilsmethods)
62+
- [Set Row Insets](#setrowinsets)
63+
- [Change ScrollStack scrolling axis](#changescrollaxis)
64+
- [Subscribe to Events](#rowevents)
6265
- [Example App](#exampleapp)
6366
- [Installation](#installation)
6467
- [System Requirements](#systemrequirements)
@@ -500,6 +503,27 @@ Moreover you can set these values directly on `ScrollStack` controller in order
500503

501504
[↑ Back To Top](#index)
502505

506+
<a name="lightweightplainuiview"/>
507+
508+
### Using plain UIViews instead of view controllers
509+
510+
Since version 1.3.x ScrollStack can also be used to layout plain `UIView` instances which not belong to a parent view controllers.
511+
This is especially useful when you don't have a complex logic in your views and you want to use ScrollStack to make custom layout and keep your code lightweight.
512+
513+
Using plain views is pretty easy; each row method supports both `UIView` or `UIViewController` as parameter.
514+
515+
Since you are working with plain `UIView` instances in order to size it correctly you must set its `heightAnchor` or `widthAncor` (depending of your stack orientation) before adding it to the stack.
516+
As for controllers, `ScrollStack` keeps a strong reference to the managed view which is added as `contentView` of the parent `ScrollStackRow` instance as it happens for `UIViewController`'s `.view` property.
517+
518+
This is a small example:
519+
520+
```swift
521+
let myCustomView = UIView(frame: .zero)
522+
myCustomView.backgroundColor = .green
523+
myCustomView.heightAnchor.constraint(equalToConstant: 300).isActive = true
524+
stackView.addRow(view: myCustomView)
525+
```
526+
503527
<a name="taponrows"/>
504528

505529
### Tap On Rows

ScrollStackController.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = "ScrollStackController"
3-
s.version = "1.2.3"
3+
s.version = "1.3.0"
44
s.summary = "Create complex scrollable layout using UIViewController and simplify your code"
55
s.homepage = "https://github.com/malcommac/ScrollStackController"
66
s.license = { :type => "MIT", :file => "LICENSE" }

ScrollStackController.xcodeproj/project.pbxproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,7 @@
544544
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
545545
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
546546
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
547-
MARKETING_VERSION = 1.2.0;
547+
MARKETING_VERSION = 1.3.0;
548548
ONLY_ACTIVE_ARCH = NO;
549549
PRODUCT_BUNDLE_IDENTIFIER = "com.ScrollStackController.ScrollStackController-iOS";
550550
PRODUCT_NAME = ScrollStackController;
@@ -569,7 +569,7 @@
569569
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
570570
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
571571
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
572-
MARKETING_VERSION = 1.2.0;
572+
MARKETING_VERSION = 1.3.0;
573573
PRODUCT_BUNDLE_IDENTIFIER = "com.ScrollStackController.ScrollStackController-iOS";
574574
PRODUCT_NAME = ScrollStackController;
575575
SKIP_INSTALL = YES;
@@ -623,7 +623,7 @@
623623
INFOPLIST_FILE = ScrollStackControllerDemo/Info.plist;
624624
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
625625
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
626-
MARKETING_VERSION = 1.2.3;
626+
MARKETING_VERSION = 1.3.0;
627627
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
628628
MTL_FAST_MATH = YES;
629629
PRODUCT_BUNDLE_IDENTIFIER = com.danielemargutti.ScrollStackControllerDemo;
@@ -651,7 +651,7 @@
651651
INFOPLIST_FILE = ScrollStackControllerDemo/Info.plist;
652652
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
653653
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
654-
MARKETING_VERSION = 1.2.3;
654+
MARKETING_VERSION = 1.3.0;
655655
MTL_FAST_MATH = YES;
656656
PRODUCT_BUNDLE_IDENTIFIER = com.danielemargutti.ScrollStackControllerDemo;
657657
PRODUCT_NAME = "$(TARGET_NAME)";

ScrollStackControllerDemo/ViewController.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,14 @@ class ViewController: UIViewController, ScrollStackControllerDelegate {
5050
pricingVC = PricingVC.create(delegate: self)
5151
notesVC = NotesVC.create(delegate: self)
5252

53+
/*
54+
Plain UIView example
55+
let plainView = UIView(frame: .zero)
56+
plainView.backgroundColor = .green
57+
plainView.heightAnchor.constraint(equalToConstant: 300).isActive = true
58+
stackView.addRow(view: plainView)
59+
*/
60+
5361
stackView.addRows(controllers: [welcomeVC, notesVC, tagsVC, galleryVC,pricingVC], animated: false)
5462
}
5563

0 commit comments

Comments
 (0)