diff --git a/Shared/Random.swift b/Shared/Random.swift index 5d3f3a7..2eed27b 100644 --- a/Shared/Random.swift +++ b/Shared/Random.swift @@ -6,6 +6,7 @@ // import Foundation +import SwiftUI struct Constants { static let groupShareId = "group.com.88oak.ifeel" @@ -38,3 +39,21 @@ extension Date: RawRepresentable { self = Date(timeIntervalSinceReferenceDate: Double(rawValue) ?? 0.0) } } + + +struct RoundedCorner: Shape { + + var radius: CGFloat = .infinity + var corners: UIRectCorner = .allCorners + + func path(in rect: CGRect) -> Path { + let path = UIBezierPath(roundedRect: rect, byRoundingCorners: corners, cornerRadii: CGSize(width: radius, height: radius)) + return Path(path.cgPath) + } +} + +extension View { + func cornerRadius(_ radius: CGFloat, corners: UIRectCorner) -> some View { + clipShape( RoundedCorner(radius: radius, corners: corners) ) + } +} diff --git a/Shared/views/ContentView.swift b/Shared/views/ContentView.swift index b2d6798..c973527 100644 --- a/Shared/views/ContentView.swift +++ b/Shared/views/ContentView.swift @@ -192,7 +192,7 @@ struct ContentView: View { yOffset: value) } } - .clipShape(RoundedRectangle(cornerRadius: 25, style: .continuous)) + .cornerRadius(10, corners: [.topLeft, .topRight]) } private func SectionHeaderView(month: Int, year: Int) -> some View { @@ -341,7 +341,7 @@ struct ContentView: View { } .frame(height: headerHeight + 20) listView - .padding([.leading, .trailing, .bottom]) + .padding([.leading, .trailing]) } }.background( theme.bg