• This repository has been archived on 22/Dec/2023
  • Stars
    star
    990
  • Rank 46,251 (Top 1.0 %)
  • Language
    Swift
  • License
    Other
  • Created over 6 years ago
  • Updated over 1 year ago

Reviews

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

Repository Details

πŸŒ€ Blueprints - A framework that is meant to make your life easier when working with collection view flow layouts.

Blueprints logo Blueprints Preview

CI Status Version Carthage Compatible Code Coverage License Platform Swift

Description

Blueprints Icon

Blueprints is a collection of flow layouts that is meant to make your life easier when working with collection view flow layouts. It comes with two built-in layouts that are highly flexible and easy to configure at the call-site. They support properties like items per row and items per column; this will calculate the layout attributes needed for fitting the number of views that you want to appear on the screen.

The framework also provides a good base for your custom implementations. By extending the core blueprint layout, you get built-in support for animations and layout attribute caching. The bundled default animator supports animations that look very similar to what you get from a vanilla table view. If you want to provide your collection view animator, no problem; you can inject an animator of your choosing when initializing the layout.

Features

  • 🍭 Animation support
  • 🀳🏻 Optimized for performance
  • πŸ“ Built-in vertical and horizontal layouts
  • πŸ“° Supports header and footers
  • πŸ– Supports sticky headers and footers
  • 🌈 Built-in mosiac layout
  • πŸ’¦ Built-in vertical layout that supports waterfall
  • πŸ“± iOS support
  • πŸ’» macOS support
  • πŸ“Ί tvOS support
  • πŸ¦– Objective-C support

Supporting the project

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

Preview

iOS macOS
iOS PReview macOS Preview

How do items per row work?

If you specify how many items per row that you want to appear in a vertical layout, the width of the layout attribute will be calculated for you taking the section inset, item spacing into account to make sure that all views fit your design. For example, if you set that you want two items per row, then two views will appear on the same row side by side. If you want to create a table view layout, you would simply set the items per row value to be one. You can use this variable for horizontal layouts as well, but instead of creating a new row, the value is used to create a width to cover the desired area. If you want the width to span across the entire container then simply set it to one, if you want to create a carousel layout with hinting, setting a value like 1.1 will render at least one complete item and give a visual hint to the user that another view is available if the scroll horizontally.

How do items per column work?

Items per column are explicitly for horizontal layouts and are used to decide how many items that should be shown on screen but using a vertical axis. If you set it to two, it will display two views, one above and one below and then continue to build the rest of the views horizontally, following the same pattern.

How does item sizes work?

It works just like a regular flow layout, but with a twist. If you want to provide a static size using the regular item size, you are free to do so. As mentioned above, you can also provide the number of views that you want visible on the screen based on the container views width. To provide dynamic sizing, you can make your collection view delegate conform to UICollectionViewDelegateFlowLayout or NSCollectionViewDelegateFlowLayout. That way you can compute the values based on the data coming from the data source etc. Worth noting is that using itemsPerRow takes precedence over the other alternatives.

Dynamic sizing preview

Usage

Vertical layout

let blueprintLayout = VerticalBlueprintLayout(
  itemsPerRow: 1.0,
  height: 50,
  minimumInteritemSpacing: 10,
  minimumLineSpacing: 10,
  sectionInset: EdgeInsets(top: 10, left: 10, bottom: 10, right: 10),
  stickyHeaders: true,
  stickyFooters: false
)
let collectionView = UICollectionView(frame: .zero,
                                      collectionViewLayout: blueprintLayout)

Horizontal layout

let blueprintLayout = HorizontalBlueprintLayout(
  itemsPerRow: 1.0,
  itemsPerColumn: 2,
  height: 50,
  minimumInteritemSpacing: 10,
  minimumLineSpacing: 10,
  sectionInset: EdgeInsets(top: 10, left: 10, bottom: 10, right: 10),
  stickyHeaders: true,
  stickyFooters: true
)
let collectionView = UICollectionView(frame: .zero,
                                      collectionViewLayout: blueprintLayout)

Mosaic layout

let mosaicLayout = VerticalMosaicBlueprintLayout(
  patternHeight: 400,
  minimumInteritemSpacing: 2,
  minimumLineSpacing: 2,
  sectionInset: EdgeInsets(top: 2, left: 2, bottom: 2, right: 2),
  patterns: [
    MosaicPattern(alignment: .left, direction: .vertical, amount: 2, multiplier: 0.6),
    MosaicPattern(alignment: .left, direction: .horizontal, amount: 2, multiplier: 0.33),
    MosaicPattern(alignment: .left, direction: .vertical, amount: 1, multiplier: 0.5),
    MosaicPattern(alignment: .left, direction: .vertical, amount: 1, multiplier: 0.5)
  ])
let collectionView = UICollectionView(frame: .zero,
                                      collectionViewLayout: mosaicLayout)

Installation

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

pod 'Blueprints'

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

github "zenangst/Blueprints"

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

Author(s)

Contributing

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

License

Blueprints 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

KeyboardCowboy

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

Syncalicious

🍫 Syncalicious
Swift
356
star
6

Vaccine

πŸ’‰ Vaccine - Make your apps immune to recompile-disease
Swift
303
star
7

Family

🚸 A child view controller framework that makes setting up your parent controllers as easy as pie.
Swift
250
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