All Projects → MaksimKurpa → IBLayoutConstraint

MaksimKurpa / IBLayoutConstraint

Licence: MIT license
📏 Configure constraints for each device in Interface Builder with IBLayoutConstraint.

Programming Languages

swift
15916 projects
ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to IBLayoutConstraint

Swift101
That contains various information and examples about the basics of Swift Programming. 💻 📱 📺 ⌚️
Stars: ✭ 28 (+16.67%)
Mutual labels:  swift5, swift-5
Keepwords
📱🔐 Need an iOS password managing app with no pods? We got you covered!
Stars: ✭ 17 (-29.17%)
Mutual labels:  swift5, swift-5
Tinyconstraints
Nothing but sugar.
Stars: ✭ 3,721 (+15404.17%)
Mutual labels:  swift5, swift-5
Table
CLI tables in Swift
Stars: ✭ 53 (+120.83%)
Mutual labels:  swift5, swift-5
Extras
Just some extras..
Stars: ✭ 17 (-29.17%)
Mutual labels:  swift5, swift-5
Hippolyte
HTTP Stubbing in Swift
Stars: ✭ 109 (+354.17%)
Mutual labels:  swift5, swift-5
ios ui recipe showcase
iOSアプリ開発 - UI実装であると嬉しいレシピブック掲載サンプル
Stars: ✭ 54 (+125%)
Mutual labels:  interface-builder, swift5
Ibanimatable
Design and prototype customized UI, interaction, navigation, transition and animation for App Store ready Apps in Interface Builder with IBAnimatable.
Stars: ✭ 8,585 (+35670.83%)
Mutual labels:  interface-builder
Switch
💊 An iOS switch control implemented in Swift with full Interface Builder support
Stars: ✭ 132 (+450%)
Mutual labels:  interface-builder
Nibview
Tiny Swift framework to reference nibs from anywhere - code, other nibs or storyboards ✨
Stars: ✭ 54 (+125%)
Mutual labels:  interface-builder
Color Picker For Ios
Colorful: iOS color picker built with Swift.
Stars: ✭ 709 (+2854.17%)
Mutual labels:  interface-builder
Simpletab
A Simple iOS Tab Bar Controller with animation support.
Stars: ✭ 83 (+245.83%)
Mutual labels:  interface-builder
Yapi To Typescript
根据 YApi 或 Swagger 的接口定义生成 TypeScript/JavaScript 的接口类型及其请求函数代码。
Stars: ✭ 161 (+570.83%)
Mutual labels:  interface-builder
Instantsearch Ios Examples
Example apps built with InstantSearch iOS
Stars: ✭ 55 (+129.17%)
Mutual labels:  interface-builder
Lmgaugeview
LMGaugeView is a simple and customizable gauge control for iOS.
Stars: ✭ 224 (+833.33%)
Mutual labels:  interface-builder
Typescript Type Generator
Generate interfaces on the go! Network request? Then generate interfaces for response!
Stars: ✭ 11 (-54.17%)
Mutual labels:  interface-builder
MMAdvertScrollView
一个简单、轻量级的swift版公告轮播框架
Stars: ✭ 42 (+75%)
Mutual labels:  swift5
Ibcustomfonts
IBCustomFonts category allows you to use custom fonts from Interface Builder (IB) when building your iOS apps. Apps using IBCustomFonts category are approved by Apple App Store (check readme.md on latest info). Tested on iOS6 - iOS11.
Stars: ✭ 214 (+791.67%)
Mutual labels:  interface-builder
Floatinglabeltextfieldswiftui
Floating Label TextField for SwiftUI. FloatingLabelTextFieldSwiftUI
Stars: ✭ 128 (+433.33%)
Mutual labels:  interface-builder
Iconic
🎨 Auto-generated icon font library for iOS, watchOS and tvOS
Stars: ✭ 1,567 (+6429.17%)
Mutual labels:  interface-builder

IBLayoutConstraint

📏 Configure constraints for each device in Interface Builder with IBLayoutConstraint.

Requirements

IBLayoutConstraint is written in Swift 5.0 and is available on iOS/Mac Catalyst 11.0 or higher.

Installation

Dependency Managers

CocoaPods

CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:

$ gem install cocoapods

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

source 'https://cdn.cocoapods.org/'
platform :ios, '11.0'

pod 'IBLayoutConstraint'

Then, run the following command:

$ pod install

Introduction

The main thought of this framework is convinient way to configure constraint for each device in Interface Builder. Sometimes we need to change constant/multiplier value for NSLayoutConstraint only for specific device, for example, for iPhone 5s (4"). If this UIView with layout has special constraint for one device, we should do:

  1. inheritance from UIView
  2. add outlet to this view @IBOutlet weak private var someConstraint: NSLayoutConstraint!
  3. add some code to change constraint's value for specific device
if UIDevice.current.isIPhone5() {
     someConstraint.constant = 290
}

IBLayoutConstraint will takes responsibility for this cases.

How to use

(!) Notice: This approach isn't quite obvious, and you should point out it in documentation of your project.
  1. Find constraint for configuration in Interface Builder View in Xcode.

  2. Go to Indentity Inspector for this constraint in right-side panel.

  3. Change Class NSLayoutConstraint to IBLayoutConstraint

    If you want to specify multiplier value or constraintand multiplier toghether, you should use IBMultiplierLayoutConstraint.

  4. Go to Attributes Inspector for this constraint in right-side panel. You'll see:

IBLayoutConstraint

IBLayoutConstraint

IBMultiplierLayoutConstraint

IBLayoutConstraint
  1. Find the screen size in inches that matches your need. You'll see two textfields:

    Width - value for landscape mode

    Height - value for portrait mode

    Fill the text fields. The necessary value will be applied after initialization and will change accordingly after device rotation.

Note: You don't need specify values for all sizes,but you need specify values for 'width' and 'height' in one line - it is required (even if you don't support rotation). If values don't specified for some size - IBLayoutConstraint will work as NSLayoutConstraint.

Contributing

Issues and pull requests are welcome!

Author

Maksim Kurpa - @maksim_kurpa

License

This code is distributed under the terms and conditions of the MIT license.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].