Swiftpack.co - dogo/SketchKit as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
A lightweight auto-layout DSL library for iOS, tvOS & macOS.
.package(url: "https://github.com/dogo/SketchKit.git", from: "1.5.0")

Build Status codecov Cocoapods compatible SPM compatible Carthage compatible License

SketchKit is a lightweight, powerful and pure-Swift auto layout library, you can set up your constraints with a simple and intuitive code without any stringly typing.

In short, it allows you to replace this:

newView.translatesAutoresizingMaskIntoConstraints = false

              item: newView,
              attribute: NSLayoutConstraint.Attribute.centerX,
              relatedBy: NSLayoutConstraint.Relation.equal,
              toItem: view,
              attribute: NSLayoutConstraint.Attribute.centerX,
              multiplier: 1,
              constant: 0))


newView.centerXAnchor.constraint(equalTo: view.centerXAnchor).isActive = true

with this

// It's NOT necessary: newView.translatesAutoresizingMaskIntoConstraints = false
newView.layout.applyConstraint { view in
    view.centerXAnchor(equalTo: self.view.centerXAnchor)
    view.centerYAnchor(equalTo: self.view.centerYAnchor)


  • iOS 9.0+ / tvOS 9.0+ / macOS 10.11+
  • Swift 3.2+



To integrate SketchKit into your Xcode project using CocoaPods, specify it in your Podfile:

target '<Your Target Name>' do
  pod 'SketchKit'

Then, run the following command:

$ pod install

Swift Package Manager (SPM)

To add SketchKit as a dependency, you have to add it to the dependencies of your Package.swift file and refer to that dependency in your target.

import PackageDescription
let package = Package(
    name: "<Your Product Name>",
    dependencies: [
       .package(url: "https://github.com/dogo/SketchKit", .upToNextMajor(from: "1.0.0"))
    targets: [
            name: "<Your Target Name>",
            dependencies: ["SketchKit"]),

After adding the dependency, you can fetch the library with:

$ swift package resolve


github "dogo/SketchKit"


Quick Start

import SketchKit

final class MyViewController: UIViewController {

    let myView: UIView = {
        let view = UIView(frame: .zero)
        view.color = .red
        return view

    override func viewDidLoad() {


        myView.layout.applyConstraint { view in
            view.topAnchor(equalTo: self.view.topAnchor)
            view.leadingAnchor(equalTo: self.view.leadingAnchor)
            view.bottomAnchor(equalTo: self.view.bottomAnchor)
            view.trailingAnchor(equalTo: self.view.trailingAnchor)


The project documentation can be found (here)


  • Nicholas Babo (@NickBabo) thank you for the SketchKit logo,


SketchKit is released under the MIT license. See LICENSE for details.


Stars: 41
Last commit: 6 weeks ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Submit a free job ad (while I'm testing this). The analytics numbers for this website are here.

Release Notes

Sir Macintosh
6 weeks ago

Add support to macOS

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics