diff --git a/Example/Tests/UIButtonBuilderTests.swift b/Example/Tests/UIButtonBuilderTests.swift index f85b6ce..d7468da 100644 --- a/Example/Tests/UIButtonBuilderTests.swift +++ b/Example/Tests/UIButtonBuilderTests.swift @@ -240,6 +240,14 @@ class UIButtonBuilderTests: XCTestCase { XCTAssertEqual(button.titleLabel?.font, font) } + + func testTranslatesAutoresizingMaskIntoConstraints() { + let button = UIButtonBuilder() + .translatesAutoresizingMaskIntoConstraints(true) + .build() + + XCTAssertTrue(button.translatesAutoresizingMaskIntoConstraints) + } } // MARK: - Custom UIButton diff --git a/Example/Tests/UICollectionViewBuilderTests.swift b/Example/Tests/UICollectionViewBuilderTests.swift index 6fa7556..338d07d 100644 --- a/Example/Tests/UICollectionViewBuilderTests.swift +++ b/Example/Tests/UICollectionViewBuilderTests.swift @@ -271,5 +271,13 @@ class UICollectionViewBuilderTests: XCTestCase { XCTAssertEqual(tintColor, collectionView.tintColor) } + + func testTranslatesAutoresizingMaskIntoConstraints() { + let collectionView = UICollectionViewBuilder() + .translatesAutoresizingMaskIntoConstraints(true) + .build() + + XCTAssertTrue(collectionView.translatesAutoresizingMaskIntoConstraints) + } } diff --git a/Example/Tests/UIImageViewBuilderTests.swift b/Example/Tests/UIImageViewBuilderTests.swift index 7a19b54..cb00ea4 100644 --- a/Example/Tests/UIImageViewBuilderTests.swift +++ b/Example/Tests/UIImageViewBuilderTests.swift @@ -171,4 +171,12 @@ class UIImageViewBuilderTests: XCTestCase { XCTAssertEqual(heightConstraint.constant, size.height) } + func testTranslatesAutoresizingMaskIntoConstraints() { + let imageView = UIImageViewBuilder() + .translatesAutoresizingMaskIntoConstraints(true) + .build() + + XCTAssertTrue(imageView.translatesAutoresizingMaskIntoConstraints) + } + } diff --git a/Example/Tests/UILabelBuilderTests.swift b/Example/Tests/UILabelBuilderTests.swift index 7080231..dfba8de 100644 --- a/Example/Tests/UILabelBuilderTests.swift +++ b/Example/Tests/UILabelBuilderTests.swift @@ -209,4 +209,12 @@ class UILabelBuilderTests: XCTestCase { XCTAssertEqual(label.accessibilityIdentifier, accessibilityIdentifier) } + func testTranslatesAutoresizingMaskIntoConstraints() { + let label = UILabelBuilder() + .translatesAutoresizingMaskIntoConstraints(true) + .build() + + XCTAssertTrue(label.translatesAutoresizingMaskIntoConstraints) + } + } diff --git a/Example/Tests/UIScrollViewBuilderTests.swift b/Example/Tests/UIScrollViewBuilderTests.swift index 4d8ec04..547fa6f 100644 --- a/Example/Tests/UIScrollViewBuilderTests.swift +++ b/Example/Tests/UIScrollViewBuilderTests.swift @@ -146,4 +146,12 @@ class UIScrollViewBuilderTests: XCTestCase { XCTAssertEqual(scrollView.accessibilityIdentifier, accessibilityIdentifier) } + + func testTranslatesAutoresizingMaskIntoConstraints() { + let scrollView = UIScrollViewBuilder() + .translatesAutoresizingMaskIntoConstraints(true) + .build() + + XCTAssertTrue(scrollView.translatesAutoresizingMaskIntoConstraints) + } } diff --git a/Example/Tests/UIStackViewBuilderTests.swift b/Example/Tests/UIStackViewBuilderTests.swift index 69d5ed4..f0ef4eb 100644 --- a/Example/Tests/UIStackViewBuilderTests.swift +++ b/Example/Tests/UIStackViewBuilderTests.swift @@ -115,4 +115,12 @@ class UIStackViewBuilderTests: XCTestCase { XCTAssertTrue(stackView.clipsToBounds) } + + func testTranslatesAutoresizingMaskIntoConstraints() { + let stackView = UIStackViewBuilder() + .translatesAutoresizingMaskIntoConstraints(true) + .build() + + XCTAssertTrue(stackView.translatesAutoresizingMaskIntoConstraints) + } } diff --git a/Example/Tests/UITableViewBuilderTests.swift b/Example/Tests/UITableViewBuilderTests.swift index c02403a..79b03de 100644 --- a/Example/Tests/UITableViewBuilderTests.swift +++ b/Example/Tests/UITableViewBuilderTests.swift @@ -203,4 +203,12 @@ class UITableViewBuilderTests: XCTestCase { } XCTAssertTrue(isContainsIdentifier) } + + func testTranslatesAutoresizingMaskIntoConstraints() { + let tableView = UITableViewBuilder() + .translatesAutoresizingMaskIntoConstraints(true) + .build() + + XCTAssertTrue(tableView.translatesAutoresizingMaskIntoConstraints) + } } diff --git a/Example/Tests/UITextFieldBuilderTests.swift b/Example/Tests/UITextFieldBuilderTests.swift index 1713f51..35049a6 100644 --- a/Example/Tests/UITextFieldBuilderTests.swift +++ b/Example/Tests/UITextFieldBuilderTests.swift @@ -212,4 +212,12 @@ class UITextFieldBuilderTests: XCTestCase { XCTAssertEqual(textField.autocapitalizationType, autocapitalizationType) } + + func testTranslatesAutoresizingMaskIntoConstraints() { + let textField = UITextFieldBuilder() + .translatesAutoresizingMaskIntoConstraints(true) + .build() + + XCTAssertTrue(textField.translatesAutoresizingMaskIntoConstraints) + } } diff --git a/Example/Tests/UITextViewBuilderTests.swift b/Example/Tests/UITextViewBuilderTests.swift index 29ee905..7cd326a 100644 --- a/Example/Tests/UITextViewBuilderTests.swift +++ b/Example/Tests/UITextViewBuilderTests.swift @@ -189,4 +189,11 @@ class UITextViewBuilderTests: XCTestCase { XCTAssertEqual(textView.accessibilityIdentifier, accessibilityIdentifier) } + func testTranslatesAutoresizingMaskIntoConstraints() { + let textView = UITextViewBuilder() + .translatesAutoresizingMaskIntoConstraints(true) + .build() + + XCTAssertTrue(textView.translatesAutoresizingMaskIntoConstraints) + } } diff --git a/Example/Tests/UIViewBuilderTests.swift b/Example/Tests/UIViewBuilderTests.swift index efaadd6..fc85c6e 100644 --- a/Example/Tests/UIViewBuilderTests.swift +++ b/Example/Tests/UIViewBuilderTests.swift @@ -149,4 +149,12 @@ class UIViewBuilderTests: XCTestCase { XCTAssertEqual(view.accessibilityIdentifier, accessibilityIdentifier) } + func testTranslatesAutoresizingMaskIntoConstraints() { + let view = UIViewBuilder() + .translatesAutoresizingMaskIntoConstraints(true) + .build() + + XCTAssertTrue(view.translatesAutoresizingMaskIntoConstraints) + } + } diff --git a/MobilliumBuilders.podspec b/MobilliumBuilders.podspec index 48c02aa..a736146 100644 --- a/MobilliumBuilders.podspec +++ b/MobilliumBuilders.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'MobilliumBuilders' - s.version = '1.5.0' + s.version = '1.6.0' s.summary = 'Builders classes' s.homepage = 'https://github.com/mobillium/MobilliumBuilders' diff --git a/Sources/MobilliumBuilders/Classes/UIButtonBuilder.swift b/Sources/MobilliumBuilders/Classes/UIButtonBuilder.swift index 9fdf77e..3b2f901 100644 --- a/Sources/MobilliumBuilders/Classes/UIButtonBuilder.swift +++ b/Sources/MobilliumBuilders/Classes/UIButtonBuilder.swift @@ -165,6 +165,12 @@ public class UIButtonBuilder { return self } + @discardableResult + public func translatesAutoresizingMaskIntoConstraints(_ translatesAutoresizingMaskIntoConstraints: Bool = false) -> Self { + self.button.translatesAutoresizingMaskIntoConstraints = translatesAutoresizingMaskIntoConstraints + return self + } + public func build() -> T { return button } diff --git a/Sources/MobilliumBuilders/Classes/UICollectionViewBuilder.swift b/Sources/MobilliumBuilders/Classes/UICollectionViewBuilder.swift index 015cd3d..1f55293 100644 --- a/Sources/MobilliumBuilders/Classes/UICollectionViewBuilder.swift +++ b/Sources/MobilliumBuilders/Classes/UICollectionViewBuilder.swift @@ -126,7 +126,7 @@ public class UICollectionViewBuilder { self.collectionView.accessibilityIdentifier = accessibilityIdentifier return self } - + @discardableResult public func registerCell(_ cellType: C.Type, reuseIdentifier: String) -> Self { self.collectionView.register(cellType, forCellWithReuseIdentifier: reuseIdentifier) @@ -171,6 +171,12 @@ public class UICollectionViewBuilder { return self } + @discardableResult + public func translatesAutoresizingMaskIntoConstraints(_ translatesAutoresizingMaskIntoConstraints: Bool = false) -> Self { + self.collectionView.translatesAutoresizingMaskIntoConstraints = translatesAutoresizingMaskIntoConstraints + return self + } + public func build() -> T { return collectionView } diff --git a/Sources/MobilliumBuilders/Classes/UIImageViewBuilder.swift b/Sources/MobilliumBuilders/Classes/UIImageViewBuilder.swift index b8db989..f740f02 100644 --- a/Sources/MobilliumBuilders/Classes/UIImageViewBuilder.swift +++ b/Sources/MobilliumBuilders/Classes/UIImageViewBuilder.swift @@ -115,6 +115,12 @@ public class UIImageViewBuilder { return self } + @discardableResult + func translatesAutoresizingMaskIntoConstraints(_ translatesAutoresizingMaskIntoConstraints: Bool) -> Self { + self.imageView.translatesAutoresizingMaskIntoConstraints = translatesAutoresizingMaskIntoConstraints + return self + } + @discardableResult public func size(_ size: CGSize) -> Self { imageView.translatesAutoresizingMaskIntoConstraints = false diff --git a/Sources/MobilliumBuilders/Classes/UILabelBuilder.swift b/Sources/MobilliumBuilders/Classes/UILabelBuilder.swift index 14f79e3..ff2a1f9 100644 --- a/Sources/MobilliumBuilders/Classes/UILabelBuilder.swift +++ b/Sources/MobilliumBuilders/Classes/UILabelBuilder.swift @@ -145,6 +145,12 @@ public class UILabelBuilder { return self } + @discardableResult + func translatesAutoresizingMaskIntoConstraints(_ translatesAutoresizingMaskIntoConstraints: Bool) -> Self { + self.label.translatesAutoresizingMaskIntoConstraints = translatesAutoresizingMaskIntoConstraints + return self + } + public func build() -> T { return label } diff --git a/Sources/MobilliumBuilders/Classes/UIScrollViewBuilder.swift b/Sources/MobilliumBuilders/Classes/UIScrollViewBuilder.swift index daa814e..9b440be 100644 --- a/Sources/MobilliumBuilders/Classes/UIScrollViewBuilder.swift +++ b/Sources/MobilliumBuilders/Classes/UIScrollViewBuilder.swift @@ -110,6 +110,12 @@ public class UIScrollViewBuilder { return self } + @discardableResult + func translatesAutoresizingMaskIntoConstraints(_ translatesAutoresizingMaskIntoConstraints: Bool) -> Self { + self.scrollView.translatesAutoresizingMaskIntoConstraints = translatesAutoresizingMaskIntoConstraints + return self + } + public func build() -> T { return scrollView } diff --git a/Sources/MobilliumBuilders/Classes/UISliderBuilder.swift b/Sources/MobilliumBuilders/Classes/UISliderBuilder.swift index 2e3fcf5..f8c017e 100644 --- a/Sources/MobilliumBuilders/Classes/UISliderBuilder.swift +++ b/Sources/MobilliumBuilders/Classes/UISliderBuilder.swift @@ -97,6 +97,12 @@ public class UISliderBuilder { return self } + @discardableResult + func translatesAutoresizingMaskIntoConstraints(_ translatesAutoresizingMaskIntoConstraints: Bool) -> Self { + self.slider.translatesAutoresizingMaskIntoConstraints = translatesAutoresizingMaskIntoConstraints + return self + } + public func build() -> T { return slider } diff --git a/Sources/MobilliumBuilders/Classes/UIStackViewBuilder.swift b/Sources/MobilliumBuilders/Classes/UIStackViewBuilder.swift index f300622..85d5760 100644 --- a/Sources/MobilliumBuilders/Classes/UIStackViewBuilder.swift +++ b/Sources/MobilliumBuilders/Classes/UIStackViewBuilder.swift @@ -80,6 +80,12 @@ public class UIStackViewBuilder { return self } + @discardableResult + func translatesAutoresizingMaskIntoConstraints(_ translatesAutoresizingMaskIntoConstraints: Bool) -> Self { + self.stackView.translatesAutoresizingMaskIntoConstraints = translatesAutoresizingMaskIntoConstraints + return self + } + public func build() -> T { return stackView } diff --git a/Sources/MobilliumBuilders/Classes/UITableViewBuilder.swift b/Sources/MobilliumBuilders/Classes/UITableViewBuilder.swift index a713ea8..c1649da 100644 --- a/Sources/MobilliumBuilders/Classes/UITableViewBuilder.swift +++ b/Sources/MobilliumBuilders/Classes/UITableViewBuilder.swift @@ -134,7 +134,13 @@ public class UITableViewBuilder { self.tableView.register(cellType, forCellReuseIdentifier: reuseIdentifier) return self } - + + @discardableResult + func translatesAutoresizingMaskIntoConstraints(_ translatesAutoresizingMaskIntoConstraints: Bool) -> Self { + self.tableView.translatesAutoresizingMaskIntoConstraints = translatesAutoresizingMaskIntoConstraints + return self + } + public func build() -> T { return tableView } diff --git a/Sources/MobilliumBuilders/Classes/UITextFieldBuilder.swift b/Sources/MobilliumBuilders/Classes/UITextFieldBuilder.swift index d462d92..3e924db 100644 --- a/Sources/MobilliumBuilders/Classes/UITextFieldBuilder.swift +++ b/Sources/MobilliumBuilders/Classes/UITextFieldBuilder.swift @@ -147,6 +147,12 @@ public class UITextFieldBuilder { return self } + @discardableResult + func translatesAutoresizingMaskIntoConstraints(_ translatesAutoresizingMaskIntoConstraints: Bool) -> Self { + self.textField.translatesAutoresizingMaskIntoConstraints = translatesAutoresizingMaskIntoConstraints + return self + } + public func build() -> T { return textField } diff --git a/Sources/MobilliumBuilders/Classes/UITextViewBuilder.swift b/Sources/MobilliumBuilders/Classes/UITextViewBuilder.swift index b53f0d6..3cd1c90 100644 --- a/Sources/MobilliumBuilders/Classes/UITextViewBuilder.swift +++ b/Sources/MobilliumBuilders/Classes/UITextViewBuilder.swift @@ -133,6 +133,12 @@ public class UITextViewBuilder { return self } + @discardableResult + func translatesAutoresizingMaskIntoConstraints(_ translatesAutoresizingMaskIntoConstraints: Bool) -> Self { + self.textView.translatesAutoresizingMaskIntoConstraints = translatesAutoresizingMaskIntoConstraints + return self + } + public func build() -> T { return textView } diff --git a/Sources/MobilliumBuilders/Classes/UIViewBuilder.swift b/Sources/MobilliumBuilders/Classes/UIViewBuilder.swift index 53084c5..0c248ac 100644 --- a/Sources/MobilliumBuilders/Classes/UIViewBuilder.swift +++ b/Sources/MobilliumBuilders/Classes/UIViewBuilder.swift @@ -109,6 +109,12 @@ public class UIViewBuilder { return self } + @discardableResult + func translatesAutoresizingMaskIntoConstraints(_ translatesAutoresizingMaskIntoConstraints: Bool) -> Self { + self.view.translatesAutoresizingMaskIntoConstraints = translatesAutoresizingMaskIntoConstraints + return self + } + public func build() -> T { return view }