feat: moved corner configuration to UIViewBorder
This commit is contained in:
parent
9cc412208c
commit
9d99d4e4e3
|
|
@ -33,8 +33,6 @@ extension UIButton {
|
|||
|
||||
public init(layout: Layout = .defaultLayout,
|
||||
backgroundColor: UIColor = .clear,
|
||||
roundedCorners: CACornerMask = [],
|
||||
cornerRadius: CGFloat = .zero,
|
||||
border: UIViewBorder = .init(),
|
||||
shadow: UIViewShadow? = nil,
|
||||
textAttributes: BaseTextAttributes? = nil,
|
||||
|
|
@ -49,8 +47,6 @@ extension UIButton {
|
|||
|
||||
super.init(layout: layout,
|
||||
backgroundColor: backgroundColor,
|
||||
roundedCorners: roundedCorners,
|
||||
cornerRadius: cornerRadius,
|
||||
border: border,
|
||||
shadow: shadow)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,8 +30,6 @@ extension UILabel {
|
|||
|
||||
public init(layout: Layout = .defaultLayout,
|
||||
backgroundColor: UIColor = .clear,
|
||||
roundedCorners: CACornerMask = [],
|
||||
cornerRadius: CGFloat = .zero,
|
||||
border: UIViewBorder = .init(),
|
||||
shadow: UIViewShadow? = nil,
|
||||
textAttributes: BaseTextAttributes? = nil) {
|
||||
|
|
@ -40,8 +38,6 @@ extension UILabel {
|
|||
|
||||
super.init(layout: layout,
|
||||
backgroundColor: backgroundColor,
|
||||
roundedCorners: roundedCorners,
|
||||
cornerRadius: cornerRadius,
|
||||
border: border,
|
||||
shadow: shadow)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,8 +27,8 @@ extension UIView {
|
|||
public func configureUIView(appearance: BaseAppearance<some ViewLayout>) {
|
||||
backgroundColor = appearance.backgroundColor
|
||||
layer.masksToBounds = true
|
||||
layer.maskedCorners = appearance.roundedCorners
|
||||
layer.cornerRadius = appearance.cornerRadius
|
||||
layer.maskedCorners = appearance.border.roundedCorners
|
||||
layer.cornerRadius = appearance.border.cornerRadius
|
||||
layer.borderWidth = appearance.border.width
|
||||
layer.borderColor = appearance.border.color.cgColor
|
||||
|
||||
|
|
|
|||
|
|
@ -95,22 +95,16 @@ extension UIView {
|
|||
public var layout: Layout
|
||||
|
||||
public var backgroundColor: UIColor
|
||||
public var roundedCorners: CACornerMask
|
||||
public var cornerRadius: CGFloat
|
||||
public var border: UIViewBorder
|
||||
public var shadow: UIViewShadow?
|
||||
|
||||
public init(layout: Layout = .defaultLayout,
|
||||
backgroundColor: UIColor = .clear,
|
||||
roundedCorners: CACornerMask = [],
|
||||
cornerRadius: CGFloat = .zero,
|
||||
border: UIViewBorder = .init(),
|
||||
shadow: UIViewShadow? = nil) {
|
||||
|
||||
self.layout = layout
|
||||
self.backgroundColor = backgroundColor
|
||||
self.roundedCorners = roundedCorners
|
||||
self.cornerRadius = cornerRadius
|
||||
self.border = border
|
||||
self.shadow = shadow
|
||||
}
|
||||
|
|
@ -131,8 +125,7 @@ extension UIView {
|
|||
|
||||
public init(layout: Layout = .defaultLayout,
|
||||
backgroundColor: UIColor = .clear,
|
||||
roundedCorners: CACornerMask = [],
|
||||
cornerRadius: CGFloat = .zero,
|
||||
border: UIViewBorder = .init(),
|
||||
shadow: UIViewShadow? = nil,
|
||||
subviewAppearance: SubviewAppearance = .defaultAppearance) {
|
||||
|
||||
|
|
@ -140,8 +133,7 @@ extension UIView {
|
|||
|
||||
super.init(layout: layout,
|
||||
backgroundColor: backgroundColor,
|
||||
roundedCorners: roundedCorners,
|
||||
cornerRadius: cornerRadius,
|
||||
border: border,
|
||||
shadow: shadow)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,8 +33,7 @@ open class BaseListItemAppearance<LeadingViewAppearance: WrappedViewAppearance,
|
|||
|
||||
public init(layout: UIView.DefaultWrappedLayout = .defaultLayout,
|
||||
backgroundColor: UIColor = .clear,
|
||||
roundedCorners: CACornerMask = [],
|
||||
cornerRadius: CGFloat = .zero,
|
||||
border: UIViewBorder = .init(),
|
||||
shadow: UIViewShadow? = nil,
|
||||
leadingViewAppearance: LeadingViewAppearance = .defaultAppearance,
|
||||
middleViewAppearance: MiddleViewAppearance = .defaultAppearance,
|
||||
|
|
@ -46,8 +45,7 @@ open class BaseListItemAppearance<LeadingViewAppearance: WrappedViewAppearance,
|
|||
|
||||
super.init(layout: layout,
|
||||
backgroundColor: backgroundColor,
|
||||
roundedCorners: roundedCorners,
|
||||
cornerRadius: cornerRadius,
|
||||
border: border,
|
||||
shadow: shadow)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,8 +36,6 @@ extension DefaultTitleSubtitleView {
|
|||
|
||||
public init(layout: Layout = .defaultLayout,
|
||||
backgroundColor: UIColor = .clear,
|
||||
roundedCorners: CACornerMask = [],
|
||||
cornerRadius: CGFloat = .zero,
|
||||
border: UIViewBorder = .init(),
|
||||
shadow: UIViewShadow? = nil,
|
||||
titleAppearance: UILabel.DefaultAppearance = .defaultAppearance,
|
||||
|
|
@ -48,8 +46,6 @@ extension DefaultTitleSubtitleView {
|
|||
|
||||
super.init(layout: layout,
|
||||
backgroundColor: backgroundColor,
|
||||
roundedCorners: roundedCorners,
|
||||
cornerRadius: cornerRadius,
|
||||
border: border,
|
||||
shadow: shadow)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,9 +25,17 @@ import UIKit
|
|||
public struct UIViewBorder {
|
||||
public var color: UIColor
|
||||
public var width: CGFloat
|
||||
public var cornerRadius: CGFloat
|
||||
public var roundedCorners: CACornerMask
|
||||
|
||||
public init(color: UIColor = .clear,
|
||||
width: CGFloat = .zero,
|
||||
cornerRadius: CGFloat = .zero,
|
||||
roundedCorners: CACornerMask = []) {
|
||||
|
||||
public init(color: UIColor = .clear, width: CGFloat = .zero) {
|
||||
self.color = color
|
||||
self.width = width
|
||||
self.cornerRadius = cornerRadius
|
||||
self.roundedCorners = roundedCorners
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,8 +29,6 @@ public protocol ViewAppearance {
|
|||
|
||||
var layout: Layout { get }
|
||||
var backgroundColor: UIColor { get }
|
||||
var roundedCorners: CACornerMask { get }
|
||||
var cornerRadius: CGFloat { get }
|
||||
var border: UIViewBorder { get }
|
||||
var shadow: UIViewShadow? { get }
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue