<img src="https://snapkit.github.io/SnapKit/images/banner.jpg" alt="" />
SnapKit is a DSL to make Auto Layout easy on both iOS and OS X.
[](https://travis-ci.org/SnapKit/SnapKit)
[](https://github.com/SnapKit/SnapKit)
[](https://cocoapods.org/pods/SnapKit)
[](https://github.com/Carthage/Carthage)
#### ⚠️ **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** ⚠️
## Contents
- [Requirements](#requirements)
- [Migration Guides](#migration-guides)
- [Communication](#communication)
- [Installation](#installation)
- [Usage](#usage)
- [Credits](#credits)
- [License](#license)
## Requirements
- iOS 10.0+ / Mac OS X 10.12+ / tvOS 10.0+
- Xcode 10.0+
- Swift 4.0+
## Migration Guides
- [SnapKit 3.0 Migration Guide](Documentation/SnapKit%203.0%20Migration%20Guide.md)
## 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
```
> CocoaPods 1.1.0+ is required to build SnapKit 4.0.0+.
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.6.0'
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
github "SnapKit/SnapKit" ~> 5.0.0
```
Run `carthage update` to build the framework and drag the built `SnapKit.framework` into your Xcode project.
### Swift Package Manager
[Swift Package Manager](https://swift.org/package-manager/) is a tool for managing the distribution of Swift code. It’s 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"))
]
```
### Manually
If you prefer not to use either of the aforementioned dependency managers, you can integrate SnapKit into your project manually.
---
## Usage
### Quick Start
```swift
import SnapKit
class MyViewController: UIViewController {
lazy var box = UIView()
override func viewDidLoad() {
super.viewDidLoad()
self.view.addSubview(box)
box.backgroundColor = .green
box.snp.makeConstraints { (make) -> Void in
make.width.height.equalTo(50)
make.center.equalTo(self.view)
}
}
}
```
### Playground
You can try SnapKit in Playground.
**Note:**
> To try SnapKit in playground, open `SnapKit.xcworkspace` and build SnapKit.framework for any simulator first.
### Resources
- [Documentation](https://snapkit.github.io/SnapKit/docs/)
- [F.A.Q.](https://snapkit.github.io/SnapKit/faq/)
## Credits
- Robert Payne ([@robertjpayne](https://twitter.com/robertjpayne))
- Many other contributors
## License
SnapKit is released under the MIT license. See LICENSE for details.

ml_Better
- 粉丝: 38
- 资源: 35
最新资源
- 旧物置换网站(基于springboot,mysql,java).zip
- 基于2-RC模型的锂电池SOC预测与Matlab Simulink建模仿真研究,基于2-RC模型的锂电池SOC估算及Matlab Simulink建模仿真研究,锂电池soc 2-RC模型,matla
- STM32单片机指纹密码锁仿真系统:键盘解锁、指纹解锁、修改密码、警报蜂鸣器与LED灯显示功能,STM32单片机指纹密码锁仿真系统:键盘解锁、指纹解锁、修改密码、警报蜂鸣器与LED灯显示功能,STM3
- TensorFlow 风格迁移艺术化图片集
- 西门子PLC 1200与G120变频器Modbus RTU通讯实现详解:PID自写FB块与触摸屏集成,手动自动功能切换,CAD电气注释及Modbus通讯报文分析,西门子PLC 1200与多台变频器Mo
- 3DMAX摄影机参考图像插件下载
- 计算机等级考试一级MSOffice练习系统V1.8
- 光伏系统Boost电路单相SPWM逆变并网仿真研究:400V直流母线电压至220V交流输出性能优化与THD控制,光伏系统Boost电路单相SPWM逆变并网仿真研究:400V直流母线电压至220V交流输
- 深度解析:基于Yolov5的布匹缺陷智能检测方法研究(含代码及完整数据集分析与应用案例),基于Yolov5的布匹缺陷检测技术研究与实现:源码及数据集分享,基于yolov5的布匹缺陷检测(含源码和数据集
- Power BI 简单使用
- 2 毕业设计论文任务书、开题报告、文献阅读汇总表、申请答辩表、教师评阅表、盲审表、答辩表、成绩评定表.docx
- 基于电压反馈的永磁同步电机超前角弱磁控制策略:抵抗负载扰动,平稳过渡至弱磁区域,确保电机稳定高效运行,基于电压反馈的永磁同步电机超前角弱磁控制策略:抵抗负载扰动,平稳过渡至弱磁区域,实现转速与转矩的稳
- 计算机等级考试一级WPSOffice练习系统V1.8
- 包装产线轻载搬运机器人运动学分析与轨迹规划.doc
- 基于改进灰狼算法的风光储微电网的储能容量优化研究.docx
- 云原生后端核心技术解析:引领后端开发新时代的架构与应用
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈



评论0