Coder Social home page Coder Social logo

flow's Introduction

Flow

test coverage


A layout for placing views in a flow-like arrangement in SwiftUI. A Flow organizes views sequentially, wrapping them onto new lines when the current line is filled. The alignment and spacing between views can be customized. Flow layouts are commonly used to display a set of tags.

Left-aligned tags. Right-aligned tags. Multi-colored rectangles languidly animating between different alignments. Multi-colored rectangles bordered in teal enthusiastically and jauntily animating between different alignments.

Using Flow is similar to using SwiftUI's VStack and HStack layouts/views. Alignment and spacing changes can be animated and since Flow conforms to the Layout protocol you can even animate changing to an entirely different layout type!

Usage

import Flow

struct ContentView: View {
    @State var tags: [Tag]

    var body: some View {
        // Default .topLeading alignment and system spacing.
        Flow { 
            ForEach(tags) { tag in
                TagView(tag)
            }
        }
        // Alignment and spacing specified.
        Flow(alignment: .bottomTrailing, spacing: 10) {
            ForEach(tags) { tag in
                TagView(tag)
            }
        }
    }
}

Check the documentation for more in-depth usage.

Installing

Swift Package Manager

Via Xcode

  • Select your .xcproject file
  • Select the project under PROJECT
  • Select Swift Package
  • Tap the + sign
  • Paste this repo's address https://github.com/toastersocks/Flow into the text field and hit 'Next'
  • Choose your version/branch on the next screen
  • Choose your targets and hit 'Finish'

flow's People

Contributors

toastersocks avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.