📱AutoLayout can be set differently for each device

Overview

DeviceLayout

logo

Carthage compatible Swift CI Status Version License Platform

DeviceLayout is a Swift framework that lets you set Auto Layout constraints's differently for each device

Using only IBInspector of Xcode to set up your constant per device size differently without any CODE :)

@IBInspectable make a migic with outh any CODE

Only 3 seconds you can set design guide and make designer happy 🚀

public enum Size: Int, Comparable {
    case unknownSize = 0
    /// iPhone 4, 4s, iPod Touch 4th gen.
    case screen3_5Inch
    /// iPhone 5, 5s, 5c, SE, iPod Touch 5-6th gen.
    case screen4Inch
    /// iPhone 6, 6s, 7, 8
    case screen4_7Inch
    /// iPhone 6+, 6s+, 7+, 8+
    case screen5_5Inch
    /// iPhone X, Xs
    case screen5_8Inch
    /// iPhone Xr
    case screen6_1Inch
    /// iPhone Xs Max
    case screen6_5Inch
    /// iPad Mini
    case screen7_9Inch
    /// iPad
    case screen9_7Inch
    /// iPad Pro (10.5-inch)
    case screen10_5Inch
    /// iPad Pro (11-inch)
    case screen11Inch
    /// iPad Pro (12.9-inch)
    case screen12_9Inch
}

Example

First inherit your constraint to DeviceLayoutConstraint

logo

Second Set your own constant per device size and adjust your UI design guide

comparing PSD, Sketch or Zeplin UI Guide

Make designer be happy :)

logo

Requirements

  • iOS 8.0+
  • Swift 3+, 4+, 5+

Installation

📲 Installation

DeviceLayout is available through Cocoapods or Carthage

pod "DeviceLayout"

Carthage

github "cruisediary/DeviceLayout" ~> 0.5.0

Dependencies

  • Device - Light weight tool for detecting the current device and screen size written in swift.

👨‍💻 Author

cruz, [email protected]

🛡 License

DeviceLayout is available under the MIT license. See the LICENSE file for more info.

You might also like...
An autolayout library for the damn fine citizens of San Diego.
An autolayout library for the damn fine citizens of San Diego.

Anchorman Do you think autolayout has to be hard? Nah. NSLayoutAnchor is pretty neat! But it's still a bit tedious of an API. Try writing .translatesA

Minimal AutoLayout convenience layer. Program constraints succinctly.

MiniLayout Minimal AutoLayout convenience layer. Program constraints succinctly. Usage Put label over textField // using MiniLayout: view.constrain(la

A AutoLayout Utility for iOS

QLayout is an Utility to make Auto Layout easy on iOS. Contents Requirements Installation Usage Credits License Requirements iOS 8.0+ Swift 3.0+ Insta

AutoLayout Micro DSL SPM from Chris Eidhof's article

EasyAutoLayout Intro EasyAutoLayout is a small framework built using the ideas presented in the article called Autolayout Micro DSL by Chris Eidhof. I

FrameLayoutKit is a super fast and easy to use autolayout kit
FrameLayoutKit is a super fast and easy to use autolayout kit

