Latest 0.1.1
Homepage https://github.com/dimix/StoryboardConstraint
License MIT
Platforms ios 9.0
Authors

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 4.0
  • iOS 9 or later

Latest podspec

{
    "name": "StoryboardConstraint",
    "version": "0.1.1",
    "summary": "A simple way to use programmatically Autolayout Constraint created in Storyboard.",
    "description": "A simple way to use programmatically Autolayout Constraint created in Storyboard.n- Predefined basic constraints: top, bottom, leading, trailing, height, width, centerX, centerYn- A complete method to find a specific constraint through the views",
    "homepage": "https://github.com/dimix/StoryboardConstraint",
    "screenshots": "https://raw.githubusercontent.com/dimix/StoryboardConstraint/master/readme-images/demo.gif",
    "license": "MIT",
    "authors": {
        "Dimitri Giani": "[email protected]"
    },
    "platforms": {
        "ios": "9.0"
    },
    "source": {
        "git": "https://github.com/dimix/StoryboardConstraint.git",
        "tag": "0.1.1"
    },
    "source_files": [
        "Classes",
        "StoryboardConstraint/*.{swift}"
    ],
    "pushed_with_swift_version": "4.0"
}

Pin It on Pinterest

Share This