From 0ff97ceca6d27c0aa56b2b80c326569bb443a287 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=8E=E1=85=AC=E1=84=8C=E1=85=A5=E1=86=BC=E1=84=8B?= =?UTF-8?q?=E1=85=B5=E1=86=AB?= Date: Tue, 12 Nov 2024 13:53:05 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20Desgin=20System=20Layout=20=EA=B4=80?= =?UTF-8?q?=EB=A0=A8=20Extension=20discardableResult=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Sources/Common/Extension/UIView+.swift | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Presentation/Presentation/Sources/Common/Extension/UIView+.swift b/Presentation/Presentation/Sources/Common/Extension/UIView+.swift index 27648c4..c97cc01 100644 --- a/Presentation/Presentation/Sources/Common/Extension/UIView+.swift +++ b/Presentation/Presentation/Sources/Common/Extension/UIView+.swift @@ -8,12 +8,14 @@ import UIKit extension UIView { + @discardableResult func addToSuperview(_ superview: UIView) -> Self { superview.addSubview(self) self.translatesAutoresizingMaskIntoConstraints = false return self } + @discardableResult func top( equalTo anchor: NSLayoutYAxisAnchor, constant: CGFloat = 0, @@ -27,6 +29,7 @@ extension UIView { return self } + @discardableResult func top( equalTo anchor: NSLayoutYAxisAnchor, inset: CGFloat = 0, @@ -38,6 +41,7 @@ extension UIView { priority: priority) } + @discardableResult func bottom( equalTo anchor: NSLayoutYAxisAnchor, constant: CGFloat = 0, @@ -51,6 +55,7 @@ extension UIView { return self } + @discardableResult func bottom( equalTo anchor: NSLayoutYAxisAnchor, inset: CGFloat = 0, @@ -62,6 +67,7 @@ extension UIView { priority: priority) } + @discardableResult func leading( equalTo anchor: NSLayoutXAxisAnchor, constant: CGFloat = 0, @@ -75,6 +81,7 @@ extension UIView { return self } + @discardableResult func leading( equalTo anchor: NSLayoutXAxisAnchor, inset: CGFloat = 0, @@ -86,6 +93,7 @@ extension UIView { priority: priority) } + @discardableResult func trailing( equalTo anchor: NSLayoutXAxisAnchor, constant: CGFloat = 0, @@ -99,6 +107,7 @@ extension UIView { return self } + @discardableResult func trailing( equalTo anchor: NSLayoutXAxisAnchor, inset: CGFloat = 0, @@ -110,6 +119,7 @@ extension UIView { priority: priority) } + @discardableResult func width(equalTo constant: CGFloat, priority: UILayoutPriority = .required) -> Self { let constraint = self .widthAnchor @@ -119,6 +129,7 @@ extension UIView { return self } + @discardableResult func height(equalTo constant: CGFloat, priority: UILayoutPriority = .required) -> Self { let constraint = self .heightAnchor @@ -128,6 +139,7 @@ extension UIView { return self } + @discardableResult func size( width: CGFloat, height: CGFloat, @@ -138,6 +150,7 @@ extension UIView { .height(equalTo: height, priority: priority) } + @discardableResult func centerX( equalTo anchor: NSLayoutXAxisAnchor, constant: CGFloat = 0, @@ -151,6 +164,7 @@ extension UIView { return self } + @discardableResult func centerY( equalTo anchor: NSLayoutYAxisAnchor, constant: CGFloat = 0, @@ -164,12 +178,14 @@ extension UIView { return self } + @discardableResult func center(in view: UIView, priority: UILayoutPriority = .required) -> Self { return self .centerX(equalTo: view.centerXAnchor, priority: priority) .centerY(equalTo: view.centerYAnchor, priority: priority) } + @discardableResult func edges( equalTo view: UIView, inset: CGFloat = 0, @@ -194,6 +210,7 @@ extension UIView { priority: priority) } + @discardableResult func horizontalEdges( equalTo view: UIView, inset: CGFloat = 0, @@ -210,6 +227,7 @@ extension UIView { priority: priority) } + @discardableResult func verticalEdges( equalTo view: UIView, inset: CGFloat = 0,