FrameLayoutKit FrameLayout is a super fast and easy to use layout library for iOS and tvOS. For Objective-C version: NKFrameLayoutKit (Deprecated, not

SwiftLayout - View hierarchy and autolayout DSL library

SwiftLayout view hierarchy and autolayout DSL library goal 뷰의 계층구조와 constraint 관

LayoutLoopHunter - Runtime-based setup for tracking autolayout feedback loops
LayoutLoopHunter - Runtime-based setup for tracking autolayout feedback loops

LayoutLoopHunter The library helps to catch the OOMs caused by Autolayout Feedback Loop by replicating the behavior of UIViewLayoutFeedbackLoopDebuggi

An extension that simplifies the work with Swift AutoLayout by writing cleaner, more natural and easy-reading code.

Installation For now you're able to clone repo in your project or download ZIP folder manually. git clone https://github.com/votehserxam/AutoLayout.gi

A set of libraries used for parsing representations of Swift Packages similar to how SwiftPM itself works

A set of libraries used for parsing representations of Swift Packages similar to how SwiftPM itself works, but also supporting Xcode specific features (such as Swift Playground Apps).

Comments
  • Fix iPhone sizes typos

    Fix iPhone sizes typos

    Hey,

    Thanks for you repo. it's really helpful.

    I fixed the typos according to inch display as mentioned in Apple Website.

    https://www.apple.com/shop/buy-iphone/iphone-8#

    https://www.apple.com/iphone-xs/display/

    https://www.apple.com/iphone-xr/display/

    https://www.apple.com/shop/buy-iphone/iphone-7

    opened by Maryom 15
  • Changing deviceSize() to static let deviceSize

    Changing deviceSize() to static let deviceSize

    How about changing

     open func deviceSize() -> Size {
        return Device.size()
     }
    

    to

    public static let deviceSize = Device.size()
    

    So you can use deviceSize like this

    if size == DeviceLayoutConstraint.deviceSize {
        self.constant = constant
        layoutIfNeeded()
    }
    
    

    This change might boost up performance little bit.

    type: perf 
    opened by purpleblues 2
  • development 0.1.0

    development 0.1.0

    chore

    • create project
    • create pod lib
    • set .gitignore
    • set .gitattributes

    feature

    • add DeviceLayoutConstraint

    test

    • add unittest for DeviceLayoutConstraint
    type: test type: feature type: chore 
    opened by cruisediary 0
Releases(0.5.0)
Owner
Cruz
🏄🏼 Open Source | iOS & Swift 📱+ ⛵️ engineer at @hyperconnect
Cruz
MisterFusion is Swift DSL for AutoLayout. It is the extremely clear, but concise syntax, in addition, can be used in both Swift and Objective-C. Support Safe Area and Size Class.

MisterFusion MisterFusion makes more easier to use AutoLayout in Swift & Objective-C code. Features Simple And Concise Syntax Use in Swift and Objecti

Taiki Suzuki 316 Nov 17, 2022
Write concise Autolayout code

Winner of Hacking with Swift Recommended award You + Stevia = ?? ?? Write concise, readable layouts ?? Reduce your maintenance time ?? Compose your st

Fresh 3.3k Jan 6, 2023
An easier and faster way to code Autolayout

EZAnchor 中文介绍 An easier way to code Autolayout Are you annoyed of coding .active = true while using Autolayout Anchors over and over again? Are you an

Alex.Liu 25 Feb 20, 2022
The fast path to autolayout views in code

NorthLayout The fast path to autolayout views in code Talks https://speakerdeck.com/banjun/auto-layout-with-an-extended-visual-format-language at AltC

banjun 36 Jul 15, 2022
A Swift Autolayout DSL for iOS & OS X

SnapKit is a DSL to make Auto Layout easy on both iOS and OS X. ⚠️ To use with Swift 4.x please ensure you are using >= 4.0.0 ⚠️ ⚠️ To use with Swift

null 19.1k Jan 2, 2023
🏗 MondrianLayout - describing structured layout for AutoLayout

?? A DSL based layout builder for AutoLayout

Muukii 155 Dec 10, 2022
This "Calculator" application is a simple one screen design of calculator screen i have made this single screen design application just to practice AutoLayout concepts.

Calculator Layout This "Calculator" application is a simple one screen design of calculator screen i have made this single screen design application j

Chetan Parate 1 Oct 29, 2021
Harness the power of AutoLayout NSLayoutConstraints with a simplified, chainable and expressive syntax. Supports iOS and OSX Auto Layout

Masonry Masonry is still actively maintained, we are committed to fixing bugs and merging good quality PRs from the wider community. However if you're

null 18k Jan 5, 2023
A bit of steroids for AutoLayout, powered by Swift.

AutoLayoutPlus AutoLayoutPlus is a Swift library consisting in a set of extensions to help dealing with Auto Layout programatically. With AutoLayoutPl

Rui Costa 27 Jul 25, 2022
Tiny Swift DSL for Autolayout

SwiftAutoLayout SwiftAutoLayout is a tiny DSL for Autolayout intended to provide a more declarative way to express layout constraints. Here's a quick

Indragie Karunaratne 657 Sep 18, 2022