WHC_AutoLayoutKit


Description

WHC_AutoLayoutKit is a powerful and easy-to-use auto layout library for iOS projects. It simplifies the process of creating and managing Auto Layout constraints programmatically, making it more efficient and less error-prone compared to working with NSLayoutConstraint directly.

Features

  • Easy and expressive syntax for creating constraints
  • Supports both UIView and NSLayoutAnchor
  • Automatic constraint activation and deactivation
  • Constraint multiplier and constant customization
  • Programmatic constraint chaining
  • Supports both Objective-C and Swift

Installation

You can install WHC_AutoLayoutKit through Cocoapods. Simply add the following line to your Podfile:

pod 'WHC_AutoLayoutKit'

Usage

To use WHC_AutoLayoutKit in your project, follow these steps:

  1. Import the WHC_AutoLayoutKit module:
  2. import WHC_AutoLayoutKit

  3. Create the necessary constraints using the provided functions and operators:
  4. // Examples:
    // Leading constraint
    viewA.whc_Leading.equalToSuperview().offset(10)
    // Height constraint
    viewB.whc_Height.equal(to: 50).priority(UILayoutPriority(800))

Examples

Here are a few code examples that demonstrate the usage of WHC_AutoLayoutKit:

// Example 1: Centering a view
viewC.whc_CenterX.equalToSuperview()
viewC.whc_CenterY.equalToSuperview()

// Example 2: Constraint chaining
viewD.whc_LeftSpaceEqual(viewC.whc_Right, offset: 10)
viewD.whc_RightSpaceEqual(viewC.whc_Right)
viewD.whc_TopSpaceEqual(viewC.whc_Bottom, offset: 20)

Documentation

For detailed documentation and usage instructions, please refer to the official GitHub repository of WHC_AutoLayoutKit:

https://github.com/netyouli/WHC_AutoLayoutKit

License

WHC_AutoLayoutKit is released under the MIT License. See the LICENSE file for more information.