Repository: SnapKit/SnapKit
File: Tests/SnapKitTests/Tests.swift (Swift)

Code before:
    
    func testEdgesToEdges() {
        var fromAttributes = Set<LayoutAttribute>()
        var toAttributes = Set<LayoutAttribute>()
        
        let view = View()
        self.container.addSubview(view)
        
        view.snp.remakeConstraints { (make) -> Void in
            make.edges.equalTo(self.container.snp.edges)
        }
        
        XCTAssertEqual(self.container.snp_constraints.count, 4, "Should have 4 constraints")
        
        for constraint in (container.snp_constraints as! [NSLayoutConstraint]) {
            fromAttributes.insert(constraint.firstAttribute)
            toAttributes.insert(constraint.secondAttribute)
        }
        
        XCTAssert(fromAttributes == [.top, .left, .bottom, .right])
        XCTAssert(toAttributes == [.top, .left, .bottom, .right])
    }
    
    #if os(iOS) || os(tvOS)
    func testEdgesToMargins() {
        var fromAttributes = Set<NSLayoutConstraint.Attribute>()
        var toAttributes = Set<NSLayoutConstraint.Attribute>()
        
        let view = View()
        self.container.addSubview(view)
        
        view.snp.remakeConstraints { (make) -> Void in
            make.edges.equalTo(self.container.snp.margins)
        }
        
        XCTAssertEqual(self.container.snp_constraints.count, 4, "Should have 4 constraints")
        
        for constraint in (container.snp_constraints as! [NSLayoutConstraint]) {
            fromAttributes.insert(constraint.firstAttribute)
            toAttributes.insert(constraint.secondAttribute)
        }
        
        XCTAssert(fromAttributes == [.top, .left, .bottom, .right])
        XCTAssert(toAttributes == [.topMargin, .leftMargin, .bottomMargin, .rightMargin])
        
        fromAttributes.removeAll()
        toAttributes.removeAll()
        
        view.snp.remakeConstraints { (make) -> Void in
            make.margins.equalTo(self.container.snp.edges)
        }

Review comment (suggestion):
I think you can just use `LayoutAttribute` instead: https://github.com/SnapKit/SnapKit/blob/15beb5221834e220f099a87beb80cc9d9abb16cf/Source/Typealiases.swift#L33

Otherwise you'd break support for Swift 4 IMO

Code after:
    
    func testEdgesToEdges() {
        var fromAttributes = Set<LayoutAttribute>()
        var toAttributes = Set<LayoutAttribute>()
        
        let view = View()
        self.container.addSubview(view)
        
        view.snp.remakeConstraints { (make) -> Void in
            make.edges.equalTo(self.container.snp.edges)
        }
        
        XCTAssertEqual(self.container.snp_constraints.count, 4, "Should have 4 constraints")
        
        for constraint in (container.snp_constraints as! [NSLayoutConstraint]) {
            fromAttributes.insert(constraint.firstAttribute)
            toAttributes.insert(constraint.secondAttribute)
        }
        
        XCTAssert(fromAttributes == [.top, .left, .bottom, .right])
        XCTAssert(toAttributes == [.top, .left, .bottom, .right])
    }
    
    #if os(iOS) || os(tvOS)
    func testEdgesToMargins() {
        var fromAttributes = Set<LayoutAttribute>()
        var toAttributes = Set<LayoutAttribute>()
        
        let view = View()
        self.container.addSubview(view)
        
        view.snp.remakeConstraints { (make) -> Void in
            make.edges.equalTo(self.container.snp.margins)
        }
        
        XCTAssertEqual(self.container.snp_constraints.count, 4, "Should have 4 constraints")
        
        for constraint in (container.snp_constraints as! [NSLayoutConstraint]) {
            fromAttributes.insert(constraint.firstAttribute)
            toAttributes.insert(constraint.secondAttribute)
        }
        
        XCTAssert(fromAttributes == [.top, .left, .bottom, .right])
        XCTAssert(toAttributes == [.topMargin, .leftMargin, .bottomMargin, .rightMargin])
        
        fromAttributes.removeAll()
        toAttributes.removeAll()
        
        view.snp.remakeConstraints { (make) -> Void in
            make.margins.equalTo(self.container.snp.edges)
        }