Skip to content

Commit

Permalink
simplified
Browse files Browse the repository at this point in the history
  • Loading branch information
zmian committed Feb 9, 2024
1 parent 86394f7 commit f01fa7e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ extension DynamicTextFieldStyle where Self == ProminentDynamicTextFieldStyle<Rou
) -> Self {
prominent(
prominence,
shape: RoundedRectangle(cornerRadius: cornerRadius, style: .continuous),
shape: .rect(cornerRadius: cornerRadius),
padding: padding
)
}
Expand Down
3 changes: 1 addition & 2 deletions Sources/Xcore/SwiftUI/Extensions/View+Border.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ extension View {
lineWidth: CGFloat = .onePixel,
color: Color? = nil
) -> some View {
border(
RoundedRectangle(cornerRadius: cornerRadius, style: .continuous),
border(.rect(cornerRadius: cornerRadius),
lineWidth: lineWidth,
color: color
)
Expand Down
6 changes: 2 additions & 4 deletions Sources/Xcore/SwiftUI/Extensions/View+MaskInvert.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ extension View {
///
/// ```
/// Rectangle()
/// .maskInvert(Circle(), size: CGSize(width: 200, height: 100))
/// .maskInvert(.circle, size: CGSize(width: 200, height: 100))
/// .ignoresSafeArea()
/// ```
public func maskInvert<S: Shape>(_ shape: S, size: CGSize) -> some View {
Expand Down Expand Up @@ -76,8 +76,6 @@ private struct InvertedShape<S: Shape>: Shape {
}

func path(in rect: CGRect) -> Path {
var path = Rectangle().path(in: rect)

let innerRect: CGRect

switch dimension {
Expand All @@ -91,8 +89,8 @@ private struct InvertedShape<S: Shape>: Shape {
innerRect = rect.inset(by: .init(lineWidth))
}

var path = Rectangle().path(in: rect)
path.addPath(shape.path(in: innerRect))

return path
}
}

0 comments on commit f01fa7e

Please sign in to comment.