Code Monkey home page Code Monkey logo

storyboardconstraint's Introduction

StoryboardConstraint

A simple way to use programmatically Autolayout Constraint created in Storyboard.

alt tag

Features

  • Predefined basic constraints: top, bottom, leading, trailing, height, width, centerX, centerY
  • A complete method to find a specific constraint through the views

Podfile

To integrate StoryboardConstraint into your Xcode project using CocoaPods, specify it in your Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'

target 'TargetName' do
  use_frameworks!
  pod 'StoryboardConstraint'
end

Then, run the following command:

$ pod install

How to Use

1. Add UIView+StoryboardConstraint.swift on your project

2. Get the constraints

You can get the constraint set in Storyboard like this:

customView.heightConstraint?.constant = 200
customView.topConstraint?.constant = 20

You can also set a custom constraint identifier and get it like this:

view.constraint(withIdentifier: "customWidth", searchInSubviews: true)?.constant = 50

If you want you can get all the constraints with a specified attribute like this:

view.constraints(withAttribute: .height)

This method returns all the constraints found ordered by priority.

Requirements

Current version is compatible with:

  • Swift 5.0
  • iOS 10 or later

storyboardconstraint's People

Contributors

dimix avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  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.