Latest 0.1.0
Homepage https://github.com/demtej/MagicLayout
License MIT
Platforms ios 8.0
Authors

📲 How to Install

Using CocoaPods

Edit your Podfile and specify the dependency:

pod 'MagicLayout', '~> 0.1.0'

🌟 Features

  • [x] Easy to install
  • [x] Easy to use
  • [x] Intuitive usage
  • [x] Constraints by code in few minute
  • [x] Less code! 🙌

🐒 How to use

1 – Import into your project

import MagicLayout

2 – Extends your ViewController from MagicViewController

class ViewController: MagicViewController

This is optional, you could call swift view.applyMagicConstrains() in your view controller instead

3 – Set constaints to your views

override func viewDidLoad() {
    super.viewDidLoad()
    view.backgroundColor = .favouriteColor
    let myView = UIView()
    myView.pin()
    myView.backgroundColor = .secondFavColor
    view.setPadding(padding: 40)
    view.addSubview(myView)
}

and… voilĂ !

Screenshot iOS)

In few lines you could add a centered custom view in a superview with padding! 😱

💪 Let’s the example code talks…

    let myView = UIView()
    myView.pinLeft()
    myView.pinTop()
    myView.setWidth(width: 200)
    myView.setHeight(height: 50)

A fixed size view pinned to top left corner… Not bad at all, right? 🤠

    topView.matchWidth()
    topView.pinTop()
    topView.matchHeight(withPercentage: 50)
    bottomView.matchWidth()
    bottomView.pinBottom()
    bottomView.matchHeight(withPercentage: 50)

Easy peasy 😎

🧙‍♂️One more challenge to show you the POWER of Magic Layout! 💥

    innerView.pin()
    topView.matchWidth()
    topView.pinTop()
    topView.setPaddings(left: 10, right: 10, top: 30, bottom: 30)
    topView.matchHeight(withPercentage: 50)
    bottomView.matchWidth()
    bottomView.pinBottom()
    bottomView.matchHeight(withPercentage: 50)
    view.addSubview(topView)
    view.addSubview(bottomView)
    topView.addSubview(innerView)

💃 It’s magic!

📋 Supported OS & SDK Versions

  • iOS 9.0+

  • Swift 4

  • xCode 9.2+

  • @Objc full compatibility

🔮 Project Example

This project include an example project using Magic Layout.

📚 Documentation & DevSite

Magic Layout Documentation

❤ Feedback

This is an open source project, so feel free to contribute. How?

  • Fork this project and propose your own fixes, suggestions and open a pull request with the changes.

👨🏻‍💻 Author

Demian Tejo

Latest podspec

{
    "name": "MagicLayout",
    "version": "0.1.0",
    "summary": "Auto layout view based API",
    "swift_version": "4.0",
    "description": "Auto layout view based API.",
    "homepage": "https://github.com/demtej/MagicLayout",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Demian Tejo": "[email protected]"
    },
    "source": {
        "git": "https://github.com/demtej/MagicLayout.git",
        "tag": "0.1.0"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "MagicLayout/Classes/**/**/**"
}

Pin It on Pinterest

Share This