Skip to content

Commit 0b1bc4a

Browse files
committed
Added back to top to readme
1 parent a57ec59 commit 0b1bc4a

File tree

1 file changed

+55
-1
lines changed

1 file changed

+55
-1
lines changed

README.md

Lines changed: 55 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ You can think of it as `UITableView` but with several differences:
1818
- **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.
1919
- **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.
2020

21+
<a name="index"/>
22+
2123
## Table of Contents
2224

2325
- [Main Features](#mainfeatures)
@@ -37,9 +39,10 @@ You can think of it as `UITableView` but with several differences:
3739
- [Rows Separator](#rowsseparator)
3840
- [Tap On Rows](#taponrows)
3941
- [Installation](#installation)
40-
- A[uthor & License](#authorlicense)
42+
- [Author & License](#authorlicense)
4143

4244
<a name="mainfeatures"/>
45+
4346
### Main Features
4447

4548

@@ -54,13 +57,17 @@ You can think of it as `UITableView` but with several differences:
5457
| 🐦 | Fully made in Swift 5 from Swift ❥ lovers |
5558

5659
<a name="systemrequirements"/>
60+
5761
### System Requirements
5862

5963
- iOS 9+
6064
- Xcode 10+
6165
- Swift 5+
6266

67+
[↑ Back To Top](#index)
68+
6369
<a name="whentousescrollstackcontrollerandwhennot"/>
70+
6471
### When to use `ScrollStackController` and when not
6572

6673
##### Yes
@@ -79,7 +86,10 @@ If you have a long list of rows you may experience delays.
7986

8087
So, `ScrollStackController` is generally not appropriate for screens that contain many views of the same type, all showing similar data (in these cases you should use `UITableView` or `UICollectionView`).
8188

89+
[↑ Back To Top](#index)
90+
8291
<a name="howtouseit"/>
92+
8393
### How to use it
8494

8595
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.
@@ -128,7 +138,10 @@ let lastRow = scrollStack.lastRow
128138

129139
Let's take a look below.
130140

141+
[↑ Back To Top](#index)
142+
131143
<a name="addingrows"/>
144+
132145
#### Adding Rows
133146

134147
`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.
@@ -157,7 +170,10 @@ The following code add a rows with the view of each view controller passed:
157170

158171
As you noticed 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.
159172

173+
[↑ Back To Top](#index)
174+
160175
<a name="removingreplacingrows"/>
176+
161177
#### Removing / Replacing Rows
162178

163179
A similar set of APIs are used to remove existing rows from the stack:
@@ -176,7 +192,10 @@ stackView.replaceRow(index: 1, withRow: galleryVC, animated: true) {
176192
}
177193
```
178194

195+
[↑ Back To Top](#index)
196+
179197
<a name="moverows"/>
198+
180199
#### Move Rows
181200

182201
If you need to adjust the hierarchy of the stack by moving a row from a position to another you can use:
@@ -190,7 +209,10 @@ let randomDst = Int.random(in: 1..<stackView.rows.count)
190209
stackView.moveRow(index: 0, to: randomDst, animated: true, completion: nil)
191210
```
192211

212+
[↑ Back To Top](#index)
213+
193214
<a name="hideshowrows"/>
215+
194216
#### Hide / Show Rows
195217

196218
`ScrollStack` uses the power of `UIStackView`: you can show and hide rows easily with a gorgeous animation by using one of the following methods:
@@ -206,7 +228,10 @@ stackView.setRowsHidden(indexes: [0,1,2], isHidden: true, animated: true)
206228

207229
Keep in mind: when you hide a rows the row still part of the stack and it's not removed, just hidden! If you get the list of rows by calling `rows` property of the `ScrollStack` you still see it.
208230

231+
[↑ Back To Top](#index)
232+
209233
<a name="reloadrows"/>
234+
210235
#### Reload Rows
211236

212237
Reload rows method allows you to refresh the layout of the entire stack (using `layoutIfNeeded()`) while you have a chance to update a specific row's `contentView` (aka the view of the managed `UIViewController`).
@@ -243,7 +268,10 @@ class GalleryVC: UIViewController, ScrollStackContainableController {
243268
}
244269
```
245270

271+
[↑ Back To Top](#index)
272+
246273
<a name="sizingrows"/>
274+
247275
#### Sizing Rows
248276

249277
You can control the size of your `UIViewController` inside a row of a `ScrollStack` in two ways:
@@ -260,7 +288,10 @@ Each of the following cases is covered inside the demo application:
260288
- Growing row based on `UITextView`'s content in [NotesVC](https://github.com/malcommac/ScrollStackController/blob/master/ScrollStackControllerDemo/Child%20View%20Controllers/NotesVC.swift)
261289
- Growing row based on `UITableView`'s content in [PricingVC](https://github.com/malcommac/ScrollStackController/blob/master/ScrollStackControllerDemo/Child%20View%20Controllers/PricingVC.swift)
262290

291+
[↑ Back To Top](#index)
292+
263293
<a name="fixedrowsize"/>
294+
264295
#### Fixed Row Size
265296

266297
If your view controller has a fixed size you can just return it as follows:
@@ -285,7 +316,10 @@ class GalleryVC: UIViewController, ScrollStackContainableController {
285316
If your stack support single axis you can obivously avoid switch condition.
286317
When you will add this view controller in a scroll stack it will be sized as you requested (any height/width constraint already in place will be removed).
287318

319+
[↑ Back To Top](#index)
320+
288321
<a name="fittinglayoutrowsize"/>
322+
289323
#### Fitting Layout Row Size
290324

291325
Sometimes you may want to have the content view sized by fitting the contents of the view controller's view. In these cases you can use `. fitLayoutForAxis`.
@@ -300,7 +334,10 @@ public func scrollStackRowSizeForAxis(_ axis: NSLayoutConstraint.Axis, row: Scro
300334

301335
`ScrollStack` will use the `systemLayoutSizeFitting()` method on your view controller's view to get the best size to fit the content.
302336

337+
[↑ Back To Top](#index)
338+
303339
<a name="collapsiblerows"/>
340+
304341
#### Collapsible Rows
305342

306343
Sometimes you may want to create collapsible rows.
@@ -336,7 +373,10 @@ In your main view controller you may call this:
336373

337374
And your rows will perform a great animation to resize its content.
338375

376+
[↑ Back To Top](#index)
377+
339378
<a name="workingwithdynamicuicollectionviewuitableviewuitextview"/>
379+
340380
#### Working with dynamic UICollectionView/UITableView/UITextView
341381

342382
There are some special cases where you may need to resize the row according to the changing content in your view controller's view.
@@ -375,7 +415,10 @@ public class PricingVC: UIViewController, ScrollStackContainableController {
375415

376416
In this way as you add new value to the table the size of the row in stack view will grown.
377417

418+
[↑ Back To Top](#index)
419+
378420
<a name="rowsseparator"/>
421+
379422
#### Rows Separator
380423

381424
Each row managed by `ScrollStack` is of a subview class of type `ScrollStackRow`. It has a strong referenced to managed `UIViewController` but also have a subview on bottom called `ScrollStackSeparator`.
@@ -391,7 +434,10 @@ Moreover you can set these values directly on `ScrollStack` controller in order
391434

392435
`ScrollStack` also have a property called `autoHideLastRowSeparator` to hide the last separator of the stack automatically.
393436

437+
[↑ Back To Top](#index)
438+
394439
<a name="taponrows"/>
440+
395441
#### Tap On Rows
396442

397443
By default rows are not tappable but if you need to implement some sort of tap features like in `UITableView` you can add it by setting a default callback for `onTap` property on `ScrollStackRow` instances.
@@ -426,7 +472,10 @@ class GalleryVC: UIViewController, ScrollStackRowHighlightable {
426472

427473
Transition between highlights state will be animated automatically.
428474

475+
[↑ Back To Top](#index)
476+
429477
<a name="installation"/>
478+
430479
### Installation
431480

432481
`ScrollStackContainer` can be installed with CocoaPods by adding pod 'ScrollStackContainer' to your Podfile.
@@ -437,8 +486,10 @@ pod 'ScrollStackContainer'
437486

438487
It also supports `Swift Package Maneger` aka SPM.
439488

489+
[↑ Back To Top](#index)
440490

441491
<a name="authorlicense"/>
492+
442493
### Author & License
443494

444495
`ScrollStackContainer` is developed and maintained by:
@@ -450,3 +501,6 @@ I fully welcome contributions, new features, feature requests, bug reports, and
450501
`ScrollStackContainer` is released under the MIT License.
451502
It was originally inspired by [`AloeStackView`](https://github.com/airbnb/AloeStackView) by Airbnb.
452503

504+
[↑ Back To Top](#index)
505+
506+

0 commit comments

Comments
 (0)