Skip to content
This repository was archived by the owner on Jun 25, 2021. It is now read-only.

Commit ab7d00d

Browse files
author
daniele
committed
Merge branch 'release/0.5.0'
2 parents 92e2849 + 275086a commit ab7d00d

28 files changed

+1828
-2
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.DS_Store

.swift-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.1

LICENSE

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Copyright (c) 2015 daniele margutti <me@danielemargutti.com>
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is
8+
furnished to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in
11+
all copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19+
THE SOFTWARE.

Package.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import PackageDescription
2+
3+
let package = Package(
4+
name: "ScrollingStackContainer"
5+
)

README.md

Lines changed: 124 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,124 @@
1-
# ScrollingStackContainer
2-
Scrolling stack-view container
1+
<p align="center" >
2+
<img src="https://raw.githubusercontent.com/malcommac/ScrollingStackContainer/develop/logo.png" width=300px height=197px alt="ScrollingStackContainer" title="ScrollingStackContainer">
3+
</p>
4+
5+
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) [![CI Status](https://travis-ci.org/malcommac/ScrollingStackContainer.svg)](https://travis-ci.org/malcommac/ScrollingStackContainer) [![Version](https://img.shields.io/cocoapods/v/ScrollingStackContainer.svg?style=flat)](http://cocoadocs.org/docsets/ScrollingStackContainer) [![License](https://img.shields.io/cocoapods/l/ScrollingStackContainer.svg?style=flat)](http://cocoadocs.org/docsets/ScrollingStackContainer) [![Platform](https://img.shields.io/cocoapods/p/ScrollingStackContainer.svg?style=flat)](http://cocoadocs.org/docsets/ScrollingStackContainer)
6+
7+
<p align="center" >★★ <b>Star our github repository to help us!</b> ★★</p>
8+
<p align="center" >Created by <a href="http://www.danielemargutti.com">Daniele Margutti</a> (<a href="http://www.twitter.com/danielemargutti">@danielemargutti</a>)</p>
9+
10+
`ScrollingStackContainer` is an efficient scrolling `UIStackView` replacement, more suitable in situations when you are building a scrolling container with an heterogeneous number of items.
11+
It allows you to stack vertically `UIViewController` instances where the view is a simple fixed-height `UIView` or a `UICollectionView` or `UITableView`.
12+
13+
## Motivation
14+
A full article about the motivation behind this class is available on Medium (or in my personal blog). Check it here for full details about how the class works.
15+
16+
UITableView and UICollectionView are great when you need to display a number of relatively simple cells; when your layout became complex you may need to create different UIViewController which manages each different kind layout.
17+
These view controller may contains simple fixed-height `UIView` or complex `UICollectionView`/`UITableView`; in these cases you need to be careful because expading your scrollviews will destroy internal iOS caching mechanism.
18+
`ScrollingStackContainer` allows you to stack view controllers easily without any worry; it manages view controllers with scrolling collections automatically in order to reduce the amount of memory usage.
19+
20+
## How to use it
21+
22+
It's very simple to implement: for **fixed height views** you should set a valid `height` (grater than zero). This can be done in your `UIViewController`'s subclass in one of the following ways:
23+
24+
* set an height constraint on `UIViewController`’s .view
25+
* … or return a value into `preferredContentSize()` function
26+
* … or set the height via `self.frame`
27+
* … or by implementing the `StackContainable` protocol and returning `.view(height: <height>)` with a valid value.
28+
29+
For view controllers which **contains inner’s scroll views** (for example table or collections) you need to implement the `StackContainble` protocol by returning `.scroll(<inner scroll instance>, <insets of the inner scroll in superview>)`.
30+
31+
After that you should simply set the `viewControllers` property of your `ScrollingStackContainer` subclass:
32+
33+
```swift
34+
// view controller's view are stacked vertically in order
35+
self.viewControllers = [controller_2,controller_1,controller_3]
36+
```
37+
38+
That’s all! All the business logic is managed by the class and you can enjoy!
39+
40+
See the example in this repository to get a live preview!
41+
42+
The following example is a vertical stack which contains a fixed height view controller, a view controller with a table inside and another fixed height controller.
43+
44+
![ScrollingStackContainer](https://raw.githubusercontent.com/malcommac/ScrollingStackContainer/develop/example.gif)
45+
46+
## You also may like
47+
48+
Do you like `ScrollingStackContainer`? I'm also working on several other opensource libraries.
49+
50+
Take a look here:
51+
52+
* **[Hydra](https://github.com/malcommac/Hydra)** - Promises & Await/Async in Swift - Write better async code in Swift
53+
* **[SwiftLocation](https://github.com/malcommac/SwiftLocation)** - CoreLocation and Beacon Monitoring on steroid!
54+
* **[SwiftRichString](https://github.com/malcommac/SwiftRichString)** - Elegant and painless attributed string in Swift
55+
* **[SwiftScanner](https://github.com/malcommac/SwiftScanner)** - String scanner in pure Swift with full unicode support
56+
* **[SwiftSimplify](https://github.com/malcommac/SwiftSimplify)** - Tiny high-performance Swift Polyline Simplification Library
57+
* **[SwiftMsgPack](https://github.com/malcommac/SwiftMsgPack)** - MsgPack Encoder/Decoder in Swit
58+
59+
## Installation
60+
61+
`ScrollingStackContainer` supports multiple methods for installing the library in a project.
62+
63+
## Installation with CocoaPods
64+
65+
[CocoaPods](http://cocoapods.org) is a dependency manager for Objective-C, which automates and simplifies the process of using 3rd-party libraries like `ScrollingStackContainer` in your projects. You can install it with the following command:
66+
67+
```bash
68+
$ gem install cocoapods
69+
```
70+
71+
#### Podfile
72+
73+
To integrate ScrollingStackContainer into your Xcode project using CocoaPods, specify it in your `Podfile`:
74+
75+
```ruby
76+
source 'https://github.com/CocoaPods/Specs.git'
77+
platform :ios, '8.0'
78+
79+
target 'TargetName' do
80+
use_frameworks!
81+
pod 'ScrollingStackContainer', '~> 0.5'
82+
end
83+
```
84+
85+
Then, run the following command:
86+
87+
```bash
88+
$ pod install
89+
```
90+
91+
### Installation with Carthage
92+
93+
[Carthage](https://github.com/Carthage/Carthage) is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.
94+
95+
You can install Carthage with [Homebrew](http://brew.sh/) using the following command:
96+
97+
```bash
98+
$ brew update
99+
$ brew install carthage
100+
```
101+
102+
To integrate ScrollingStackContainer into your Xcode project using Carthage, specify it in your `Cartfile`:
103+
104+
```ogdl
105+
github "malcommac/ScrollingStackContainer" ~> 0.5
106+
```
107+
108+
Run `carthage` to build the framework and drag the built `ScrollingStackContainer.framework` into your Xcode project.
109+
110+
## Requirements
111+
112+
Current version is compatible with:
113+
114+
* Swift 3.1
115+
* iOS 8 or later
116+
* ...and virtually any platform which is compatible with Swift 3 and implements the Swift Foundation Library
117+
118+
119+
## Credits & License
120+
ScrollingStackContainer is owned and maintained by [Daniele Margutti](http://www.danielemargutti.com/) along with main contributions of [Jeroen Houtzager](https://github.com/Hout).
121+
122+
As open source creation any help is welcome!
123+
124+
The code of this library is licensed under MIT License; you can use it in commercial products without any limitation.
114 KB
Binary file not shown.

ScrollingStackContainer.podspec

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Pod::Spec.new do |spec|
2+
spec.name = 'ScrollingStackContainer'
3+
spec.version = '0.5.0'
4+
spec.summary = 'Efficient Scrolling Stack Container'
5+
spec.homepage = 'https://github.com/malcommac/ScrollingStackContainer'
6+
spec.license = { :type => 'MIT', :file => 'LICENSE' }
7+
spec.author = { 'Daniele Margutti' => 'me@danielemargutti.com' }
8+
spec.social_media_url = 'http://twitter.com/danielemargutti'
9+
spec.source = { :git => 'https://github.com/malcommac/ScrollingStackContainer.git', :tag => "#{spec.version}" }
10+
spec.source_files = 'Sources/**/*.swift'
11+
spec.ios.deployment_target = '8.0'
12+
spec.requires_arc = true
13+
spec.module_name = 'ScrollingStackContainer'
14+
end

ScrollingStackContainer/.DS_Store

10 KB
Binary file not shown.

0 commit comments

Comments
 (0)