GithubHelp home page GithubHelp logo

jvconstraintedges's Introduction

JVConstraintEdges

Short introduction JVConstraintEdges makes it very easy to add views that are constrainted to other views. Along with extensions to UIView, adding views programmatically is fast and easy.

How to use

This section is split up in two sections:

  1. The struct ConstraintEdges.
  2. General extensions.

ConstraintEdges

ConstraintEdges is a struct with 4 properties: leading, top, trailing and bottom. It is very similar to UIRectInsets, however, all the properties of ConstraintEdges are optional. There are a lot of overloaded/convencience overloads available e.g.:

let edges = ConstraintEdges(all: 5) // Initializes all 4 properties with a value of 5 
let view = UIView() 
view.fill(toSuperview: mySuperview, edges: edges) * 

*-Omit the edges parameters to completetly fill the calling uiview to the superview. -Add toSafeEdges to the parameters to fill it to the safe areas.

General UIView extensions

The following extensions are pretty commonly used:

  • Filling a view. fill(toSuperview: UIView,
    edges: ConstraintEdges? = nil,
    addToSuperView: Bool = true,
    toSafeMargins: Bool = false) This method is also seen in section ConstraintEdges.

  • Filling a view with a callback to the (added) constraints fillWithResult(โ€ฆ activateConstraints: Bool = true) Fill with result does do the same thing as the normal fill function, but it returns the constraints it has added.

  • Set equal height/width to other UIView .equal(to: UIView, height: Bool, width: Bool) The function signature is pretty clear what it does. It equals the height and/or width from the calling view .

TODO: Add more function descriptions.

jvconstraintedges's People

Contributors

jasperav avatar

Watchers

James Cloos avatar  avatar

jvconstraintedges's Issues

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.