A Swift Autolayout DSL for iOS & OS X

Overview

SnapKit is a DSL to make Auto Layout easy on both iOS and OS X.

Build Status Platform Cocoapods Compatible Carthage compatible

⚠️ 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

  • iOS 10.0+ / Mac OS X 10.12+ / tvOS 10.0+
  • Xcode 10.0+
  • Swift 4.0+

Communication

  • If you need help, use Stack Overflow. (Tag 'snapkit')
  • If you'd like to ask a general question, use Stack Overflow.
  • 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 is a dependency manager for Cocoa projects. You can install it with the following command:

$ 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:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '10.0'
use_frameworks!

target '<Your Target Name>' do
    pod 'SnapKit', '~> 5.0.0'
end

Then, run the following command:

$ pod install

Carthage

Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.

You can install Carthage with Homebrew using the following command:

$ brew update
$ brew install carthage

To integrate SnapKit into your Xcode project using Carthage, specify it in your Cartfile:

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 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:

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

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

Credits

License

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

Comments
  • Swift 3 - CocoaPods Integration Issues

    Swift 3 - CocoaPods Integration Issues

    New Issue Checklist

    Issue Info

    | Info | Value | | --- | --- | | Platform | e.g. ios | | Platform Version | e.g. 8.0 | | SnapKit Version | e.g. 3.0.0 | | Integration Method | e.g. cocoapods |

    Issue Description

    Using Xcode 8 and Swift 3, my project fails to compile SnapKit and calls out 16 different issues (all but one are "Extraneous argument label 'some_label' in call").

    For example, in Constraint.swift line 129 I see the following:

    let layoutConstant: CGFloat = self.constant.constraintConstantTargetValueFor(layoutAttribute: layoutToAttribute)

    Which shouldn't cause a compiler error because the most recent code in the 3.0 tag does explicitly call for an argument label in the constraintConstantTargetValueFor() method.

    However, the code pulled down from a pod install differs from the code in the 3.0 tag as seen in GitHub. Here's the function signature I see in the Pod's ConstraintConstantTarget.swift file on line 45:

    internal func constraintConstantTargetValueFor(_ layoutAttribute: NSLayoutAttribute) -> CGFloat

    I'm not particularly familiar with CocoaPods, but it seems like the code isn't in sync.

    wontfix 
    opened by Chris-Corea 40
  • Swift language leaks memory when having constant on constraints.

    Swift language leaks memory when having constant on constraints.

    New Issue Checklist

    Issue Info

    | Info | Value | | --- | --- | | Platform | ios | | Platform Version | 9.0 | | SnapKit Version | 2.0 | | Integration Method | cocoapods |

    Issue Description

    class PrototypeViewController: UIViewController {
    
        override func viewDidLoad() {
            super.viewDidLoad()
    
    
            let v = UIView()
            view.addSubview(v)
            v.snp_makeConstraints { (make) in
                make.center.equalTo(view).inset(12)
            }
        }
    
    }
    

    The above lines of code will cause memory leak. You can examine the leak by using instrument leak tool.

    help wanted need info 
    opened by mortyccp 26
  • Update  to Swift 4.2

    Update to Swift 4.2

    This PR updates to SnapKit to build with Swift 4.2, which involves a few key changes:

    • Update the Swift version in the project's build settings
    • Update to recommended project settings as suggested by Xcode 10
    • Removes the LayoutAttribute and LayoutRelation attributes used for cross platform compatibility, as now all platforms use NSLayoutConstraint.Attribute and `NSLayoutConstraint.Relation
    • Specifies an explicit Swift version in the project's Podspec
    • Updates the Swift Package Manager manifest to the latest format
    • Update the Travis CI build script to use Xcode 10

    I have Travis running against my fork of the repo, you can see build results here: https://travis-ci.org/rhysforyou/SnapKit

    opened by rhysforyou 22
  • Swift stdlib leaks on constraint creation

    Swift stdlib leaks on constraint creation

    New Issue Checklist

    • [x] I have looked at the Documentation
    • [x] I have read the F.A.Q.
    • [x] I have filled out this issue template.

    Issue Info

    | Info | Value | | --- | --- | | Platform | iOS | | Platform Version | 10.1 | | SnapKit Version | 3.0.2 | | Integration Method | cocoapods |

    Issue Description

    Too many leaks on Swift.Array<SnapKit.LayoutConstraint>, and it is always increasing 2016-10-27 13 42 16

    bug help wanted 
    opened by frogcjn 22
  • Size classes support

    Size classes support

    First things first: congrats to the SnapKit team and contributors, this library simply makes constraints something pleasant to deal with.

    This PR is a proof of concept of something that I find quite useful and which have let me save a lot of time and code. The change basically checks whether installOnView has the size classes for the given Constraint and, if not, the NSLayoutConstraint is not created.

    I haven't had the time to study the source code in deep and I'm sure there must be a way of implementing this better and, more important, according with the general architecture of the library.

    Find below some sample code:

        override func traitCollectionDidChange(previousTraitCollection: UITraitCollection?) {
            super.traitCollectionDidChange(previousTraitCollection)
    
            self.searchField.snp_updateConstraints { make in
                make.width.lessThanOrEqualTo(400).priorityLow()
                make.top.bottom.equalTo(self).inset(5)
                make.right.left.equalTo(self).inset(5).forHorizontalSizeClasses([.Unspecified, .Compact])
                make.centerX.equalTo(self).forHorizontalSizeClasses([.Regular])
            }
        }
    

    This will basically center the searchField horizontally on large screen sizes whereas the searchField will fill the superview edge to edge on small screen sizes.

    Thanks in advance for the feedback and give it a try!

    opened by nakiostudio 20
  • Fatal error: updated constraint could not find existing matching constraint to update

    Fatal error: updated constraint could not find existing matching constraint to update

    New Issue Checklist

    • [X] I have looked at the Documentation
    • [X] I have read the F.A.Q.
    • [X] I have filled out this issue template.

    Issue Info

    Info | Value | -------------------------|-------------------------------------| Platform | ios Platform Version | 12.2 SnapKit Version | 5.0.0 Integration Method | cocoapods

    Issue Description

    After SnapKit update (5.0.0 was 4.2.0) I have now fatal error on updateConstraints

    Capture d’écran 2019-04-26 à 19 19 31

    Updated constraint could not find existing matching constraint to update

    After some investigations I discovered where the issue is located: LayoutConstraint.swift

    The object comparison between firstAnchor or secondAnchor doesn't work properly.

    Capture d’écran 2019-04-26 à 18 53 52

    I don't understand the purpose of #574 because firstItem is unowned(unsafe) meaning it'll crash if you try to update constraints for deallocated object

    The real question is: Why are you trying to update constraints for deallocated objects 😄

    opened by arnauddorgans 17
  • Operator Overloading downsides

    Operator Overloading downsides

    I'm working just locally at the moment but brought a similar fork of mine up to speed and actually working, in the progress I've come across some unfortunate quirks for operator overloading:

    To rework something like (v1.left.top.right == v2) + UIEdgeInsets(5, 5, 5, 5) to v1.left.top.right == v2 + UIEdgeInsets(5, 5, 5, 5) we have to operator overload + on UIView which starts to get a bit unfortunate.

    Priorities typically would always be set last using the Objective-C DSL but with the new DSL we must specify the priority like first like v1.left == v2.priority(500) + 50 or use parans like (v1.left == v2 + 50).priority(500). The only other option for this to make it nice and clean would be using a different operator just for priorities. I'm currently using ~ so it looks like v1.left == v2 + 15 ~ 749 but we really start to lose code readability going this far.

    opened by robertjpayne 17
  • Priority enum

    Priority enum

    This adds an enum for priority based constraints allowing users to write priority as:

    .priority(level: .low)
    

    Based on the issue https://github.com/SnapKit/SnapKit/issues/324

    opened by Shehryar 16
  • crash: Updated constraint could not find existing matching constraint to update

    crash: Updated constraint could not find existing matching constraint to update

    New Issue Checklist

    Issue Info

    | Info | Value | | --- | --- | | Platform | ios | | Platform Version | 10 | | SnapKit Version | 0.40.0 (2e4cebf41d8bd0833487381590ed90c38b9a2491) | | Integration Method | carthage |

    Issue Description

    I've just migrated my app to Swift3 and hence also switched to version 0.40 unfortunately it now crashes on startup. I am seeing

    NSHashTable {
    [0] <SnapKit.LayoutConstraint:[email protected]#47 UILabel:0x7faa7bc38770.top == Foo.ReloadView:0x7faa7bc35340.top + 20.0>
    }
     NSHashTable {
    [0] <SnapKit.LayoutConstraint:[email protected]#47 UILabel:0x7faa7bc38770.top == Foo.ReloadView:0x7faa7bc35340.top + 20.0>
    }
    
    fatal error: Updated constraint could not find existing matching constraint to update: <SnapKit.LayoutConstraint:[email protected]#48 UILabel:0x7faa7bc38770.left == Foo.ReloadView:0x7faa7bc35340.left + 20.0>: file /project/Carthage/Checkouts/SnapKit/Source/Constraint.swift, line 233
    

    A stripped down version of the view controller and view looks like this:

    class ReloadView: UIView {
    
        override init(frame: CGRect) {
            super.init(frame: frame)
            configure()
        }
    
        required init?(coder aDecoder: NSCoder) {
            super.init(coder: aDecoder)
            configure()
        }
    
        convenience init() {
            self.init(frame: CGRect.zero)
        }
    
        func configure() {
    
            let label = UILabel()
            let button = UIButton(type: UIButtonType.roundedRect)
    
            addSubview(label)
            addSubview(button)
    
            let padding = 20
    
            label.snp.updateConstraints { make in
                make.top.equalTo(padding)
                make.left.equalTo(self).offset(padding)
                make.right.equalTo(self).offset(-padding)
                make.width.equalTo(300)
            }
    
            button.snp.updateConstraints { make in
                make.top.equalTo(label.snp.bottom).offset(padding)
                make.left.equalTo(padding)
                make.width.equalTo(self).offset(-2*padding)
                make.bottom.equalTo(0).offset(-padding)
            }
        }
    }
    
    class FooViewController: UIViewController {
    
        private var reloadView: ReloadView!
    
        override func viewDidLoad() {
            super.viewDidLoad()
    
            let reloadView = ReloadView()
            self.reloadView = reloadView
    
            view.addSubview(reloadView)
    
            reloadView.snp.updateConstraints { make in
                // make.center.equalToSuperview()
                make.edges.equalTo(view.snp.edges)
            }
    
        }
    }
    
    opened by tcurdt 16
  • SnapKit 0.10.0 crash on iOS7 in release on device

    SnapKit 0.10.0 crash on iOS7 in release on device

    Hi guys. I have updated my SnapKit submodule so it points now to d44a9bebd2a4cc324fb100d5f9b089ee82b98521. It's all working fine (had to update code a little bit), but only on iOS7, only in release configuration and only when running on device (not on simulator) it crashes right away. Here is a screen shot of what we have in Fabric https://www.dropbox.com/s/nkecb8lgoh1sfmi/Screenshot%202015-04-18%2014.43.07.png?dl=0

    and here is the code that calls it

    screenshot 2015-04-18 14 44 25

    but even when i remove that part it crashes on some another one.

    Could you please give me and advice on this?

    need info 
    opened by nezhyborets 16
  • Crash when removing constraints on iOS 9

    Crash when removing constraints on iOS 9

    New Issue Checklist

    🚫 If this template is not filled out your issue will be closed with no comment. 🚫

    • [X] I have looked at the Documentation
    • [X] I have read the F.A.Q.
    • [X] I have filled out this issue template.

    Issue Info

    | Info | Value | | --- | --- | | Platform | iOS | | Platform Version | 9.3 | | SnapKit Version | 0.22.0 | | Integration Method | cocoapods |

    Issue Description

    Since updating to Xcode 8, Swift 2.3, and SnapKit 0.22.0 we've been having an issue with removing constraints. We have a UIView that we need to change constraints for. Regardless if we are using:

    view.snp_removeConstraints()
     view.snp_makeConstraints { (make) in
        ...
    }
    

    or:

    view.snp_remakeConstraints { (make) in
        ...
    }
    

    It always crashes when trying to remove the constraints. The crash happens in Constraint.swift in uninstallFromView(). The crash occurs in the following block of code:

    // remove the constraints from the UIView's storage
    #if SNAPKIT_DEPLOYMENT_LEGACY && !os(OSX)
    if #available(iOS 8.0, *) {
        NSLayoutConstraint.deactivateConstraints(installedLayoutConstraints)
    } else if let installedOnView = installInfo.view {
        installedOnView.removeConstraints(installedLayoutConstraints)
    }
    #else
        NSLayoutConstraint.deactivateConstraints(installedLayoutConstraints) // < -- *** This line ***
    #endif
    

    Is this an issue in the iOS SDK or perhaps an issue in SnapKit? Any help would be appreciated.

    need info 
    opened by SlayterDev 15
  • remakeConstraints will crash

    remakeConstraints will crash

    New Issue Checklist

    🚫 If this template is not filled out your issue will be closed with no comment. 🚫

    • [ ] I have looked at the Documentation
    • [ ] I have read the F.A.Q.
    • [ ] I have filled out this issue template.

    Issue Info

    Info | Value | -------------------------|-------------------------------------| Platform | e.g. ios/osx/tvos Platform Version | e.g. 8.0 SnapKit Version | e.g. 0.19.0 Integration Method | e.g. carthage/cocoapods/manually

    Issue Description

    Crashed: com.apple.main-thread 0 CoreAutoLayout 0x6404 AddVarToSortedPriorityVectorList + 68 1 CoreAutoLayout 0x10020 -[NSISObjectiveLinearExpression addVar:priority:times:processVarNewToReceiver:processVarDroppedFromReceiver:] + 240 2 CoreAutoLayout 0x10690 NSISLinExpEnumerateVarsAndCoefficients + 92 3 CoreAutoLayout 0xf720 -[NSISObjectiveLinearExpression addExpression:priority:times:processVarNewToReceiver:processVarDroppedFromReceiver:] + 144 4 CoreAutoLayout 0x8db8 -[NSISEngine tryUsingArtificialVariableToAddConstraintWithMarker:row:usingInfeasibilityHandlingBehavior:mutuallyExclusiveConstraints:] + 204 5 CoreAutoLayout 0xd96c -[NSISEngine _tryToAddConstraintWithMarkerEngineVar:row:mutuallyExclusiveConstraints:] + 388 6 CoreAutoLayout 0x7f7c -[NSISEngine tryToAddConstraintWithMarker:expression:mutuallyExclusiveConstraints:] + 668 7 CoreAutoLayout 0x7be4 -[NSLayoutConstraint _addLoweredExpression:toEngine:lastLoweredConstantWasRounded:mutuallyExclusiveConstraints:] + 232 8 CoreAutoLayout 0x21e8 -[NSLayoutConstraint _addToEngine:mutuallyExclusiveConstraints:] + 148 9 UIKitCore 0x56838 -[UIView _layoutEngine_didAddLayoutConstraint:roundingAdjustment:mutuallyExclusiveConstraints:] + 520 10 UIKitCore 0x3bb80 -[UIView _tryToAddConstraint:roundingAdjustment:mutuallyExclusiveConstraints:] + 156 11 UIKitCore 0x585d8 -[UIView(UIConstraintBasedLayout) nsli_addConstraint:] + 72 12 CoreAutoLayout 0x6304 __55+[NSLayoutConstraint _addOrRemoveConstraints:activate:]_block_invoke + 36 13 CoreAutoLayout 0x55d8 -[NSISEngine withBehaviors:performModifications:] + 76 14 CoreAutoLayout 0x23cc +[NSLayoutConstraint _addOrRemoveConstraints:activate:] + 264 15 mxz_ios 0xde0cc4 specialized static ConstraintMaker.makeConstraints(item:closure:) + 4384869572

    opened by dark155 0
  • SnapKit Crash in iOS 16.1

    SnapKit Crash in iOS 16.1

    libobjc.A.dylib objc_release + 8 1 CoreAutoLayout 0x00000001efda0000 + 46480 2

    _$sSo18NSLayoutConstraintC4item9attribute9relatedBy6toItemAD10multiplier8constantAByp_So0A9AttributeVSo0A8RelationVypSgAJ12CoreGraphics7CGFloatVAPtcfCTO + 340 3 _$s7SnapKit10ConstraintC4from2to8relation14sourceLocation5label10multiplier8constant8priorityAcA0C4ItemC_AmA0C8RelationOSS_SutSSSgAA0C16MultiplierTarget_pAA0c8ConstantP0_pAA0c8PriorityP0_ptcfc + 1024 4

    $s7SnapKit21ConstraintDescriptionC10constraintAA0C0CSgvgAGyXEfU + 376 5

    _$s7SnapKit21ConstraintDescriptionC10constraintAA0C0CSgvg + 40 6

    _$s7SnapKit15ConstraintMakerC18prepareConstraints4item7closureSayAA0C0CGAA06LayoutC4Item_p_yACXEtFZTf4enn_nSo6UIViewC_Tg5 + 264 7

    _$s7SnapKit15ConstraintMakerC15makeConstraints4item7closureyAA06LayoutC4Item_p_yACXEtFZTf4enn_nSo13UILayoutGuideC_Tg5Tm + 24

    opened by LeeZhe 13
  • Trailing wont change UITextField left-to-right for Arabic text

    Trailing wont change UITextField left-to-right for Arabic text

    New Issue Checklist

    🚫 If this template is not filled out your issue will be closed with no comment. 🚫

    • [x] I have looked at the Documentation
    • [x] I have read the F.A.Q.
    • [x] I have filled out this issue template.

    Issue Info

    Info | Value | -------------------------|-------------------------------------| Platform | ios Platform Version | 15.5 SnapKit Version | 5.0.0 Integration Method | cocoapods

    Issue Description

    I have a problem when using left to right (arabic) view. If i put trailing on UITextField, arabic text is starting from left side. If i remove trailing, then it's changing to left-to-right

    Screen Shot 2022-07-08 at 22 09 10 PM
    	textField.snp.makeConstraints { (make) in
    	    make.leading.equalTo(imageView.snp.trailing).offset(Margins.standard)
    	    make.trailing.equalToSuperview().inset(Margins.big)
                make.top.equalToSuperview().offset(40.0)
    	    make.bottom.equalTo(separatorView.snp.top).offset(-Margins.tiny)
    	}
    
            imageView.snp.makeConstraints { (make) in
                make.leading.equalToSuperview().offset(Margins.big)
                make.height.width.equalTo(Constants.imageSize)
                make.bottom.equalTo(textField).offset(-Margins.small)
            }
            
            separatorView.snp.makeConstraints { (make) in
                make.bottom.equalToSuperview()
                make.leading.equalTo(imageView.snp.trailing).offset(Margins.standard)
                make.trailing.equalTo(textField.snp.trailing)
                make.height.equalTo(1)
            }
    
    opened by nikolafamit 1
  • Why is it not allowed to update required priority?

    Why is it not allowed to update required priority?

    New Issue Checklist

    🚫 If this template is not filled out your issue will be closed with no comment. 🚫

    • [x] I have looked at the Documentation
    • [x] I have read the F.A.Q.
    • [x] I have filled out this issue template.

    Issue Info

    Info | Value | -------------------------|-------------------------------------| Platform | e.g. ios Platform Version | e.g. 15.0 SnapKit Version | e.g. 5.6

    Issue Description

    I try to update a required priority, but it fails, then I see code like this, why is it not allowed to update required priority?

    https://github.com/SnapKit/SnapKit/blob/07c5d1f6044701d97e94dc11157259e8811977be/Sources/Constraint.swift#L298

    opened by i-tengfei 0
  • Unable to get live preview working in SwiftUI due to SnapKit

    Unable to get live preview working in SwiftUI due to SnapKit

    New Issue Checklist

    🚫 If this template is not filled out your issue will be closed with no comment. 🚫

    • [x] I have looked at the Documentation
    • [x] I have read the F.A.Q.
    • [x] I have filled out this issue template.

    Issue Info

    Info | Value | -------------------------|-------------------------------------| Platform | ios Platform Version | 15.2 SnapKit Version | 5.6.0 Integration Method | cocoapods

    Issue Description

    I'm working on a large project that has used SnapKit extensively, however for new features we want to use SwiftUI and we cannot migrate the whole project at once so the project has to have both. The issue I'm having is when I try to render a live preview of a SwiftUI View I get a build error related to SnapKit:

    CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler (in target 'SnapKit' from project 'Pods')
        cd /Users/brojas/Developer/foursquare-iphone/Pods
        export DEVELOPER_DIR\=/Applications/Xcode.app/Contents/Developer
        export SDKROOT\=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk
        /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc -incremental -module-name SnapKit -Onone -enable-batch-mode -enforce-exclusivity\=checked @/Users/brojas/Library/Developer/Xcode/DerivedData/Foursquare-cffnoxgfnmuuucaqgyjuyyghuijd/Build/Intermediates.noindex/Previews/batman-development-unsafe/Intermediates.noindex/Pods.build/Debug-iphonesimulator/SnapKit.build/Objects-normal/x86_64/SnapKit.SwiftFileList -DDEBUG -D COCOAPODS -suppress-warnings -sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk -target x86_64-apple-ios10.0-simulator -g -module-cache-path /Users/brojas/Library/Developer/Xcode/DerivedData/ModuleCache.noindex -Xfrontend -serialize-debugging-options -enable-testing -index-store-path /Users/brojas/Library/Developer/Xcode/DerivedData/Foursquare-cffnoxgfnmuuucaqgyjuyyghuijd/Index/DataStore -swift-version 5 -I /Users/brojas/Library/Developer/Xcode/DerivedData/Foursquare-cffnoxgfnmuuucaqgyjuyyghuijd/Build/Intermediates.noindex/Previews/batman-development-unsafe/Products/Debug-iphonesimulator/SnapKit -F /Users/brojas/Library/Developer/Xcode/DerivedData/Foursquare-cffnoxgfnmuuucaqgyjuyyghuijd/Build/Intermediates.noindex/Previews/batman-development-unsafe/Products/Debug-iphonesimulator/SnapKit -c -j12 -output-file-map /Users/brojas/Library/Developer/Xcode/DerivedData/Foursquare-cffnoxgfnmuuucaqgyjuyyghuijd/Build/Intermediates.noindex/Previews/batman-development-unsafe/Intermediates.noindex/Pods.build/Debug-iphonesimulator/SnapKit.build/Objects-normal/x86_64/SnapKit-OutputFileMap.json -parseable-output -serialize-diagnostics -emit-dependencies -emit-module -emit-module-path /Users/brojas/Library/Developer/Xcode/DerivedData/Foursquare-cffnoxgfnmuuucaqgyjuyyghuijd/Build/Intermediates.noindex/Previews/batman-development-unsafe/Intermediates.noindex/Pods.build/Debug-iphonesimulator/SnapKit.build/Objects-normal/x86_64/SnapKit.swiftmodule -Xcc -I/Users/brojas/Library/Developer/Xcode/DerivedData/Foursquare-cffnoxgfnmuuucaqgyjuyyghuijd/Build/Intermediates.noindex/Previews/batman-development-unsafe/Intermediates.noindex/Pods.build/Debug-iphonesimulator/SnapKit.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/brojas/Library/Developer/Xcode/DerivedData/Foursquare-cffnoxgfnmuuucaqgyjuyyghuijd/Build/Intermediates.noindex/Previews/batman-development-unsafe/Intermediates.noindex/Pods.build/Debug-iphonesimulator/SnapKit.build/SnapKit-generated-files.hmap -Xcc -I/Users/brojas/Library/Developer/Xcode/DerivedData/Foursquare-cffnoxgfnmuuucaqgyjuyyghuijd/Build/Intermediates.noindex/Previews/batman-development-unsafe/Intermediates.noindex/Pods.build/Debug-iphonesimulator/SnapKit.build/SnapKit-own-target-headers.hmap -Xcc -I/Users/brojas/Library/Developer/Xcode/DerivedData/Foursquare-cffnoxgfnmuuucaqgyjuyyghuijd/Build/Intermediates.noindex/Previews/batman-development-unsafe/Intermediates.noindex/Pods.build/Debug-iphonesimulator/SnapKit.build/SnapKit-all-non-framework-target-headers.hmap -Xcc -ivfsoverlay -Xcc /Users/brojas/Library/Developer/Xcode/DerivedData/Foursquare-cffnoxgfnmuuucaqgyjuyyghuijd/Build/Intermediates.noindex/Previews/batman-development-unsafe/Intermediates.noindex/Pods.build/Debug-iphonesimulator/SnapKit.build/all-product-headers.yaml -Xcc -iquote -Xcc /Users/brojas/Library/Developer/Xcode/DerivedData/Foursquare-cffnoxgfnmuuucaqgyjuyyghuijd/Build/Intermediates.noindex/Previews/batman-development-unsafe/Intermediates.noindex/Pods.build/Debug-iphonesimulator/SnapKit.build/SnapKit-project-headers.hmap -Xcc -I/Users/brojas/Library/Developer/Xcode/DerivedData/Foursquare-cffnoxgfnmuuucaqgyjuyyghuijd/Build/Intermediates.noindex/Previews/batman-development-unsafe/Products/Debug-iphonesimulator/SnapKit/include -Xcc -I/Users/brojas/Library/Developer/Xcode/DerivedData/Foursquare-cffnoxgfnmuuucaqgyjuyyghuijd/Build/Intermediates.noindex/Previews/batman-development-unsafe/Intermediates.noindex/Pods.build/Debug-iphonesimulator/SnapKit.build/DerivedSources-normal/x86_64 -Xcc -I/Users/brojas/Library/Developer/Xcode/DerivedData/Foursquare-cffnoxgfnmuuucaqgyjuyyghuijd/Build/Intermediates.noindex/Previews/batman-development-unsafe/Intermediates.noindex/Pods.build/Debug-iphonesimulator/SnapKit.build/DerivedSources/x86_64 -Xcc -I/Users/brojas/Library/Developer/Xcode/DerivedData/Foursquare-cffnoxgfnmuuucaqgyjuyyghuijd/Build/Intermediates.noindex/Previews/batman-development-unsafe/Intermediates.noindex/Pods.build/Debug-iphonesimulator/SnapKit.build/DerivedSources -Xcc -DPOD_CONFIGURATION_DEBUG\=1 -Xcc -DDEBUG\=1 -Xcc -DCOCOAPODS\=1 -emit-objc-header -emit-objc-header-path /Users/brojas/Library/Developer/Xcode/DerivedData/Foursquare-cffnoxgfnmuuucaqgyjuyyghuijd/Build/Intermediates.noindex/Previews/batman-development-unsafe/Intermediates.noindex/Pods.build/Debug-iphonesimulator/SnapKit.build/Objects-normal/x86_64/SnapKit-Swift.h -import-underlying-module -Xcc -ivfsoverlay -Xcc /Users/brojas/Library/Developer/Xcode/DerivedData/Foursquare-cffnoxgfnmuuucaqgyjuyyghuijd/Build/Intermediates.noindex/Previews/batman-development-unsafe/Intermediates.noindex/Pods.build/Debug-iphonesimulator/SnapKit.build/unextended-module-overlay.yaml -working-directory /Users/brojas/Developer/foursquare-iphone/Pods -Xfrontend -enable-implicit-dynamic -Xfrontend -enable-private-imports -Xfrontend -enable-dynamic-replacement-chaining -Xfrontend -disable-previous-implementation-calls-in-dynamic-replacements
    
    Command CompileSwiftSources failed with a nonzero exit code
    

    There's not a whole lot of info in this error message but any ideas? Or at least any suggestions so I can investigate this further. Thanks!

    opened by marchinram 1
Releases(5.6.0)
  • 5.6.0(Apr 13, 2022)

  • 5.0.1(Aug 5, 2019)

    • Fixes a regression caused by #574
    • Adds Playground #608 (thanks to @ShivaHuang)
    • Updates SwiftPM support #615 (thanks to @maxxfrazer)
    • Adds .directionalEdges and .directionalMargins #595 (thanks to @jctrouble)
    • Make ConstraintViewDSL content priorities non mutational #586 (thanks to @nekrich)
    Source code(tar.gz)
    Source code(zip)
  • 5.0.0(Apr 23, 2019)

  • 4.2.0(Oct 22, 2018)

  • 4.0.1(Sep 18, 2018)

  • 4.0.0(Sep 17, 2017)

    This is a compatibility release to target Swift 4 and Xcode 9. It contains no new features only syntax changes required for Swift 4 and Xcode 9!

    Source code(tar.gz)
    Source code(zip)
  • 3.2.0(Feb 11, 2017)

    • Added isActive to Constraint so you can see if there are any active NSLayoutConstraint's that are currently active as a result of the backing constraint.
    • Made Constraint layoutConstraints public again so you can publicly access the layout constraints. Use with caution as SnapKit expects ownership of these.
    • Fixed bug with contentCompressionResistanceHorizontalPriority (#387)
    • Fixed missing topMargin with contentCompressionResistanceHorizontalPriority (#393)
    • Added more robust priority support (#345)
    Source code(tar.gz)
    Source code(zip)
  • 3.1.2(Oct 7, 2016)

    ConstraintMaker for UILayoutGuide's

    • You can now use a UILayoutGuide/NSLayoutGuide much like a UIView with the familiar makeConstraints, remakeConstraints, updateConstraints, and removeConstraints API.

    Bug Fixes

    • Fixed memory leaks and circular references
    Source code(tar.gz)
    Source code(zip)
  • 3.0.2(Oct 7, 2016)

    Bug Fixes

    • Fix Carthage build compatibility
    • Adds topMargin back in to ConstraintMaker
    • Adds equalToSuperview(), lessThanOrEqualToSuperview(), greaterThanOrEqualToSuperview()
    • Doing equalTo(CGPoint) ensures superview + offset from top left.
    Source code(tar.gz)
    Source code(zip)
  • 3.0.1(Sep 20, 2016)

    Breaking Changes

    • Debug labels must now use a function rather than a property. snp.label = "" is now snp.setLabel("")

    Bug Fixes

    • Fixed small memory leaks on all constraints #310
    • Fixed macOS bug preventing make.edges.equalTo(other.snp.edges) #309
    • Fixed bug preventing debug labels from being set. You must now use setLabel() #313
    • Fixed incorrect constant values when using leading/trailing and UIEdgeInsets #316
    Source code(tar.gz)
    Source code(zip)
  • 3.0.0(Sep 20, 2016)

    SnapKit 3.0 is a complete re-write to take advantage of modern Swift 3.0 as well as clean up the API. As such please use with caution and check your apps thoroughly

    Breaking

    • iOS 7.0 support has been removed
    • install and uninstall have been deprecated, use activate and deactivate instead
    • DSL is now accessed through .snp.* rather than .snp_*. For example view.snp.makeConstraints { }
    • Constraints are now updated through update(offset:), update(inset:) and update(priority:)
    • .inset() will no longer take CGPoint or CGSize as input
    • .offset() will no longer take CGPoint, CGSize, EdgeInsets as input
    • updateConstraints will no longer allow creating new constraints unless there are no existing constraints for the view. If it does generate new constraints it will throw a fatal error.
    • UIEdgeInsets are now have their right and bottom value inverted for more natural results such as make.edges.equalTo(UIEdgeInsets(top: 10, left: 10, bottom: 10, right: 10)).inset()

    Enhancements

    • Debugging output has been improved to show exact file/line number from which the broken constraint was created
    • Exceptions thrown during constraint creation have been replaced with fatalError with better output
    • Constraints are now installed through NSLayoutConstraint.activate and what view they are added to is now deferred to UIKit
    • Added var contentHugging<Axis>Priority: CGFloat to make
    • Added var contentCompressionResistance<Axis>Priority: CGFloat to make
    • Added support for UILayoutGuide via make.left.equalTo(guide.snp.top)
    • Added support for constraining edges to margins or vice versa via make.edges.equalTo(other.snp.margins)
    Source code(tar.gz)
    Source code(zip)
  • 0.22.0(Sep 20, 2016)

Tiny Swift DSL for Autolayout

SwiftAutoLayout SwiftAutoLayout is a tiny DSL for Autolayout intended to provide a more declarative way to express layout constraints. Here's a quick

Indragie Karunaratne 657 Sep 18, 2022
Powerful autolayout framework, that can manage UIView(NSView), CALayer and not rendered views. Not Apple Autolayout wrapper. Provides placeholders. Linux support.

CGLayout Powerful autolayout framework, that can manage UIView(NSView), CALayer and not rendered views. Has cross-hierarchy coordinate space. Implemen

Koryttsev Denis 45 Jun 28, 2022
AutoLayout Micro DSL SPM from Chris Eidhof's article

EasyAutoLayout Intro EasyAutoLayout is a small framework built using the ideas presented in the article called Autolayout Micro DSL by Chris Eidhof. I

Alexandre Garrefa 0 Nov 28, 2021
SwiftLayout - View hierarchy and autolayout DSL library

SwiftLayout view hierarchy and autolayout DSL library goal 뷰의 계층구조와 constraint 관

iOS Swifty Krew 104 Dec 28, 2022
An Impressive Auto Layout DSL for iOS, tvOS & OSX. & It is written in pure swift.

KVConstraintKit KVConstraintKit is a DSL to make easy & impressive Auto Layout constraints on iOS, tvOS & OSX with Swift Installation Using CocoaPods

Keshav Vishwkarma 90 Sep 1, 2022
Harness the power of AutoLayout NSLayoutConstraints with a simplified, chainable and expressive syntax. Supports iOS and OSX Auto Layout

Masonry Masonry is still actively maintained, we are committed to fixing bugs and merging good quality PRs from the wider community. However if you're

null 18k Jan 5, 2023
A AutoLayout Utility for iOS

QLayout is an Utility to make Auto Layout easy on iOS. Contents Requirements Installation Usage Credits License Requirements iOS 8.0+ Swift 3.0+ Insta

Jose Quintero 3 Nov 14, 2021
Swifty DSL for programmatic Auto Layout in iOS

WWLayout Easy to write auto layout constraints, with minimal extensions to standard namespaces. Feature Highlights Easy to use, readable API Backwards

WW Tech 49 Oct 2, 2022
A declarative Auto Layout DSL for Swift :iphone::triangular_ruler:

Cartography ?? ?? Using Cartography, you can set up your Auto Layout constraints in declarative code and without any stringly typing! In short, it all

Robb Böhnke 7.3k Jan 4, 2023
A compact but full-featured Auto Layout DSL for Swift

Mortar allows you to create Auto Layout constraints using concise, simple code statements. Use this: view1.m_right |=| view2.m_left - 12.0 Instead of:

Jason Fieldman 83 Jan 29, 2022
An awesome Swift CSS DSL library using result builders.

An awesome Swift CSS DSL library using result builders.

Binary Birds 57 Nov 21, 2022
A bit of steroids for AutoLayout, powered by Swift.

AutoLayoutPlus AutoLayoutPlus is a Swift library consisting in a set of extensions to help dealing with Auto Layout programatically. With AutoLayoutPl

Rui Costa 27 Jul 25, 2022
Yet Another Swift Auto Layout DSL

FormationLayout Documentation FormationLayout is the top level layout class for one root view. FormationLayout takes a UIView as its rootView. transla

Evan Liu 53 Mar 31, 2022
An extension that simplifies the work with Swift AutoLayout by writing cleaner, more natural and easy-reading code.

Installation For now you're able to clone repo in your project or download ZIP folder manually. git clone https://github.com/votehserxam/AutoLayout.gi

Max 3 Nov 8, 2022
Write concise Autolayout code

Winner of Hacking with Swift Recommended award You + Stevia = ?? ?? Write concise, readable layouts ?? Reduce your maintenance time ?? Compose your st

Fresh 3.3k Jan 6, 2023
📱AutoLayout can be set differently for each device

DeviceLayout DeviceLayout is a Swift framework that lets you set Auto Layout constraints's differently for each device Using only IBInspector of Xcode

Cruz 171 Oct 11, 2022
An easier and faster way to code Autolayout

EZAnchor 中文介绍 An easier way to code Autolayout Are you annoyed of coding .active = true while using Autolayout Anchors over and over again? Are you an

Alex.Liu 25 Feb 20, 2022
The fast path to autolayout views in code

NorthLayout The fast path to autolayout views in code Talks https://speakerdeck.com/banjun/auto-layout-with-an-extended-visual-format-language at AltC

banjun 36 Jul 15, 2022
🏗 MondrianLayout - describing structured layout for AutoLayout

?? A DSL based layout builder for AutoLayout

Muukii 155 Dec 10, 2022