ProductPromotion
Logo

Swift

made by https://0x3d.site

GitHub - zenangst/Family: :children_crossing: A child view controller framework that makes setting up your parent controllers as easy as pie.
:children_crossing: A child view controller framework that makes setting up your parent controllers as easy as pie. - zenangst/Family
Visit Site

GitHub - zenangst/Family: :children_crossing: A child view controller framework that makes setting up your parent controllers as easy as pie.

GitHub - zenangst/Family: :children_crossing: A child view controller framework that makes setting up your parent controllers as easy as pie.

Family logo

CI Status Version Carthage Compatible codecov License Platform Swift

Description

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 layouts 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, also known as flow controllers. Using child view controllers can make your code more modular, flexible and testable. It addresses one of the biggest shortcomings of the vanilla approach: 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 scrolling view, your child scroll views no longer scroll themselves, but get their new content offset passed to them by the parent scroll view, which the framework handles for you. The framework 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.

Supporting the project

If you want to support the development of this framework, you can do so by becoming a sponsor. ❤️

Usage

The new public API:

body(withDuration: 0) {
  add(detailViewController)
  .background(.view(backgroundView))
  .padding(.init(top: 20, left: 20, bottom: 20, right: 20))
  .margin(.init(top: 20, left: 0, bottom: 20, right: 0))
}

Add a regular child view controller:

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

familyController.addChild(viewController)

Add a child view controller constrained by height:

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

familyController.addChild(viewController, height: 175)

Add 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 })

Move a view controller:

familyController.moveChild(customController, to: 1)

Perform batch updates (it is encouraged to use performBatchUpdates when updaing more than one view controller):

familyController.performBatchUpdates({ controller in
  controller.addChild(controller1)
  controller.addChild(controller2)
  controller.moveChild(controller2, to: 0)
  controller3.removeFromParent()
})

Adding animations

When adding animations, not that you have to give them a key.

let basicAnimation = CABasicAnimation()
basicAnimation.duration = 0.5
controller.view.layer.add(springAnimation, forKey: "Basic Animations")

let springAnimation = CASpringAnimation()
springAnimation.damping = 0.6
springAnimation.initialVelocity = 0.6
springAnimation.mass = 0.4
springAnimation.duration = 0.6
springAnimation.isRemovedOnCompletion = false
controller.view.layer.add(springAnimation, forKey: "Spring Animations")

Installation

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

pod 'Family'

and then run

pod install

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

github "zenangst/Family"

and then run

carthage install

When it's finished, install the built framework (which can be found in the Carthage/Build folder) into your Xcode project.

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.

More Resources
to explore the angular.

mail [email protected] to add your project or resources here 🔥.

Related Articles
to learn about angular.

FAQ's
to learn more about Angular JS.

mail [email protected] to add more queries here 🔍.

More Sites
to check out once you're finished browsing here.

0x3d
https://www.0x3d.site/
0x3d is designed for aggregating information.
NodeJS
https://nodejs.0x3d.site/
NodeJS Online Directory
Cross Platform
https://cross-platform.0x3d.site/
Cross Platform Online Directory
Open Source
https://open-source.0x3d.site/
Open Source Online Directory
Analytics
https://analytics.0x3d.site/
Analytics Online Directory
JavaScript
https://javascript.0x3d.site/
JavaScript Online Directory
GoLang
https://golang.0x3d.site/
GoLang Online Directory
Python
https://python.0x3d.site/
Python Online Directory
Swift
https://swift.0x3d.site/
Swift Online Directory
Rust
https://rust.0x3d.site/
Rust Online Directory
Scala
https://scala.0x3d.site/
Scala Online Directory
Ruby
https://ruby.0x3d.site/
Ruby Online Directory
Clojure
https://clojure.0x3d.site/
Clojure Online Directory
Elixir
https://elixir.0x3d.site/
Elixir Online Directory
Elm
https://elm.0x3d.site/
Elm Online Directory
Lua
https://lua.0x3d.site/
Lua Online Directory
C Programming
https://c-programming.0x3d.site/
C Programming Online Directory
C++ Programming
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
R Programming
https://r-programming.0x3d.site/
R Programming Online Directory
Perl
https://perl.0x3d.site/
Perl Online Directory
Java
https://java.0x3d.site/
Java Online Directory
Kotlin
https://kotlin.0x3d.site/
Kotlin Online Directory
PHP
https://php.0x3d.site/
PHP Online Directory
React JS
https://react.0x3d.site/
React JS Online Directory
Angular
https://angular.0x3d.site/
Angular JS Online Directory