You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+61Lines changed: 61 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,6 +15,8 @@ You can think of it as `UITableView` but with several differences:
15
15
- Main Features
16
16
- System Requirements
17
17
- How to use it
18
+
- Adding Rows
19
+
- Removing Rows
18
20
19
21
### Main Features
20
22
@@ -36,3 +38,62 @@ You can think of it as `UITableView` but with several differences:
36
38
- Swift 5+
37
39
38
40
### How to use it
41
+
42
+
The main class of the package is `ScrollStack`, a subclass of `UIScrollView`. It manages the layout of each row, animations and keep a strong reference to your rows.
43
+
44
+
However usually you don't want to intantiate this control directly but by calling the `ScrollStackController` class.
45
+
It's a view controller which allows you to get the child view controller's managment for free, so when you add/remove a row to the stack you will get the standard UIViewController events for free!
46
+
47
+
This is an example of initialization in a view controller:
Now you are ready to use the `ScrollStack` control inside the `stackController` class.
63
+
`ScrollStack` have an extensible rich set of APIs to manage your layout: add, remove, move, hide or show your rows, including insets and separator management.
64
+
65
+
Each row managed by `ScrollStack` is a subclass of `ScrollStackRow`: it strongly reference a parent `UIViewController` class where you content is placed. `UIViewController`'s `view` will be the `contentView` of the row.
66
+
67
+
You don't need to handle lifecycle of your rows/view controller until they are part of the rows inside the stack.
68
+
69
+
Let's take a look below.
70
+
71
+
#### Adding Rows
72
+
73
+
`ScrollStack` provides a comprehensive set of methods for managing rows, including inserting rows at the beginning and end, inserting rows above or below other rows.
-`controller/s`: one or more `UIViewController` instances; each view of these controllers will be as a row of the stack inside a `ScrollStackRow` (a sort of cell).
83
+
-`at`: specify the insertion point. It's an enum with the following options: `top` (at first index), `bottom` (append at the bottom of the list), `atIndex` (specific index), `after` or `below` (after/below a row which contain a specific `UIViewController`).
84
+
-`animated`: if true insertion will be animated
85
+
-`completion`: completion callback to call at the end of the operation.
86
+
87
+
The following code add a rows with the view of each view controller passed:
As you noted there is not need to keep a strong reference to any view controller; they are automatically strong referenced by each row created to add them into the stack.
0 commit comments