{"id":1266,"url":"https://github.com/SnapKit/SnapKit","last_synced_at":"2025-08-06T13:32:44.529Z","repository":{"id":17717549,"uuid":"20541795","full_name":"SnapKit/SnapKit","owner":"SnapKit","description":"A Swift Autolayout DSL for iOS \u0026 OS X","archived":false,"fork":false,"pushed_at":"2025-05-08T09:55:53.000Z","size":2890,"stargazers_count":20221,"open_issues_count":55,"forks_count":2021,"subscribers_count":391,"default_branch":"develop","last_synced_at":"2025-08-02T07:26:17.298Z","etag":null,"topics":["auto","autolayout","cocoapods","constraints","dsl","layout","snapkit","swift","ui","xcode"],"latest_commit_sha":null,"homepage":"https://snapkit.github.io/SnapKit/","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SnapKit.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":"Supporting Files/Info.plist","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2014-06-05T21:13:40.000Z","updated_at":"2025-08-02T02:50:46.000Z","dependencies_parsed_at":"2022-07-14T04:50:28.604Z","dependency_job_id":"ce156791-9c1f-4942-af63-8283f063fb77","html_url":"https://github.com/SnapKit/SnapKit","commit_stats":{"total_commits":456,"total_committers":94,"mean_commits":4.851063829787234,"dds":0.3092105263157895,"last_synced_commit":"3b5120fa082a847059bc0ca02f99561d6be25c5d"},"previous_names":["masonry/snap"],"tags_count":45,"template":false,"template_full_name":null,"purl":"pkg:github/SnapKit/SnapKit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SnapKit%2FSnapKit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SnapKit%2FSnapKit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SnapKit%2FSnapKit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SnapKit%2FSnapKit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SnapKit","download_url":"https://codeload.github.com/SnapKit/SnapKit/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SnapKit%2FSnapKit/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268495805,"owners_count":24259391,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-03T02:00:12.545Z","response_time":2577,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["auto","autolayout","cocoapods","constraints","dsl","layout","snapkit","swift","ui","xcode"],"created_at":"2024-01-05T20:15:42.540Z","updated_at":"2025-08-06T13:32:44.230Z","avatar_url":"https://github.com/SnapKit.png","language":"Swift","funding_links":[],"categories":["Layout","Libs","Swift","awesome-ios ##","9. 其他与展望","HarmonyOS","其他","Swift 库","Minor","Layout [🔝](#readme)","iOS","xcode","Frameworks"],"sub_categories":["Other Hardware","Layout","Other free courses","5. 参考材料","Windows Manager","网络服务_其他","Auto Layout","Masonry-SnapKit"],"readme":"\u003cimg src=\"https://snapkit.github.io/SnapKit/images/banner.jpg\" alt=\"\" /\u003e\n\nSnapKit is a DSL to make Auto Layout easy on both iOS and OS X.\n\n[![Build Status](https://travis-ci.org/SnapKit/SnapKit.svg)](https://travis-ci.org/SnapKit/SnapKit)\n[![Platform](https://img.shields.io/cocoapods/p/SnapKit.svg?style=flat)](https://github.com/SnapKit/SnapKit)\n[![Cocoapods Compatible](https://img.shields.io/cocoapods/v/SnapKit.svg)](https://cocoapods.org/pods/SnapKit)\n[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)\n\n#### ⚠️ **To use with Swift 4.x please ensure you are using \u003e= 4.0.0** ⚠️\n#### ⚠️ **To use with Swift 5.x please ensure you are using \u003e= 5.0.0** ⚠️\n\n## Contents\n\n- [Requirements](#requirements)\n- [Migration Guides](#migration-guides)\n- [Communication](#communication)\n- [Installation](#installation)\n- [Usage](#usage)\n- [Credits](#credits)\n- [License](#license)\n\n## Requirements\n\n- iOS 12.0+ / Mac OS X 10.13+ / tvOS 10.0+\n- Xcode 10.0+\n- Swift 4.0+\n\n## Migration Guides\n\n- [SnapKit 3.0 Migration Guide](Documentation/SnapKit%203.0%20Migration%20Guide.md)\n\n## Communication\n\n- If you **need help**, use [Stack Overflow](http://stackoverflow.com/questions/tagged/snapkit). (Tag 'snapkit')\n- If you'd like to **ask a general question**, use [Stack Overflow](http://stackoverflow.com/questions/tagged/snapkit).\n- If you **found a bug**, open an issue.\n- If you **have a feature request**, open an issue.\n- If you **want to contribute**, submit a pull request.\n\n\n## Installation\n\n### CocoaPods\n\n[CocoaPods](http://cocoapods.org) is a dependency manager for Cocoa projects. You can install it with the following command:\n\n```bash\n$ gem install cocoapods\n```\n\n\u003e CocoaPods 1.1.0+ is required to build SnapKit 4.0.0+.\n\nTo integrate SnapKit into your Xcode project using CocoaPods, specify it in your `Podfile`:\n\n```ruby\nsource 'https://github.com/CocoaPods/Specs.git'\nplatform :ios, '12.0'\nuse_frameworks!\n\ntarget '\u003cYour Target Name\u003e' do\n    pod 'SnapKit', '~\u003e 5.7.0'\nend\n```\n\nThen, run the following command:\n\n```bash\n$ pod install\n```\n\n### Carthage\n\n[Carthage](https://github.com/Carthage/Carthage) is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.\n\nYou can install Carthage with [Homebrew](http://brew.sh/) using the following command:\n\n```bash\n$ brew update\n$ brew install carthage\n```\n\nTo integrate SnapKit into your Xcode project using Carthage, specify it in your `Cartfile`:\n\n```ogdl\ngithub \"SnapKit/SnapKit\" ~\u003e 5.0.0\n```\n\nRun `carthage update` to build the framework and drag the built `SnapKit.framework` into your Xcode project.\n\n### Swift Package Manager\n\n[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.\n\n\u003e Xcode 11+ is required to build SnapKit using Swift Package Manager.\n\nTo integrate SnapKit into your Xcode project using Swift Package Manager, add it to the dependencies value of your `Package.swift`:\n\n```swift\ndependencies: [\n    .package(url: \"https://github.com/SnapKit/SnapKit.git\", .upToNextMajor(from: \"5.0.1\"))\n]\n```\n\n### Manually\n\nIf you prefer not to use either of the aforementioned dependency managers, you can integrate SnapKit into your project manually.\n\n---\n\n## Usage\n\n### Quick Start\n\n```swift\nimport SnapKit\n\nclass MyViewController: UIViewController {\n\n    lazy var box = UIView()\n\n    override func viewDidLoad() {\n        super.viewDidLoad()\n\n        self.view.addSubview(box)\n        box.backgroundColor = .green\n        box.snp.makeConstraints { (make) -\u003e Void in\n           make.width.height.equalTo(50)\n           make.center.equalTo(self.view)\n        }\n    }\n\n}\n```\n\n### Playground\nYou can try SnapKit in Playground.\n\n**Note:**\n\n\u003e To try SnapKit in playground, open `SnapKit.xcworkspace` and build SnapKit.framework for any simulator first.\n\n### Resources\n\n- [Documentation](https://snapkit.github.io/SnapKit/docs/)\n- [F.A.Q.](https://snapkit.github.io/SnapKit/faq/)\n\n## Credits\n\n- Robert Payne ([@robertjpayne](https://twitter.com/robertjpayne))\n- Many other contributors\n\n## License\n\nSnapKit is released under the MIT license. See LICENSE for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSnapKit%2FSnapKit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FSnapKit%2FSnapKit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSnapKit%2FSnapKit/lists"}