Skip to content

Commit

Permalink
Add translatesAutoresizingMaskIntoConstraints func
Browse files Browse the repository at this point in the history
  • Loading branch information
Ali Ozan CILGA committed Aug 22, 2023
1 parent c1a4fe5 commit 58309fd
Show file tree
Hide file tree
Showing 12 changed files with 69 additions and 3 deletions.
2 changes: 1 addition & 1 deletion MobilliumBuilders.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'MobilliumBuilders'
s.version = '1.5.0'
s.version = '1.5.1'
s.summary = 'Builders classes'

s.homepage = 'https://github.com/mobillium/MobilliumBuilders'
Expand Down
6 changes: 6 additions & 0 deletions Sources/MobilliumBuilders/Classes/UIButtonBuilder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,12 @@ public class UIButtonBuilder<T: UIButton> {
return self
}

@discardableResult
public func translatesAutoresizingMaskIntoConstraints(_ translatesAutoresizingMaskIntoConstraints: Bool = false) -> Self {
self.button.translatesAutoresizingMaskIntoConstraints = translatesAutoresizingMaskIntoConstraints
return self
}

public func build() -> T {
return button
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public class UICollectionViewBuilder<T: UICollectionView> {
self.collectionView.accessibilityIdentifier = accessibilityIdentifier
return self
}

@discardableResult
public func registerCell<C: UICollectionViewCell>(_ cellType: C.Type, reuseIdentifier: String) -> Self {
self.collectionView.register(cellType, forCellWithReuseIdentifier: reuseIdentifier)
Expand Down Expand Up @@ -171,6 +171,12 @@ public class UICollectionViewBuilder<T: UICollectionView> {
return self
}

@discardableResult
public func translatesAutoresizingMaskIntoConstraints(_ translatesAutoresizingMaskIntoConstraints: Bool = false) -> Self {
self.collectionView.translatesAutoresizingMaskIntoConstraints = translatesAutoresizingMaskIntoConstraints
return self
}

public func build() -> T {
return collectionView
}
Expand Down
6 changes: 6 additions & 0 deletions Sources/MobilliumBuilders/Classes/UIImageViewBuilder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,12 @@ public class UIImageViewBuilder<T: UIImageView> {
return self
}

@discardableResult
func translatesAutoresizingMaskIntoConstraints(_ translatesAutoresizingMaskIntoConstraints: Bool) -> Self {
self.imageView.translatesAutoresizingMaskIntoConstraints = translatesAutoresizingMaskIntoConstraints
return self
}

@discardableResult
public func size(_ size: CGSize) -> Self {
imageView.translatesAutoresizingMaskIntoConstraints = false
Expand Down
6 changes: 6 additions & 0 deletions Sources/MobilliumBuilders/Classes/UILabelBuilder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,12 @@ public class UILabelBuilder<T: UILabel> {
return self
}

@discardableResult
func translatesAutoresizingMaskIntoConstraints(_ translatesAutoresizingMaskIntoConstraints: Bool) -> Self {
self.label.translatesAutoresizingMaskIntoConstraints = translatesAutoresizingMaskIntoConstraints
return self
}

public func build() -> T {
return label
}
Expand Down
6 changes: 6 additions & 0 deletions Sources/MobilliumBuilders/Classes/UIScrollViewBuilder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,12 @@ public class UIScrollViewBuilder<T: UIScrollView> {
return self
}

@discardableResult
func translatesAutoresizingMaskIntoConstraints(_ translatesAutoresizingMaskIntoConstraints: Bool) -> Self {
self.scrollView.translatesAutoresizingMaskIntoConstraints = translatesAutoresizingMaskIntoConstraints
return self
}

public func build() -> T {
return scrollView
}
Expand Down
6 changes: 6 additions & 0 deletions Sources/MobilliumBuilders/Classes/UISliderBuilder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,12 @@ public class UISliderBuilder<T: UISlider> {
return self
}

@discardableResult
func translatesAutoresizingMaskIntoConstraints(_ translatesAutoresizingMaskIntoConstraints: Bool) -> Self {
self.slider.translatesAutoresizingMaskIntoConstraints = translatesAutoresizingMaskIntoConstraints
return self
}

public func build() -> T {
return slider
}
Expand Down
6 changes: 6 additions & 0 deletions Sources/MobilliumBuilders/Classes/UIStackViewBuilder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@ public class UIStackViewBuilder<T: UIStackView> {
return self
}

@discardableResult
func translatesAutoresizingMaskIntoConstraints(_ translatesAutoresizingMaskIntoConstraints: Bool) -> Self {
self.stackView.translatesAutoresizingMaskIntoConstraints = translatesAutoresizingMaskIntoConstraints
return self
}

public func build() -> T {
return stackView
}
Expand Down
8 changes: 7 additions & 1 deletion Sources/MobilliumBuilders/Classes/UITableViewBuilder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,13 @@ public class UITableViewBuilder<T: UITableView> {
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
}
Expand Down
6 changes: 6 additions & 0 deletions Sources/MobilliumBuilders/Classes/UITextFieldBuilder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,12 @@ public class UITextFieldBuilder<T: UITextField> {
return self
}

@discardableResult
func translatesAutoresizingMaskIntoConstraints(_ translatesAutoresizingMaskIntoConstraints: Bool) -> Self {
self.textField.translatesAutoresizingMaskIntoConstraints = translatesAutoresizingMaskIntoConstraints
return self
}

public func build() -> T {
return textField
}
Expand Down
6 changes: 6 additions & 0 deletions Sources/MobilliumBuilders/Classes/UITextViewBuilder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,12 @@ public class UITextViewBuilder<T: UITextView> {
return self
}

@discardableResult
func translatesAutoresizingMaskIntoConstraints(_ translatesAutoresizingMaskIntoConstraints: Bool) -> Self {
self.textView.translatesAutoresizingMaskIntoConstraints = translatesAutoresizingMaskIntoConstraints
return self
}

public func build() -> T {
return textView
}
Expand Down
6 changes: 6 additions & 0 deletions Sources/MobilliumBuilders/Classes/UIViewBuilder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,12 @@ public class UIViewBuilder<T: UIView> {
return self
}

@discardableResult
func translatesAutoresizingMaskIntoConstraints(_ translatesAutoresizingMaskIntoConstraints: Bool) -> Self {
self.view.translatesAutoresizingMaskIntoConstraints = translatesAutoresizingMaskIntoConstraints
return self
}

public func build() -> T {
return view
}
Expand Down

0 comments on commit 58309fd

Please sign in to comment.