SnapKit/README.md

156 lines
4.2 KiB
Markdown
Raw Normal View History

Feature/release 5.6 (#746) * Add support for UILayoutPriority as priority target. (#466) * Add support for UILayoutPriority as priority target. * Fixed for tvOS * Add update(priority: ConstraintPriority) method (#467) * Add update(priority: ConstraintPriority) method * Fix copy-paste error * Add Swift Package Manager support (#501) * Swift4.2 (#516) * make ConstraintAttributes conform to ExpressibleByIntegerLiteral (#520) * Adds 'constraint.isActive = bool' to Constraint (#496) * delegate identical 'constraint creation' code to 'prepareConstraints' * adds 'set(isActivated:)' method to call appropriate 'activate/deactivate' based on bool cleans up about 30 lines of if foo { activate } else { deactivate } code in my app * instead of 'set(isActivated:)', use 'isActive = value' * Add swift version to podspec * Update podspec * Update podspec * Update project to get rid of Migration Warning (#547) * Update Swift Language version to 4.2 under build settings (#551) * Update swift language version to 4.2 in build settings * Update podspec * Remove Swift Version file * Remove Package.swift, SnapKit is not SwiftPM compatible anyways * Update Podspec * Update version in Podspec * Support swift 5.0 (#570) * Update swift version 5.0 * Remove needless access control * Fix misused "Available" annotations * Support @unknown default * Support swift 5.0 in test code * Update podspec * Update travis CI * Code review by @freak4pc * Add constraint for Swift version * Fix build failed * [EXC_BAD_ACCESS] Update LayoutConstraint == operator to support iOS 10 and higher changes (#574) * @sashabelonogov Update LayoutConstraint == operator to support iOS 10 and higher changes * Simplify return statement of the LayoutConstraint == operator * Fix incorrect behavior of inset with center and baseline anchors (#569) * Fix insets adjusting center attributes incorrectly * Fix insets adjusting baseline attributes incorrectly * Add back Package.swift for SwiftPM compatibility (#559) reverts 477fffae4c37386285f78511ff4120f1f5324ff8 * Update podspec * Update min target versions * Update min target versions * Update README.md * Update README.md * Revert "[EXC_BAD_ACCESS] Update LayoutConstraint == operator to support iOS 10 and higher changes (#574)" (#593) This reverts commit bc2b0b93320513eb747b3baf6332c05bacc067b4. * Update Podspec * Bump min version requirements * Fix layout constraint comparison * Fix equality check for iOS * Adds support for NSDirectionalEdgeInsets as an inset constant (#594) * Make ConstraintViewDSL content priorities nonmutating (#586) * Adds two new compositions – DirectionalEdges and DirectionalMargins (#595) * WIP * Add directional margins * Whitespace * Add Playground Sample (#608) * added updates to Package.swift so it can be imported with Xcode 11 (#615) * Revert #574 * Update Podspec * Add background color to quick start box in README.md (#619) * add-dimensional-edges: add ConstraintItems horizontalEdges, verticalEdges, directionalHorizontalEdges and directionalVerticalEdges as convenience items to express left+right, top+bottom or leading+trailing (#637) * Update deprecations to allow Xcode to auto-fixup. (#634) * Migrate to Xcode 11 and updated travis.yml (#629) * Migrate to Xcode 11 and updated travis.yml * Travis to support Xcode 11 * project.pbxproj: Update to recommended settings. (#627) * Add test assert to unit test testCanSetLabel. (#625) * Add back support for OS X 10.11 (#645) * Use << for ConstraintAttributes options (#659) * Use << for ConstraintAttributes options * iPhone 6s is not supported by the latest Xcode * Add method getting constraint with closure to ConstraintMakerRelatable (#663) * add ConstraintMakerRelatable extension * fix fatalError message Co-authored-by: Jimi <jimi-hpcnt@hpcnt.com> * Xcode 12 and SwiftPM enhancements * Update README to include SPM installation notes (#673) * Fix typo * Remove duplicate file * xcodeproject configuration enhancement for localization (#584) Co-authored-by: AmrAngry <c_amr.elghadban@smartdubai.ae> * Updates to project files * Dynamic Product (#710) This PR adds a dynamic product to SnapKit. Having a dynamic product is important in modular project structures; multiple packages may be using SnapKit, and this allows that support without the end-user have to wrap SnapKit in their own package that exposes it and using that package in lieu of SnapKit. * Fix warning about `class` (#714) * Added Example-iOS.xcdodeproj and fixed examples (#707) * Update README.md, add missing Migration Guides section (#721) * Make ConstraintMaker.item public (#693) * Typo source directory in Podspec (#738) Source directory has been renamed in 18608ead653bfe1e05e3d1f6fb6d34f62cec49bd * Release 5.6 * Update urls in readme * Update podspec version Co-authored-by: Benjamin Chrobot <benjamin.blair.chrobot@gmail.com> Co-authored-by: Linus Unnebäck <linus@folkdatorn.se> Co-authored-by: Mauro Vime Castillo <mvimeapps@gmail.com> Co-authored-by: o( ̄へ ̄)o <guzhenhuaGitHub@users.noreply.github.com> Co-authored-by: Colin T.A. Gray <colinta@gmail.com> Co-authored-by: Shai Mishali <freak4pc@gmail.com> Co-authored-by: Ibrahim Koteish <ikteish@yahoo.com> Co-authored-by: Jungwon An <kawoou@kawoou.kr> Co-authored-by: Alexander Belonogov <sashabelonogov@gmail.com> Co-authored-by: Christian Schnorr <christian.schnorr@me.com> Co-authored-by: Josh Converse <josh.converse@gmail.com> Co-authored-by: Vitalii Budnik <nekrich@users.noreply.github.com> Co-authored-by: Shiva Huang <shiva.tw@gmail.com> Co-authored-by: Max Cobb <5754073+maxxfrazer@users.noreply.github.com> Co-authored-by: Liam Elmore <32336260+iosmo@users.noreply.github.com> Co-authored-by: Sven Driemecker <sven.dr@gmx.de> Co-authored-by: Alex Simpson <alexandersimpson94@gmail.com> Co-authored-by: pushp1989 <54930194+pushp1989@users.noreply.github.com> Co-authored-by: Ben Yohay <ben@lightricks.com> Co-authored-by: Natascha Fadeeva <nataschafadeeva@aol.de> Co-authored-by: Wang, Chi <patr0nus@users.noreply.github.com> Co-authored-by: Roman Podymov <podymfrombryansk@yandex.ru> Co-authored-by: wotjd <wotjd971102@gmail.com> Co-authored-by: Jimi <jimi-hpcnt@hpcnt.com> Co-authored-by: Samuel Eshun <samueleshun15@gmail.com> Co-authored-by: Amr Elghadban <amr.elghadban@gmail.com> Co-authored-by: AmrAngry <c_amr.elghadban@smartdubai.ae> Co-authored-by: Hesham Salman <iron-ham@github.com> Co-authored-by: Mr. Ming <minglq.9@gmail.com> Co-authored-by: Teameh <tiemevanveen@hotmail.com> Co-authored-by: Josip Rezić <josip.rezic@hotmail.com> Co-authored-by: Rhett Tuan <devindwan@gmail.com> Co-authored-by: Damien Debin <ddebin@users.noreply.github.com> Co-authored-by: Robert Payne <robertjpayne@Roberts-MacBook-Pro.local>
2022-04-13 12:06:06 +08:00
<img src="https://snapkit.github.io/SnapKit/images/banner.jpg" alt="" />
2015-04-12 18:36:02 +08:00
2015-04-16 20:47:03 +08:00
SnapKit is a DSL to make Auto Layout easy on both iOS and OS X.
2014-07-29 08:39:59 +08:00
2015-04-15 19:07:50 +08:00
[![Build Status](https://travis-ci.org/SnapKit/SnapKit.svg)](https://travis-ci.org/SnapKit/SnapKit)
2016-09-14 17:29:01 +08:00
[![Platform](https://img.shields.io/cocoapods/p/SnapKit.svg?style=flat)](https://github.com/SnapKit/SnapKit)
[![Cocoapods Compatible](https://img.shields.io/cocoapods/v/SnapKit.svg)](https://cocoapods.org/pods/SnapKit)
2015-05-28 10:08:18 +08:00
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)
2015-03-24 06:45:35 +08:00
Feature/release 5.6 (#746) * Add support for UILayoutPriority as priority target. (#466) * Add support for UILayoutPriority as priority target. * Fixed for tvOS * Add update(priority: ConstraintPriority) method (#467) * Add update(priority: ConstraintPriority) method * Fix copy-paste error * Add Swift Package Manager support (#501) * Swift4.2 (#516) * make ConstraintAttributes conform to ExpressibleByIntegerLiteral (#520) * Adds 'constraint.isActive = bool' to Constraint (#496) * delegate identical 'constraint creation' code to 'prepareConstraints' * adds 'set(isActivated:)' method to call appropriate 'activate/deactivate' based on bool cleans up about 30 lines of if foo { activate } else { deactivate } code in my app * instead of 'set(isActivated:)', use 'isActive = value' * Add swift version to podspec * Update podspec * Update podspec * Update project to get rid of Migration Warning (#547) * Update Swift Language version to 4.2 under build settings (#551) * Update swift language version to 4.2 in build settings * Update podspec * Remove Swift Version file * Remove Package.swift, SnapKit is not SwiftPM compatible anyways * Update Podspec * Update version in Podspec * Support swift 5.0 (#570) * Update swift version 5.0 * Remove needless access control * Fix misused "Available" annotations * Support @unknown default * Support swift 5.0 in test code * Update podspec * Update travis CI * Code review by @freak4pc * Add constraint for Swift version * Fix build failed * [EXC_BAD_ACCESS] Update LayoutConstraint == operator to support iOS 10 and higher changes (#574) * @sashabelonogov Update LayoutConstraint == operator to support iOS 10 and higher changes * Simplify return statement of the LayoutConstraint == operator * Fix incorrect behavior of inset with center and baseline anchors (#569) * Fix insets adjusting center attributes incorrectly * Fix insets adjusting baseline attributes incorrectly * Add back Package.swift for SwiftPM compatibility (#559) reverts 477fffae4c37386285f78511ff4120f1f5324ff8 * Update podspec * Update min target versions * Update min target versions * Update README.md * Update README.md * Revert "[EXC_BAD_ACCESS] Update LayoutConstraint == operator to support iOS 10 and higher changes (#574)" (#593) This reverts commit bc2b0b93320513eb747b3baf6332c05bacc067b4. * Update Podspec * Bump min version requirements * Fix layout constraint comparison * Fix equality check for iOS * Adds support for NSDirectionalEdgeInsets as an inset constant (#594) * Make ConstraintViewDSL content priorities nonmutating (#586) * Adds two new compositions – DirectionalEdges and DirectionalMargins (#595) * WIP * Add directional margins * Whitespace * Add Playground Sample (#608) * added updates to Package.swift so it can be imported with Xcode 11 (#615) * Revert #574 * Update Podspec * Add background color to quick start box in README.md (#619) * add-dimensional-edges: add ConstraintItems horizontalEdges, verticalEdges, directionalHorizontalEdges and directionalVerticalEdges as convenience items to express left+right, top+bottom or leading+trailing (#637) * Update deprecations to allow Xcode to auto-fixup. (#634) * Migrate to Xcode 11 and updated travis.yml (#629) * Migrate to Xcode 11 and updated travis.yml * Travis to support Xcode 11 * project.pbxproj: Update to recommended settings. (#627) * Add test assert to unit test testCanSetLabel. (#625) * Add back support for OS X 10.11 (#645) * Use << for ConstraintAttributes options (#659) * Use << for ConstraintAttributes options * iPhone 6s is not supported by the latest Xcode * Add method getting constraint with closure to ConstraintMakerRelatable (#663) * add ConstraintMakerRelatable extension * fix fatalError message Co-authored-by: Jimi <jimi-hpcnt@hpcnt.com> * Xcode 12 and SwiftPM enhancements * Update README to include SPM installation notes (#673) * Fix typo * Remove duplicate file * xcodeproject configuration enhancement for localization (#584) Co-authored-by: AmrAngry <c_amr.elghadban@smartdubai.ae> * Updates to project files * Dynamic Product (#710) This PR adds a dynamic product to SnapKit. Having a dynamic product is important in modular project structures; multiple packages may be using SnapKit, and this allows that support without the end-user have to wrap SnapKit in their own package that exposes it and using that package in lieu of SnapKit. * Fix warning about `class` (#714) * Added Example-iOS.xcdodeproj and fixed examples (#707) * Update README.md, add missing Migration Guides section (#721) * Make ConstraintMaker.item public (#693) * Typo source directory in Podspec (#738) Source directory has been renamed in 18608ead653bfe1e05e3d1f6fb6d34f62cec49bd * Release 5.6 * Update urls in readme * Update podspec version Co-authored-by: Benjamin Chrobot <benjamin.blair.chrobot@gmail.com> Co-authored-by: Linus Unnebäck <linus@folkdatorn.se> Co-authored-by: Mauro Vime Castillo <mvimeapps@gmail.com> Co-authored-by: o( ̄へ ̄)o <guzhenhuaGitHub@users.noreply.github.com> Co-authored-by: Colin T.A. Gray <colinta@gmail.com> Co-authored-by: Shai Mishali <freak4pc@gmail.com> Co-authored-by: Ibrahim Koteish <ikteish@yahoo.com> Co-authored-by: Jungwon An <kawoou@kawoou.kr> Co-authored-by: Alexander Belonogov <sashabelonogov@gmail.com> Co-authored-by: Christian Schnorr <christian.schnorr@me.com> Co-authored-by: Josh Converse <josh.converse@gmail.com> Co-authored-by: Vitalii Budnik <nekrich@users.noreply.github.com> Co-authored-by: Shiva Huang <shiva.tw@gmail.com> Co-authored-by: Max Cobb <5754073+maxxfrazer@users.noreply.github.com> Co-authored-by: Liam Elmore <32336260+iosmo@users.noreply.github.com> Co-authored-by: Sven Driemecker <sven.dr@gmx.de> Co-authored-by: Alex Simpson <alexandersimpson94@gmail.com> Co-authored-by: pushp1989 <54930194+pushp1989@users.noreply.github.com> Co-authored-by: Ben Yohay <ben@lightricks.com> Co-authored-by: Natascha Fadeeva <nataschafadeeva@aol.de> Co-authored-by: Wang, Chi <patr0nus@users.noreply.github.com> Co-authored-by: Roman Podymov <podymfrombryansk@yandex.ru> Co-authored-by: wotjd <wotjd971102@gmail.com> Co-authored-by: Jimi <jimi-hpcnt@hpcnt.com> Co-authored-by: Samuel Eshun <samueleshun15@gmail.com> Co-authored-by: Amr Elghadban <amr.elghadban@gmail.com> Co-authored-by: AmrAngry <c_amr.elghadban@smartdubai.ae> Co-authored-by: Hesham Salman <iron-ham@github.com> Co-authored-by: Mr. Ming <minglq.9@gmail.com> Co-authored-by: Teameh <tiemevanveen@hotmail.com> Co-authored-by: Josip Rezić <josip.rezic@hotmail.com> Co-authored-by: Rhett Tuan <devindwan@gmail.com> Co-authored-by: Damien Debin <ddebin@users.noreply.github.com> Co-authored-by: Robert Payne <robertjpayne@Roberts-MacBook-Pro.local>
2022-04-13 12:06:06 +08:00
#### ⚠️ **To use with Swift 4.x please ensure you are using >= 4.0.0** ⚠️
#### ⚠️ **To use with Swift 5.x please ensure you are using >= 5.0.0** ⚠️
2016-09-19 11:50:06 +08:00
2016-09-19 11:52:46 +08:00
## Contents
2016-09-19 11:50:06 +08:00
2016-09-14 17:29:01 +08:00
- [Requirements](#requirements)
- [Migration Guides](#migration-guides)
- [Communication](#communication)
- [Installation](#installation)
- [Usage](#usage)
- [Credits](#credits)
- [License](#license)
## Requirements
- iOS 12.0+ / Mac OS X 10.13+ / tvOS 10.0+
Feature/release 5.6 (#746) * Add support for UILayoutPriority as priority target. (#466) * Add support for UILayoutPriority as priority target. * Fixed for tvOS * Add update(priority: ConstraintPriority) method (#467) * Add update(priority: ConstraintPriority) method * Fix copy-paste error * Add Swift Package Manager support (#501) * Swift4.2 (#516) * make ConstraintAttributes conform to ExpressibleByIntegerLiteral (#520) * Adds 'constraint.isActive = bool' to Constraint (#496) * delegate identical 'constraint creation' code to 'prepareConstraints' * adds 'set(isActivated:)' method to call appropriate 'activate/deactivate' based on bool cleans up about 30 lines of if foo { activate } else { deactivate } code in my app * instead of 'set(isActivated:)', use 'isActive = value' * Add swift version to podspec * Update podspec * Update podspec * Update project to get rid of Migration Warning (#547) * Update Swift Language version to 4.2 under build settings (#551) * Update swift language version to 4.2 in build settings * Update podspec * Remove Swift Version file * Remove Package.swift, SnapKit is not SwiftPM compatible anyways * Update Podspec * Update version in Podspec * Support swift 5.0 (#570) * Update swift version 5.0 * Remove needless access control * Fix misused "Available" annotations * Support @unknown default * Support swift 5.0 in test code * Update podspec * Update travis CI * Code review by @freak4pc * Add constraint for Swift version * Fix build failed * [EXC_BAD_ACCESS] Update LayoutConstraint == operator to support iOS 10 and higher changes (#574) * @sashabelonogov Update LayoutConstraint == operator to support iOS 10 and higher changes * Simplify return statement of the LayoutConstraint == operator * Fix incorrect behavior of inset with center and baseline anchors (#569) * Fix insets adjusting center attributes incorrectly * Fix insets adjusting baseline attributes incorrectly * Add back Package.swift for SwiftPM compatibility (#559) reverts 477fffae4c37386285f78511ff4120f1f5324ff8 * Update podspec * Update min target versions * Update min target versions * Update README.md * Update README.md * Revert "[EXC_BAD_ACCESS] Update LayoutConstraint == operator to support iOS 10 and higher changes (#574)" (#593) This reverts commit bc2b0b93320513eb747b3baf6332c05bacc067b4. * Update Podspec * Bump min version requirements * Fix layout constraint comparison * Fix equality check for iOS * Adds support for NSDirectionalEdgeInsets as an inset constant (#594) * Make ConstraintViewDSL content priorities nonmutating (#586) * Adds two new compositions – DirectionalEdges and DirectionalMargins (#595) * WIP * Add directional margins * Whitespace * Add Playground Sample (#608) * added updates to Package.swift so it can be imported with Xcode 11 (#615) * Revert #574 * Update Podspec * Add background color to quick start box in README.md (#619) * add-dimensional-edges: add ConstraintItems horizontalEdges, verticalEdges, directionalHorizontalEdges and directionalVerticalEdges as convenience items to express left+right, top+bottom or leading+trailing (#637) * Update deprecations to allow Xcode to auto-fixup. (#634) * Migrate to Xcode 11 and updated travis.yml (#629) * Migrate to Xcode 11 and updated travis.yml * Travis to support Xcode 11 * project.pbxproj: Update to recommended settings. (#627) * Add test assert to unit test testCanSetLabel. (#625) * Add back support for OS X 10.11 (#645) * Use << for ConstraintAttributes options (#659) * Use << for ConstraintAttributes options * iPhone 6s is not supported by the latest Xcode * Add method getting constraint with closure to ConstraintMakerRelatable (#663) * add ConstraintMakerRelatable extension * fix fatalError message Co-authored-by: Jimi <jimi-hpcnt@hpcnt.com> * Xcode 12 and SwiftPM enhancements * Update README to include SPM installation notes (#673) * Fix typo * Remove duplicate file * xcodeproject configuration enhancement for localization (#584) Co-authored-by: AmrAngry <c_amr.elghadban@smartdubai.ae> * Updates to project files * Dynamic Product (#710) This PR adds a dynamic product to SnapKit. Having a dynamic product is important in modular project structures; multiple packages may be using SnapKit, and this allows that support without the end-user have to wrap SnapKit in their own package that exposes it and using that package in lieu of SnapKit. * Fix warning about `class` (#714) * Added Example-iOS.xcdodeproj and fixed examples (#707) * Update README.md, add missing Migration Guides section (#721) * Make ConstraintMaker.item public (#693) * Typo source directory in Podspec (#738) Source directory has been renamed in 18608ead653bfe1e05e3d1f6fb6d34f62cec49bd * Release 5.6 * Update urls in readme * Update podspec version Co-authored-by: Benjamin Chrobot <benjamin.blair.chrobot@gmail.com> Co-authored-by: Linus Unnebäck <linus@folkdatorn.se> Co-authored-by: Mauro Vime Castillo <mvimeapps@gmail.com> Co-authored-by: o( ̄へ ̄)o <guzhenhuaGitHub@users.noreply.github.com> Co-authored-by: Colin T.A. Gray <colinta@gmail.com> Co-authored-by: Shai Mishali <freak4pc@gmail.com> Co-authored-by: Ibrahim Koteish <ikteish@yahoo.com> Co-authored-by: Jungwon An <kawoou@kawoou.kr> Co-authored-by: Alexander Belonogov <sashabelonogov@gmail.com> Co-authored-by: Christian Schnorr <christian.schnorr@me.com> Co-authored-by: Josh Converse <josh.converse@gmail.com> Co-authored-by: Vitalii Budnik <nekrich@users.noreply.github.com> Co-authored-by: Shiva Huang <shiva.tw@gmail.com> Co-authored-by: Max Cobb <5754073+maxxfrazer@users.noreply.github.com> Co-authored-by: Liam Elmore <32336260+iosmo@users.noreply.github.com> Co-authored-by: Sven Driemecker <sven.dr@gmx.de> Co-authored-by: Alex Simpson <alexandersimpson94@gmail.com> Co-authored-by: pushp1989 <54930194+pushp1989@users.noreply.github.com> Co-authored-by: Ben Yohay <ben@lightricks.com> Co-authored-by: Natascha Fadeeva <nataschafadeeva@aol.de> Co-authored-by: Wang, Chi <patr0nus@users.noreply.github.com> Co-authored-by: Roman Podymov <podymfrombryansk@yandex.ru> Co-authored-by: wotjd <wotjd971102@gmail.com> Co-authored-by: Jimi <jimi-hpcnt@hpcnt.com> Co-authored-by: Samuel Eshun <samueleshun15@gmail.com> Co-authored-by: Amr Elghadban <amr.elghadban@gmail.com> Co-authored-by: AmrAngry <c_amr.elghadban@smartdubai.ae> Co-authored-by: Hesham Salman <iron-ham@github.com> Co-authored-by: Mr. Ming <minglq.9@gmail.com> Co-authored-by: Teameh <tiemevanveen@hotmail.com> Co-authored-by: Josip Rezić <josip.rezic@hotmail.com> Co-authored-by: Rhett Tuan <devindwan@gmail.com> Co-authored-by: Damien Debin <ddebin@users.noreply.github.com> Co-authored-by: Robert Payne <robertjpayne@Roberts-MacBook-Pro.local>
2022-04-13 12:06:06 +08:00
- Xcode 10.0+
- Swift 4.0+
## Migration Guides
- [SnapKit 3.0 Migration Guide](Documentation/SnapKit%203.0%20Migration%20Guide.md)
2016-09-14 17:29:01 +08:00
## Communication
- If you **need help**, use [Stack Overflow](http://stackoverflow.com/questions/tagged/snapkit). (Tag 'snapkit')
- If you'd like to **ask a general question**, use [Stack Overflow](http://stackoverflow.com/questions/tagged/snapkit).
- If you **found a bug**, open an issue.
- If you **have a feature request**, open an issue.
- If you **want to contribute**, submit a pull request.
## Installation
### CocoaPods
[CocoaPods](http://cocoapods.org) is a dependency manager for Cocoa projects. You can install it with the following command:
```bash
$ gem install cocoapods
```
2017-09-17 10:21:22 +08:00
> CocoaPods 1.1.0+ is required to build SnapKit 4.0.0+.
2016-09-14 17:29:01 +08:00
To integrate SnapKit into your Xcode project using CocoaPods, specify it in your `Podfile`:
```ruby
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '10.0'
use_frameworks!
target '<Your Target Name>' do
pod 'SnapKit', '~> 5.7.0'
2016-09-14 17:29:01 +08:00
end
```
Then, run the following command:
```bash
$ pod install
```
### Carthage
[Carthage](https://github.com/Carthage/Carthage) is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.
You can install Carthage with [Homebrew](http://brew.sh/) using the following command:
```bash
$ brew update
$ brew install carthage
```
To integrate SnapKit into your Xcode project using Carthage, specify it in your `Cartfile`:
```ogdl
Feature/release 5.6 (#746) * Add support for UILayoutPriority as priority target. (#466) * Add support for UILayoutPriority as priority target. * Fixed for tvOS * Add update(priority: ConstraintPriority) method (#467) * Add update(priority: ConstraintPriority) method * Fix copy-paste error * Add Swift Package Manager support (#501) * Swift4.2 (#516) * make ConstraintAttributes conform to ExpressibleByIntegerLiteral (#520) * Adds 'constraint.isActive = bool' to Constraint (#496) * delegate identical 'constraint creation' code to 'prepareConstraints' * adds 'set(isActivated:)' method to call appropriate 'activate/deactivate' based on bool cleans up about 30 lines of if foo { activate } else { deactivate } code in my app * instead of 'set(isActivated:)', use 'isActive = value' * Add swift version to podspec * Update podspec * Update podspec * Update project to get rid of Migration Warning (#547) * Update Swift Language version to 4.2 under build settings (#551) * Update swift language version to 4.2 in build settings * Update podspec * Remove Swift Version file * Remove Package.swift, SnapKit is not SwiftPM compatible anyways * Update Podspec * Update version in Podspec * Support swift 5.0 (#570) * Update swift version 5.0 * Remove needless access control * Fix misused "Available" annotations * Support @unknown default * Support swift 5.0 in test code * Update podspec * Update travis CI * Code review by @freak4pc * Add constraint for Swift version * Fix build failed * [EXC_BAD_ACCESS] Update LayoutConstraint == operator to support iOS 10 and higher changes (#574) * @sashabelonogov Update LayoutConstraint == operator to support iOS 10 and higher changes * Simplify return statement of the LayoutConstraint == operator * Fix incorrect behavior of inset with center and baseline anchors (#569) * Fix insets adjusting center attributes incorrectly * Fix insets adjusting baseline attributes incorrectly * Add back Package.swift for SwiftPM compatibility (#559) reverts 477fffae4c37386285f78511ff4120f1f5324ff8 * Update podspec * Update min target versions * Update min target versions * Update README.md * Update README.md * Revert "[EXC_BAD_ACCESS] Update LayoutConstraint == operator to support iOS 10 and higher changes (#574)" (#593) This reverts commit bc2b0b93320513eb747b3baf6332c05bacc067b4. * Update Podspec * Bump min version requirements * Fix layout constraint comparison * Fix equality check for iOS * Adds support for NSDirectionalEdgeInsets as an inset constant (#594) * Make ConstraintViewDSL content priorities nonmutating (#586) * Adds two new compositions – DirectionalEdges and DirectionalMargins (#595) * WIP * Add directional margins * Whitespace * Add Playground Sample (#608) * added updates to Package.swift so it can be imported with Xcode 11 (#615) * Revert #574 * Update Podspec * Add background color to quick start box in README.md (#619) * add-dimensional-edges: add ConstraintItems horizontalEdges, verticalEdges, directionalHorizontalEdges and directionalVerticalEdges as convenience items to express left+right, top+bottom or leading+trailing (#637) * Update deprecations to allow Xcode to auto-fixup. (#634) * Migrate to Xcode 11 and updated travis.yml (#629) * Migrate to Xcode 11 and updated travis.yml * Travis to support Xcode 11 * project.pbxproj: Update to recommended settings. (#627) * Add test assert to unit test testCanSetLabel. (#625) * Add back support for OS X 10.11 (#645) * Use << for ConstraintAttributes options (#659) * Use << for ConstraintAttributes options * iPhone 6s is not supported by the latest Xcode * Add method getting constraint with closure to ConstraintMakerRelatable (#663) * add ConstraintMakerRelatable extension * fix fatalError message Co-authored-by: Jimi <jimi-hpcnt@hpcnt.com> * Xcode 12 and SwiftPM enhancements * Update README to include SPM installation notes (#673) * Fix typo * Remove duplicate file * xcodeproject configuration enhancement for localization (#584) Co-authored-by: AmrAngry <c_amr.elghadban@smartdubai.ae> * Updates to project files * Dynamic Product (#710) This PR adds a dynamic product to SnapKit. Having a dynamic product is important in modular project structures; multiple packages may be using SnapKit, and this allows that support without the end-user have to wrap SnapKit in their own package that exposes it and using that package in lieu of SnapKit. * Fix warning about `class` (#714) * Added Example-iOS.xcdodeproj and fixed examples (#707) * Update README.md, add missing Migration Guides section (#721) * Make ConstraintMaker.item public (#693) * Typo source directory in Podspec (#738) Source directory has been renamed in 18608ead653bfe1e05e3d1f6fb6d34f62cec49bd * Release 5.6 * Update urls in readme * Update podspec version Co-authored-by: Benjamin Chrobot <benjamin.blair.chrobot@gmail.com> Co-authored-by: Linus Unnebäck <linus@folkdatorn.se> Co-authored-by: Mauro Vime Castillo <mvimeapps@gmail.com> Co-authored-by: o( ̄へ ̄)o <guzhenhuaGitHub@users.noreply.github.com> Co-authored-by: Colin T.A. Gray <colinta@gmail.com> Co-authored-by: Shai Mishali <freak4pc@gmail.com> Co-authored-by: Ibrahim Koteish <ikteish@yahoo.com> Co-authored-by: Jungwon An <kawoou@kawoou.kr> Co-authored-by: Alexander Belonogov <sashabelonogov@gmail.com> Co-authored-by: Christian Schnorr <christian.schnorr@me.com> Co-authored-by: Josh Converse <josh.converse@gmail.com> Co-authored-by: Vitalii Budnik <nekrich@users.noreply.github.com> Co-authored-by: Shiva Huang <shiva.tw@gmail.com> Co-authored-by: Max Cobb <5754073+maxxfrazer@users.noreply.github.com> Co-authored-by: Liam Elmore <32336260+iosmo@users.noreply.github.com> Co-authored-by: Sven Driemecker <sven.dr@gmx.de> Co-authored-by: Alex Simpson <alexandersimpson94@gmail.com> Co-authored-by: pushp1989 <54930194+pushp1989@users.noreply.github.com> Co-authored-by: Ben Yohay <ben@lightricks.com> Co-authored-by: Natascha Fadeeva <nataschafadeeva@aol.de> Co-authored-by: Wang, Chi <patr0nus@users.noreply.github.com> Co-authored-by: Roman Podymov <podymfrombryansk@yandex.ru> Co-authored-by: wotjd <wotjd971102@gmail.com> Co-authored-by: Jimi <jimi-hpcnt@hpcnt.com> Co-authored-by: Samuel Eshun <samueleshun15@gmail.com> Co-authored-by: Amr Elghadban <amr.elghadban@gmail.com> Co-authored-by: AmrAngry <c_amr.elghadban@smartdubai.ae> Co-authored-by: Hesham Salman <iron-ham@github.com> Co-authored-by: Mr. Ming <minglq.9@gmail.com> Co-authored-by: Teameh <tiemevanveen@hotmail.com> Co-authored-by: Josip Rezić <josip.rezic@hotmail.com> Co-authored-by: Rhett Tuan <devindwan@gmail.com> Co-authored-by: Damien Debin <ddebin@users.noreply.github.com> Co-authored-by: Robert Payne <robertjpayne@Roberts-MacBook-Pro.local>
2022-04-13 12:06:06 +08:00
github "SnapKit/SnapKit" ~> 5.0.0
2016-09-14 17:29:01 +08:00
```
Run `carthage update` to build the framework and drag the built `SnapKit.framework` into your Xcode project.
Feature/release 5.6 (#746) * Add support for UILayoutPriority as priority target. (#466) * Add support for UILayoutPriority as priority target. * Fixed for tvOS * Add update(priority: ConstraintPriority) method (#467) * Add update(priority: ConstraintPriority) method * Fix copy-paste error * Add Swift Package Manager support (#501) * Swift4.2 (#516) * make ConstraintAttributes conform to ExpressibleByIntegerLiteral (#520) * Adds 'constraint.isActive = bool' to Constraint (#496) * delegate identical 'constraint creation' code to 'prepareConstraints' * adds 'set(isActivated:)' method to call appropriate 'activate/deactivate' based on bool cleans up about 30 lines of if foo { activate } else { deactivate } code in my app * instead of 'set(isActivated:)', use 'isActive = value' * Add swift version to podspec * Update podspec * Update podspec * Update project to get rid of Migration Warning (#547) * Update Swift Language version to 4.2 under build settings (#551) * Update swift language version to 4.2 in build settings * Update podspec * Remove Swift Version file * Remove Package.swift, SnapKit is not SwiftPM compatible anyways * Update Podspec * Update version in Podspec * Support swift 5.0 (#570) * Update swift version 5.0 * Remove needless access control * Fix misused "Available" annotations * Support @unknown default * Support swift 5.0 in test code * Update podspec * Update travis CI * Code review by @freak4pc * Add constraint for Swift version * Fix build failed * [EXC_BAD_ACCESS] Update LayoutConstraint == operator to support iOS 10 and higher changes (#574) * @sashabelonogov Update LayoutConstraint == operator to support iOS 10 and higher changes * Simplify return statement of the LayoutConstraint == operator * Fix incorrect behavior of inset with center and baseline anchors (#569) * Fix insets adjusting center attributes incorrectly * Fix insets adjusting baseline attributes incorrectly * Add back Package.swift for SwiftPM compatibility (#559) reverts 477fffae4c37386285f78511ff4120f1f5324ff8 * Update podspec * Update min target versions * Update min target versions * Update README.md * Update README.md * Revert "[EXC_BAD_ACCESS] Update LayoutConstraint == operator to support iOS 10 and higher changes (#574)" (#593) This reverts commit bc2b0b93320513eb747b3baf6332c05bacc067b4. * Update Podspec * Bump min version requirements * Fix layout constraint comparison * Fix equality check for iOS * Adds support for NSDirectionalEdgeInsets as an inset constant (#594) * Make ConstraintViewDSL content priorities nonmutating (#586) * Adds two new compositions – DirectionalEdges and DirectionalMargins (#595) * WIP * Add directional margins * Whitespace * Add Playground Sample (#608) * added updates to Package.swift so it can be imported with Xcode 11 (#615) * Revert #574 * Update Podspec * Add background color to quick start box in README.md (#619) * add-dimensional-edges: add ConstraintItems horizontalEdges, verticalEdges, directionalHorizontalEdges and directionalVerticalEdges as convenience items to express left+right, top+bottom or leading+trailing (#637) * Update deprecations to allow Xcode to auto-fixup. (#634) * Migrate to Xcode 11 and updated travis.yml (#629) * Migrate to Xcode 11 and updated travis.yml * Travis to support Xcode 11 * project.pbxproj: Update to recommended settings. (#627) * Add test assert to unit test testCanSetLabel. (#625) * Add back support for OS X 10.11 (#645) * Use << for ConstraintAttributes options (#659) * Use << for ConstraintAttributes options * iPhone 6s is not supported by the latest Xcode * Add method getting constraint with closure to ConstraintMakerRelatable (#663) * add ConstraintMakerRelatable extension * fix fatalError message Co-authored-by: Jimi <jimi-hpcnt@hpcnt.com> * Xcode 12 and SwiftPM enhancements * Update README to include SPM installation notes (#673) * Fix typo * Remove duplicate file * xcodeproject configuration enhancement for localization (#584) Co-authored-by: AmrAngry <c_amr.elghadban@smartdubai.ae> * Updates to project files * Dynamic Product (#710) This PR adds a dynamic product to SnapKit. Having a dynamic product is important in modular project structures; multiple packages may be using SnapKit, and this allows that support without the end-user have to wrap SnapKit in their own package that exposes it and using that package in lieu of SnapKit. * Fix warning about `class` (#714) * Added Example-iOS.xcdodeproj and fixed examples (#707) * Update README.md, add missing Migration Guides section (#721) * Make ConstraintMaker.item public (#693) * Typo source directory in Podspec (#738) Source directory has been renamed in 18608ead653bfe1e05e3d1f6fb6d34f62cec49bd * Release 5.6 * Update urls in readme * Update podspec version Co-authored-by: Benjamin Chrobot <benjamin.blair.chrobot@gmail.com> Co-authored-by: Linus Unnebäck <linus@folkdatorn.se> Co-authored-by: Mauro Vime Castillo <mvimeapps@gmail.com> Co-authored-by: o( ̄へ ̄)o <guzhenhuaGitHub@users.noreply.github.com> Co-authored-by: Colin T.A. Gray <colinta@gmail.com> Co-authored-by: Shai Mishali <freak4pc@gmail.com> Co-authored-by: Ibrahim Koteish <ikteish@yahoo.com> Co-authored-by: Jungwon An <kawoou@kawoou.kr> Co-authored-by: Alexander Belonogov <sashabelonogov@gmail.com> Co-authored-by: Christian Schnorr <christian.schnorr@me.com> Co-authored-by: Josh Converse <josh.converse@gmail.com> Co-authored-by: Vitalii Budnik <nekrich@users.noreply.github.com> Co-authored-by: Shiva Huang <shiva.tw@gmail.com> Co-authored-by: Max Cobb <5754073+maxxfrazer@users.noreply.github.com> Co-authored-by: Liam Elmore <32336260+iosmo@users.noreply.github.com> Co-authored-by: Sven Driemecker <sven.dr@gmx.de> Co-authored-by: Alex Simpson <alexandersimpson94@gmail.com> Co-authored-by: pushp1989 <54930194+pushp1989@users.noreply.github.com> Co-authored-by: Ben Yohay <ben@lightricks.com> Co-authored-by: Natascha Fadeeva <nataschafadeeva@aol.de> Co-authored-by: Wang, Chi <patr0nus@users.noreply.github.com> Co-authored-by: Roman Podymov <podymfrombryansk@yandex.ru> Co-authored-by: wotjd <wotjd971102@gmail.com> Co-authored-by: Jimi <jimi-hpcnt@hpcnt.com> Co-authored-by: Samuel Eshun <samueleshun15@gmail.com> Co-authored-by: Amr Elghadban <amr.elghadban@gmail.com> Co-authored-by: AmrAngry <c_amr.elghadban@smartdubai.ae> Co-authored-by: Hesham Salman <iron-ham@github.com> Co-authored-by: Mr. Ming <minglq.9@gmail.com> Co-authored-by: Teameh <tiemevanveen@hotmail.com> Co-authored-by: Josip Rezić <josip.rezic@hotmail.com> Co-authored-by: Rhett Tuan <devindwan@gmail.com> Co-authored-by: Damien Debin <ddebin@users.noreply.github.com> Co-authored-by: Robert Payne <robertjpayne@Roberts-MacBook-Pro.local>
2022-04-13 12:06:06 +08:00
### Swift Package Manager
[Swift Package Manager](https://swift.org/package-manager/) is a tool for managing the distribution of Swift code. Its integrated with the Swift build system to automate the process of downloading, compiling, and linking dependencies.
> Xcode 11+ is required to build SnapKit using Swift Package Manager.
To integrate SnapKit into your Xcode project using Swift Package Manager, add it to the dependencies value of your `Package.swift`:
```swift
dependencies: [
.package(url: "https://github.com/SnapKit/SnapKit.git", .upToNextMajor(from: "5.0.1"))
]
```
2016-09-14 17:29:01 +08:00
### Manually
If you prefer not to use either of the aforementioned dependency managers, you can integrate SnapKit into your project manually.
---
## Usage
### Quick Start
2014-07-29 08:39:59 +08:00
```swift
2015-04-16 20:47:03 +08:00
import SnapKit
2014-07-29 08:39:59 +08:00
2015-04-16 20:47:03 +08:00
class MyViewController: UIViewController {
2014-07-29 08:39:59 +08:00
2015-04-16 20:47:03 +08:00
lazy var box = UIView()
2016-01-26 20:12:32 +08:00
2015-04-16 20:47:03 +08:00
override func viewDidLoad() {
super.viewDidLoad()
2016-01-26 20:12:32 +08:00
2015-04-16 20:47:03 +08:00
self.view.addSubview(box)
Feature/release 5.6 (#746) * Add support for UILayoutPriority as priority target. (#466) * Add support for UILayoutPriority as priority target. * Fixed for tvOS * Add update(priority: ConstraintPriority) method (#467) * Add update(priority: ConstraintPriority) method * Fix copy-paste error * Add Swift Package Manager support (#501) * Swift4.2 (#516) * make ConstraintAttributes conform to ExpressibleByIntegerLiteral (#520) * Adds 'constraint.isActive = bool' to Constraint (#496) * delegate identical 'constraint creation' code to 'prepareConstraints' * adds 'set(isActivated:)' method to call appropriate 'activate/deactivate' based on bool cleans up about 30 lines of if foo { activate } else { deactivate } code in my app * instead of 'set(isActivated:)', use 'isActive = value' * Add swift version to podspec * Update podspec * Update podspec * Update project to get rid of Migration Warning (#547) * Update Swift Language version to 4.2 under build settings (#551) * Update swift language version to 4.2 in build settings * Update podspec * Remove Swift Version file * Remove Package.swift, SnapKit is not SwiftPM compatible anyways * Update Podspec * Update version in Podspec * Support swift 5.0 (#570) * Update swift version 5.0 * Remove needless access control * Fix misused "Available" annotations * Support @unknown default * Support swift 5.0 in test code * Update podspec * Update travis CI * Code review by @freak4pc * Add constraint for Swift version * Fix build failed * [EXC_BAD_ACCESS] Update LayoutConstraint == operator to support iOS 10 and higher changes (#574) * @sashabelonogov Update LayoutConstraint == operator to support iOS 10 and higher changes * Simplify return statement of the LayoutConstraint == operator * Fix incorrect behavior of inset with center and baseline anchors (#569) * Fix insets adjusting center attributes incorrectly * Fix insets adjusting baseline attributes incorrectly * Add back Package.swift for SwiftPM compatibility (#559) reverts 477fffae4c37386285f78511ff4120f1f5324ff8 * Update podspec * Update min target versions * Update min target versions * Update README.md * Update README.md * Revert "[EXC_BAD_ACCESS] Update LayoutConstraint == operator to support iOS 10 and higher changes (#574)" (#593) This reverts commit bc2b0b93320513eb747b3baf6332c05bacc067b4. * Update Podspec * Bump min version requirements * Fix layout constraint comparison * Fix equality check for iOS * Adds support for NSDirectionalEdgeInsets as an inset constant (#594) * Make ConstraintViewDSL content priorities nonmutating (#586) * Adds two new compositions – DirectionalEdges and DirectionalMargins (#595) * WIP * Add directional margins * Whitespace * Add Playground Sample (#608) * added updates to Package.swift so it can be imported with Xcode 11 (#615) * Revert #574 * Update Podspec * Add background color to quick start box in README.md (#619) * add-dimensional-edges: add ConstraintItems horizontalEdges, verticalEdges, directionalHorizontalEdges and directionalVerticalEdges as convenience items to express left+right, top+bottom or leading+trailing (#637) * Update deprecations to allow Xcode to auto-fixup. (#634) * Migrate to Xcode 11 and updated travis.yml (#629) * Migrate to Xcode 11 and updated travis.yml * Travis to support Xcode 11 * project.pbxproj: Update to recommended settings. (#627) * Add test assert to unit test testCanSetLabel. (#625) * Add back support for OS X 10.11 (#645) * Use << for ConstraintAttributes options (#659) * Use << for ConstraintAttributes options * iPhone 6s is not supported by the latest Xcode * Add method getting constraint with closure to ConstraintMakerRelatable (#663) * add ConstraintMakerRelatable extension * fix fatalError message Co-authored-by: Jimi <jimi-hpcnt@hpcnt.com> * Xcode 12 and SwiftPM enhancements * Update README to include SPM installation notes (#673) * Fix typo * Remove duplicate file * xcodeproject configuration enhancement for localization (#584) Co-authored-by: AmrAngry <c_amr.elghadban@smartdubai.ae> * Updates to project files * Dynamic Product (#710) This PR adds a dynamic product to SnapKit. Having a dynamic product is important in modular project structures; multiple packages may be using SnapKit, and this allows that support without the end-user have to wrap SnapKit in their own package that exposes it and using that package in lieu of SnapKit. * Fix warning about `class` (#714) * Added Example-iOS.xcdodeproj and fixed examples (#707) * Update README.md, add missing Migration Guides section (#721) * Make ConstraintMaker.item public (#693) * Typo source directory in Podspec (#738) Source directory has been renamed in 18608ead653bfe1e05e3d1f6fb6d34f62cec49bd * Release 5.6 * Update urls in readme * Update podspec version Co-authored-by: Benjamin Chrobot <benjamin.blair.chrobot@gmail.com> Co-authored-by: Linus Unnebäck <linus@folkdatorn.se> Co-authored-by: Mauro Vime Castillo <mvimeapps@gmail.com> Co-authored-by: o( ̄へ ̄)o <guzhenhuaGitHub@users.noreply.github.com> Co-authored-by: Colin T.A. Gray <colinta@gmail.com> Co-authored-by: Shai Mishali <freak4pc@gmail.com> Co-authored-by: Ibrahim Koteish <ikteish@yahoo.com> Co-authored-by: Jungwon An <kawoou@kawoou.kr> Co-authored-by: Alexander Belonogov <sashabelonogov@gmail.com> Co-authored-by: Christian Schnorr <christian.schnorr@me.com> Co-authored-by: Josh Converse <josh.converse@gmail.com> Co-authored-by: Vitalii Budnik <nekrich@users.noreply.github.com> Co-authored-by: Shiva Huang <shiva.tw@gmail.com> Co-authored-by: Max Cobb <5754073+maxxfrazer@users.noreply.github.com> Co-authored-by: Liam Elmore <32336260+iosmo@users.noreply.github.com> Co-authored-by: Sven Driemecker <sven.dr@gmx.de> Co-authored-by: Alex Simpson <alexandersimpson94@gmail.com> Co-authored-by: pushp1989 <54930194+pushp1989@users.noreply.github.com> Co-authored-by: Ben Yohay <ben@lightricks.com> Co-authored-by: Natascha Fadeeva <nataschafadeeva@aol.de> Co-authored-by: Wang, Chi <patr0nus@users.noreply.github.com> Co-authored-by: Roman Podymov <podymfrombryansk@yandex.ru> Co-authored-by: wotjd <wotjd971102@gmail.com> Co-authored-by: Jimi <jimi-hpcnt@hpcnt.com> Co-authored-by: Samuel Eshun <samueleshun15@gmail.com> Co-authored-by: Amr Elghadban <amr.elghadban@gmail.com> Co-authored-by: AmrAngry <c_amr.elghadban@smartdubai.ae> Co-authored-by: Hesham Salman <iron-ham@github.com> Co-authored-by: Mr. Ming <minglq.9@gmail.com> Co-authored-by: Teameh <tiemevanveen@hotmail.com> Co-authored-by: Josip Rezić <josip.rezic@hotmail.com> Co-authored-by: Rhett Tuan <devindwan@gmail.com> Co-authored-by: Damien Debin <ddebin@users.noreply.github.com> Co-authored-by: Robert Payne <robertjpayne@Roberts-MacBook-Pro.local>
2022-04-13 12:06:06 +08:00
box.backgroundColor = .green
2016-01-26 19:00:26 +08:00
box.snp.makeConstraints { (make) -> Void in
2015-04-16 20:47:03 +08:00
make.width.height.equalTo(50)
make.center.equalTo(self.view)
}
2014-07-29 08:39:59 +08:00
}
2015-04-16 20:47:03 +08:00
2014-07-29 08:39:59 +08:00
}
```
Feature/release 5.6 (#746) * Add support for UILayoutPriority as priority target. (#466) * Add support for UILayoutPriority as priority target. * Fixed for tvOS * Add update(priority: ConstraintPriority) method (#467) * Add update(priority: ConstraintPriority) method * Fix copy-paste error * Add Swift Package Manager support (#501) * Swift4.2 (#516) * make ConstraintAttributes conform to ExpressibleByIntegerLiteral (#520) * Adds 'constraint.isActive = bool' to Constraint (#496) * delegate identical 'constraint creation' code to 'prepareConstraints' * adds 'set(isActivated:)' method to call appropriate 'activate/deactivate' based on bool cleans up about 30 lines of if foo { activate } else { deactivate } code in my app * instead of 'set(isActivated:)', use 'isActive = value' * Add swift version to podspec * Update podspec * Update podspec * Update project to get rid of Migration Warning (#547) * Update Swift Language version to 4.2 under build settings (#551) * Update swift language version to 4.2 in build settings * Update podspec * Remove Swift Version file * Remove Package.swift, SnapKit is not SwiftPM compatible anyways * Update Podspec * Update version in Podspec * Support swift 5.0 (#570) * Update swift version 5.0 * Remove needless access control * Fix misused "Available" annotations * Support @unknown default * Support swift 5.0 in test code * Update podspec * Update travis CI * Code review by @freak4pc * Add constraint for Swift version * Fix build failed * [EXC_BAD_ACCESS] Update LayoutConstraint == operator to support iOS 10 and higher changes (#574) * @sashabelonogov Update LayoutConstraint == operator to support iOS 10 and higher changes * Simplify return statement of the LayoutConstraint == operator * Fix incorrect behavior of inset with center and baseline anchors (#569) * Fix insets adjusting center attributes incorrectly * Fix insets adjusting baseline attributes incorrectly * Add back Package.swift for SwiftPM compatibility (#559) reverts 477fffae4c37386285f78511ff4120f1f5324ff8 * Update podspec * Update min target versions * Update min target versions * Update README.md * Update README.md * Revert "[EXC_BAD_ACCESS] Update LayoutConstraint == operator to support iOS 10 and higher changes (#574)" (#593) This reverts commit bc2b0b93320513eb747b3baf6332c05bacc067b4. * Update Podspec * Bump min version requirements * Fix layout constraint comparison * Fix equality check for iOS * Adds support for NSDirectionalEdgeInsets as an inset constant (#594) * Make ConstraintViewDSL content priorities nonmutating (#586) * Adds two new compositions – DirectionalEdges and DirectionalMargins (#595) * WIP * Add directional margins * Whitespace * Add Playground Sample (#608) * added updates to Package.swift so it can be imported with Xcode 11 (#615) * Revert #574 * Update Podspec * Add background color to quick start box in README.md (#619) * add-dimensional-edges: add ConstraintItems horizontalEdges, verticalEdges, directionalHorizontalEdges and directionalVerticalEdges as convenience items to express left+right, top+bottom or leading+trailing (#637) * Update deprecations to allow Xcode to auto-fixup. (#634) * Migrate to Xcode 11 and updated travis.yml (#629) * Migrate to Xcode 11 and updated travis.yml * Travis to support Xcode 11 * project.pbxproj: Update to recommended settings. (#627) * Add test assert to unit test testCanSetLabel. (#625) * Add back support for OS X 10.11 (#645) * Use << for ConstraintAttributes options (#659) * Use << for ConstraintAttributes options * iPhone 6s is not supported by the latest Xcode * Add method getting constraint with closure to ConstraintMakerRelatable (#663) * add ConstraintMakerRelatable extension * fix fatalError message Co-authored-by: Jimi <jimi-hpcnt@hpcnt.com> * Xcode 12 and SwiftPM enhancements * Update README to include SPM installation notes (#673) * Fix typo * Remove duplicate file * xcodeproject configuration enhancement for localization (#584) Co-authored-by: AmrAngry <c_amr.elghadban@smartdubai.ae> * Updates to project files * Dynamic Product (#710) This PR adds a dynamic product to SnapKit. Having a dynamic product is important in modular project structures; multiple packages may be using SnapKit, and this allows that support without the end-user have to wrap SnapKit in their own package that exposes it and using that package in lieu of SnapKit. * Fix warning about `class` (#714) * Added Example-iOS.xcdodeproj and fixed examples (#707) * Update README.md, add missing Migration Guides section (#721) * Make ConstraintMaker.item public (#693) * Typo source directory in Podspec (#738) Source directory has been renamed in 18608ead653bfe1e05e3d1f6fb6d34f62cec49bd * Release 5.6 * Update urls in readme * Update podspec version Co-authored-by: Benjamin Chrobot <benjamin.blair.chrobot@gmail.com> Co-authored-by: Linus Unnebäck <linus@folkdatorn.se> Co-authored-by: Mauro Vime Castillo <mvimeapps@gmail.com> Co-authored-by: o( ̄へ ̄)o <guzhenhuaGitHub@users.noreply.github.com> Co-authored-by: Colin T.A. Gray <colinta@gmail.com> Co-authored-by: Shai Mishali <freak4pc@gmail.com> Co-authored-by: Ibrahim Koteish <ikteish@yahoo.com> Co-authored-by: Jungwon An <kawoou@kawoou.kr> Co-authored-by: Alexander Belonogov <sashabelonogov@gmail.com> Co-authored-by: Christian Schnorr <christian.schnorr@me.com> Co-authored-by: Josh Converse <josh.converse@gmail.com> Co-authored-by: Vitalii Budnik <nekrich@users.noreply.github.com> Co-authored-by: Shiva Huang <shiva.tw@gmail.com> Co-authored-by: Max Cobb <5754073+maxxfrazer@users.noreply.github.com> Co-authored-by: Liam Elmore <32336260+iosmo@users.noreply.github.com> Co-authored-by: Sven Driemecker <sven.dr@gmx.de> Co-authored-by: Alex Simpson <alexandersimpson94@gmail.com> Co-authored-by: pushp1989 <54930194+pushp1989@users.noreply.github.com> Co-authored-by: Ben Yohay <ben@lightricks.com> Co-authored-by: Natascha Fadeeva <nataschafadeeva@aol.de> Co-authored-by: Wang, Chi <patr0nus@users.noreply.github.com> Co-authored-by: Roman Podymov <podymfrombryansk@yandex.ru> Co-authored-by: wotjd <wotjd971102@gmail.com> Co-authored-by: Jimi <jimi-hpcnt@hpcnt.com> Co-authored-by: Samuel Eshun <samueleshun15@gmail.com> Co-authored-by: Amr Elghadban <amr.elghadban@gmail.com> Co-authored-by: AmrAngry <c_amr.elghadban@smartdubai.ae> Co-authored-by: Hesham Salman <iron-ham@github.com> Co-authored-by: Mr. Ming <minglq.9@gmail.com> Co-authored-by: Teameh <tiemevanveen@hotmail.com> Co-authored-by: Josip Rezić <josip.rezic@hotmail.com> Co-authored-by: Rhett Tuan <devindwan@gmail.com> Co-authored-by: Damien Debin <ddebin@users.noreply.github.com> Co-authored-by: Robert Payne <robertjpayne@Roberts-MacBook-Pro.local>
2022-04-13 12:06:06 +08:00
### Playground
You can try SnapKit in Playground.
**Note:**
> To try SnapKit in playground, open `SnapKit.xcworkspace` and build SnapKit.framework for any simulator first.
2016-09-14 17:29:01 +08:00
### Resources
Feature/release 5.6 (#746) * Add support for UILayoutPriority as priority target. (#466) * Add support for UILayoutPriority as priority target. * Fixed for tvOS * Add update(priority: ConstraintPriority) method (#467) * Add update(priority: ConstraintPriority) method * Fix copy-paste error * Add Swift Package Manager support (#501) * Swift4.2 (#516) * make ConstraintAttributes conform to ExpressibleByIntegerLiteral (#520) * Adds 'constraint.isActive = bool' to Constraint (#496) * delegate identical 'constraint creation' code to 'prepareConstraints' * adds 'set(isActivated:)' method to call appropriate 'activate/deactivate' based on bool cleans up about 30 lines of if foo { activate } else { deactivate } code in my app * instead of 'set(isActivated:)', use 'isActive = value' * Add swift version to podspec * Update podspec * Update podspec * Update project to get rid of Migration Warning (#547) * Update Swift Language version to 4.2 under build settings (#551) * Update swift language version to 4.2 in build settings * Update podspec * Remove Swift Version file * Remove Package.swift, SnapKit is not SwiftPM compatible anyways * Update Podspec * Update version in Podspec * Support swift 5.0 (#570) * Update swift version 5.0 * Remove needless access control * Fix misused "Available" annotations * Support @unknown default * Support swift 5.0 in test code * Update podspec * Update travis CI * Code review by @freak4pc * Add constraint for Swift version * Fix build failed * [EXC_BAD_ACCESS] Update LayoutConstraint == operator to support iOS 10 and higher changes (#574) * @sashabelonogov Update LayoutConstraint == operator to support iOS 10 and higher changes * Simplify return statement of the LayoutConstraint == operator * Fix incorrect behavior of inset with center and baseline anchors (#569) * Fix insets adjusting center attributes incorrectly * Fix insets adjusting baseline attributes incorrectly * Add back Package.swift for SwiftPM compatibility (#559) reverts 477fffae4c37386285f78511ff4120f1f5324ff8 * Update podspec * Update min target versions * Update min target versions * Update README.md * Update README.md * Revert "[EXC_BAD_ACCESS] Update LayoutConstraint == operator to support iOS 10 and higher changes (#574)" (#593) This reverts commit bc2b0b93320513eb747b3baf6332c05bacc067b4. * Update Podspec * Bump min version requirements * Fix layout constraint comparison * Fix equality check for iOS * Adds support for NSDirectionalEdgeInsets as an inset constant (#594) * Make ConstraintViewDSL content priorities nonmutating (#586) * Adds two new compositions – DirectionalEdges and DirectionalMargins (#595) * WIP * Add directional margins * Whitespace * Add Playground Sample (#608) * added updates to Package.swift so it can be imported with Xcode 11 (#615) * Revert #574 * Update Podspec * Add background color to quick start box in README.md (#619) * add-dimensional-edges: add ConstraintItems horizontalEdges, verticalEdges, directionalHorizontalEdges and directionalVerticalEdges as convenience items to express left+right, top+bottom or leading+trailing (#637) * Update deprecations to allow Xcode to auto-fixup. (#634) * Migrate to Xcode 11 and updated travis.yml (#629) * Migrate to Xcode 11 and updated travis.yml * Travis to support Xcode 11 * project.pbxproj: Update to recommended settings. (#627) * Add test assert to unit test testCanSetLabel. (#625) * Add back support for OS X 10.11 (#645) * Use << for ConstraintAttributes options (#659) * Use << for ConstraintAttributes options * iPhone 6s is not supported by the latest Xcode * Add method getting constraint with closure to ConstraintMakerRelatable (#663) * add ConstraintMakerRelatable extension * fix fatalError message Co-authored-by: Jimi <jimi-hpcnt@hpcnt.com> * Xcode 12 and SwiftPM enhancements * Update README to include SPM installation notes (#673) * Fix typo * Remove duplicate file * xcodeproject configuration enhancement for localization (#584) Co-authored-by: AmrAngry <c_amr.elghadban@smartdubai.ae> * Updates to project files * Dynamic Product (#710) This PR adds a dynamic product to SnapKit. Having a dynamic product is important in modular project structures; multiple packages may be using SnapKit, and this allows that support without the end-user have to wrap SnapKit in their own package that exposes it and using that package in lieu of SnapKit. * Fix warning about `class` (#714) * Added Example-iOS.xcdodeproj and fixed examples (#707) * Update README.md, add missing Migration Guides section (#721) * Make ConstraintMaker.item public (#693) * Typo source directory in Podspec (#738) Source directory has been renamed in 18608ead653bfe1e05e3d1f6fb6d34f62cec49bd * Release 5.6 * Update urls in readme * Update podspec version Co-authored-by: Benjamin Chrobot <benjamin.blair.chrobot@gmail.com> Co-authored-by: Linus Unnebäck <linus@folkdatorn.se> Co-authored-by: Mauro Vime Castillo <mvimeapps@gmail.com> Co-authored-by: o( ̄へ ̄)o <guzhenhuaGitHub@users.noreply.github.com> Co-authored-by: Colin T.A. Gray <colinta@gmail.com> Co-authored-by: Shai Mishali <freak4pc@gmail.com> Co-authored-by: Ibrahim Koteish <ikteish@yahoo.com> Co-authored-by: Jungwon An <kawoou@kawoou.kr> Co-authored-by: Alexander Belonogov <sashabelonogov@gmail.com> Co-authored-by: Christian Schnorr <christian.schnorr@me.com> Co-authored-by: Josh Converse <josh.converse@gmail.com> Co-authored-by: Vitalii Budnik <nekrich@users.noreply.github.com> Co-authored-by: Shiva Huang <shiva.tw@gmail.com> Co-authored-by: Max Cobb <5754073+maxxfrazer@users.noreply.github.com> Co-authored-by: Liam Elmore <32336260+iosmo@users.noreply.github.com> Co-authored-by: Sven Driemecker <sven.dr@gmx.de> Co-authored-by: Alex Simpson <alexandersimpson94@gmail.com> Co-authored-by: pushp1989 <54930194+pushp1989@users.noreply.github.com> Co-authored-by: Ben Yohay <ben@lightricks.com> Co-authored-by: Natascha Fadeeva <nataschafadeeva@aol.de> Co-authored-by: Wang, Chi <patr0nus@users.noreply.github.com> Co-authored-by: Roman Podymov <podymfrombryansk@yandex.ru> Co-authored-by: wotjd <wotjd971102@gmail.com> Co-authored-by: Jimi <jimi-hpcnt@hpcnt.com> Co-authored-by: Samuel Eshun <samueleshun15@gmail.com> Co-authored-by: Amr Elghadban <amr.elghadban@gmail.com> Co-authored-by: AmrAngry <c_amr.elghadban@smartdubai.ae> Co-authored-by: Hesham Salman <iron-ham@github.com> Co-authored-by: Mr. Ming <minglq.9@gmail.com> Co-authored-by: Teameh <tiemevanveen@hotmail.com> Co-authored-by: Josip Rezić <josip.rezic@hotmail.com> Co-authored-by: Rhett Tuan <devindwan@gmail.com> Co-authored-by: Damien Debin <ddebin@users.noreply.github.com> Co-authored-by: Robert Payne <robertjpayne@Roberts-MacBook-Pro.local>
2022-04-13 12:06:06 +08:00
- [Documentation](https://snapkit.github.io/SnapKit/docs/)
- [F.A.Q.](https://snapkit.github.io/SnapKit/faq/)
2016-09-14 17:29:01 +08:00
## Credits
2014-12-05 09:36:41 +08:00
2016-09-14 17:29:01 +08:00
- Robert Payne ([@robertjpayne](https://twitter.com/robertjpayne))
2016-09-14 17:31:04 +08:00
- Many other contributors
2014-12-05 09:36:41 +08:00
2015-04-16 20:47:03 +08:00
## License
2014-07-29 08:39:59 +08:00
2016-09-14 17:29:01 +08:00
SnapKit is released under the MIT license. See LICENSE for details.