• Stars
    star
    250
  • Rank 162,397 (Top 4 %)
  • Language
    Swift
  • License
    Other
  • Created almost 7 years ago
  • Updated almost 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

🚸 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 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 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 Repositories

1

Hue

🎨 Hue is the all-in-one coloring utility that you'll ever need.
Swift
3,463
star
2

Gray

🌓 Tailor your macOS Mojave experience
Swift
1,325
star
3

Spots

🎍 Spots is a cross-platform view controller framework for building component-based UIs
Swift
1,314
star
4

Blueprints

🌀 Blueprints - A framework that is meant to make your life easier when working with collection view flow layouts.
Swift
990
star
5

KeyboardCowboy

⌨️ The missing keyboard shortcut utility for macOS
Swift
740
star
6

Syncalicious

🍫 Syncalicious
Swift
356
star
7

Vaccine

💉 Vaccine - Make your apps immune to recompile-disease
Swift
303
star
8

Tailor

👔A super fast & convenient object mapper tailored for your needs
Swift
242
star
9

Versions

❇️Helping you find inner peace when comparing version numbers in Swift.
Swift
208
star
10

MarvinXcode

🔨A collection of nifty commands for your everyday workflow in Xcode
Swift
125
star
11

Differific

⛽ Differific - a fast and convenient diffing framework.
Swift
124
star
12

Coda-2-Modes

Modes for Coda 2
AppleScript
61
star
13

UserInterface

🚥 UserInterface - a collection of convenience extensions specifically tailored to building user interfaces in Swift.
Swift
51
star
14

ToTheTop

🔝To the top - A small macOS application to help you scroll to the top.
Swift
36
star
15

Zcode

Work around Apples restriction with running Xcode 6.4 on El Capitan Developer Preview 2
Swift
25
star
16

NSString-ZENInflections

Returns camelCased, UpperCamelCased, dashed-case, snake_cased representations of an NSString
Objective-C
25
star
17

Inflection

The Optimus Prime of string inflection
Swift
22
star
18

MouseDef

🐭Move and resize windows by holding down modifier keys
Swift
21
star
19

ChangeMarks

Change Marks helps you to keep track of your most recent changes by giving them a different background color.
Objective-C
14
star
20

OSX-Configuration

My personal OS X configurations
Shell
10
star
21

ZenCode

🔨ZenCode for Xcode - A collection of nifty commands for your everyday workflow in Xcode.
Swift
9
star
22

Apps

Swift
7
star
23

Voodoo

💀 Voodoo is a set of Sourcery templates to make you do more with less.
Swift
7
star
24

Houston

Swift
6
star
25

WindowFlex

Helps you flex your Xcode window muscles
Objective-C
6
star
26

Storage

Swift
5
star
27

AXEssibility

Swift
5
star
28

Mapper

An object mapper for Swift
Swift
4
star
29

Marvin-Xcode-Extension

🔨A collection of nifty commands for your everyday workflow in Xcode 8
Swift
4
star
30

Xcode-Templates

🔨 Xcode templates
Swift
4
star
31

Goldfish

Something something secret ... goldfish.
Swift
3
star
32

TextMate-1-Bundle

Commands and Snippets I use everyday at work
3
star
33

coda-command-line

Coda 2 command line tool
Objective-C
3
star
34

XcodeConfiguration

3
star
35

C.mode

C mode for Coda 2
AppleScript
3
star
36

DirectoryObserver

Observing the file-system, easy as 1 2 3!
Swift
3
star
37

GoldenRetriever

Swift
2
star
38

dotfiles

My dotfiles
Vim Script
2
star
39

xcode-fish

Find and open xcworkspace or xcproject in Xcode.
Shell
2
star
40

LaunchArguments

Swift
2
star
41

xcode-espresso-tribute-theme

A light theme inspired by the Espresso - The Web Editor
2
star
42

xcode-ios-project

Ruby
2
star
43

MachPort

Swift
2
star
44

ZENFramework

Just another PHP MVC framework
PHP
2
star
45

HideDockAndStageManager

Swift
2
star
46

Windows

Swift
2
star
47

NSString-ZENVersions

Helping you find inner peace when comparing version numbers.
Objective-C
2
star
48

ApacheConf.mode

Apache configuration mode for Coda 2
1
star
49

theme-oh-my-sushi

oh-my-sushi
Shell
1
star
50

SidebarFlex

Objective-C
1
star
51

Retina

Swift
1
star
52

KeyCodes

Swift
1
star
53

StageManagerAppWindowGroupingBehavior

Swift
1
star
54

Swift.mode

1
star
55

Ruby.mode

Ruby mode for Coda 2
AppleScript
1
star
56

DockManager

Swift
1
star
57

xc

Swift
1
star
58

haml.mode

HAML mode for Coda 2
1
star
59

ERB.mode

Ruby ERB mode for Coda 2
AppleScript
1
star
60

emolator

TBD
1
star
61

DefaultKeyBinding

Custom keyboard shortcuts for OS X
1
star