22

GitHub - zenangst/Family: A child view controller framework that makes setting u...

 5 years ago
source link: https://github.com/zenangst/Family
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

README.md

Family logo

CI Status Version Carthage Compatible Code Coverage License Platform Swift

Description

Family Icon

Family is a child view controller framework that makes setting up your parent controllers as easy as pie. With a simple yet powerful public API, you can build complex layout without losing maintainability. Leaving you to focus on what matters, making your applications pop and your business logic shine.

This framework was built to make it easier to build and maintain parent controllers, or made famous by other in the industry as flow controllers. Using child view controllers can make your code more modular, flexible and testable. There are just some shortcoming with the vanilla approach when dealing with child view controllers.

How do you get a continuous scrolling experience while keeping dequeuing intact?

This is where Family framework comes in, with the help of its layout algorithm, all your regular- and scroll views get stacked in the same linear vertical order you add them to the hierarchy. To achieve a continuous, your scroll-views no longer scroll themselves but get their new content offset passed to them by the parent scroll view that is handled for you internally in the framework. The algorithm also modifies the views frames on the fly, constraining the height to the window.

The story behind Family

If you are interested in the origin story behind Family, then you can read this Medium article.

Features

  • ?Animation support.
  • ??Continuous scrolling with multiple scroll views.
  • ?Margins between child view controllers.
  • ?Table view and collection view dequeuing.
  • ?Supports custom spacing between views.
  • ?iOS support.
  • ?macOS support.
  • ?tvOS support.

Usage

Adding a regular child view controller.

let familyController = FamilyViewController()
let viewController = UIViewController()

familyController.addChild(viewController)

Adding a child view controller constrained in height.

let familyController = FamilyViewController()
let viewController = UIViewController()

familyController.addChild(viewController, height: 175)

Adding a child view controller with a custom view on the controller.

let familyController = FamilyViewController()
let customController = CustomViewController()

// This will add the scroll view of the custom controller
// instead of the controllers view.
familyController.addChild(customController, view: { $0.scrollView })

Installation

Family is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'Family'

Family is also available through Carthage. To install just write into your Cartfile:

github "zenangst/Family"

Family can also be installed manually. Just download and drop Sources folders in your project.

Author

Christoffer Winterkvist, [email protected]

Contributing

We would love you to contribute to Family, check the CONTRIBUTING file for more info.

Credits

License

Family is available under the MIT license. See the LICENSE file for more info.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK