Skip to content

Instantly share code, notes, and snippets.

View sukidhar's full-sized avatar
🏠
Working from home

sukidhar sukidhar

🏠
Working from home
View GitHub Profile
Button(action: {
index = 0
}, label: {
VStack{
Image(systemName: "clock").resizable().frame(width: 25, height: 25, alignment: .center).accentColor(index == 0 ? .black : .white)
Text("Recent").font(.caption)
.accentColor(index == 0 ? .black : .white)
}
.adding(.top, 20)
})
import SwiftUI
let constants = Constants()
struct Constants {
var hasExtendedSafeArea : Bool {
return UIApplication.shared.windows.filter {$0.isKeyWindow}.first?.safeAreaInsets.top ?? 0 > 20
}
var height : CGFloat{
return 75 + (hasExtendedSafeArea ? 20 : 0)
struct RaadialButton : View {
let function : ()->Void
var body: some View{
Button(action: function, label: {
Image(systemName: "plus").resizable().frame(width: 25, height: 25, alignment: .center).foregroundColor(.white)
}).frame(width: 90, height: 90, alignment: .center)
.background(
ZStack{
Color.white.frame(width: 90, height: 90, alignment: .center)
Color(#colorLiteral(red: 0.262745098, green: 0.3921568627, blue: 0.968627451, alpha: 0.3204319234)).frame(width: 77, height: 77, alignment: .center).clipShape(Circle())
extension View {
func cornerRadius(_ radius: CGFloat, corners: UIRectCorner) -> some View {
clipShape( RoundedCorner(radius: radius, corners: corners) )
}
}
struct RoundedCorner: Shape {
var radius: CGFloat = .infinity
var corners: UIRectCorner = .allCorners
struct TabBarBackgroundView : View {
var body: some View{
HStack(alignment: .bottom,
spacing: 0,
content: {
LinearGradient(gradient: Gradient(colors: [Color(#colorLiteral(red: 0.4117647059, green: 0.5176470588, blue: 1, alpha: 1)),Color(#colorLiteral(red: 0.1333333333, green: 0.2901960784, blue: 1, alpha: 1))]),
startPoint: .top,
endPoint: .bottom)
.frame(width: constants.width,
height: constants.height,