3

How to add Snapkit in xcode manually without using cocoapods or carthage ?

Koustov Basu
  • 82
  • 13
  • What are your reasoning for deciding against using cocoapods or Carthage for dependency management? Just curious, as cocoa pods and Carthage makes it easier to update, maintain your dependencies, and you can even set a dependency to a fixed version, as I think might be the reasoning for you? :) – T. Hyldgaard Feb 12 '18 at 12:38

1 Answers1

4

Download project from repo or you can download only source file.

Then drag and drop that source file into your project.

And you are good to go.

Check example code which is given into their repo.

import UIKit

class ViewController: UIViewController {

    lazy var box = UIView()

    override func viewDidLoad() {
        super.viewDidLoad()

        self.view.addSubview(box)
        box.snp.makeConstraints { (make) -> Void in
            make.width.height.equalTo(50)
            make.center.equalTo(self.view)
        }
    }
}

And its running without and errors:

enter image description here

Note: You don't need to import SnapKit if you are adding it manually.

Check complete project HERE.

Dharmesh Kheni
  • 71,228
  • 33
  • 160
  • 165