diff --git a/DesignRemakes.xcodeproj/project.xcworkspace/xcuserdata/asser.xcuserdatad/UserInterfaceState.xcuserstate b/DesignRemakes.xcodeproj/project.xcworkspace/xcuserdata/asser.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..cb860f2 Binary files /dev/null and b/DesignRemakes.xcodeproj/project.xcworkspace/xcuserdata/asser.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/DesignRemakes.xcodeproj/xcuserdata/asser.xcuserdatad/xcschemes/xcschememanagement.plist b/DesignRemakes.xcodeproj/xcuserdata/asser.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..7ab7e56 --- /dev/null +++ b/DesignRemakes.xcodeproj/xcuserdata/asser.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,14 @@ + + + + + SchemeUserState + + DesignRemakes.xcscheme_^#shared#^_ + + orderHint + 0 + + + + diff --git a/DesignRemakes/Calendar/CalendarView.swift b/DesignRemakes/Calendar/CalendarView.swift index 843fbc8..a524039 100644 --- a/DesignRemakes/Calendar/CalendarView.swift +++ b/DesignRemakes/Calendar/CalendarView.swift @@ -1,67 +1,45 @@ -// -// CalendarView.swift -// DesignRemakes -// -// Created by Florian Schweizer on 22.02.22. -// Design from https://dribbble.com/shots/15571949/attachments/7356584?mode=media -// - import SwiftUI struct CalendarView: View { var body: some View { VStack(alignment: .leading, spacing: 32) { topBar - + monthBar .padding(.horizontal) - - HStack(spacing: 0) { - DayBox(date: 12, day: "Wed", isSelected: true) - Spacer() - DayBox(date: 13, day: "Thu", isSelected: false) - Spacer() - DayBox(date: 14, day: "Fri", isSelected: false) - Spacer() - DayBox(date: 15, day: "Sat", isSelected: false) + + // Horizontal Scroll for Days + ScrollView(.horizontal, showsIndicators: false) { + HStack(spacing: 16) { + ForEach(1...31, id: \.self) { day in + let isSelected = day == 12 // Replace with dynamic selection logic + DayBox(date: day, day: dayOfWeek(for: day), isSelected: isSelected) + } + } + .padding(.horizontal) } - .padding(.horizontal) - + Text("Ongoing") .font(.title) .fontWeight(.bold) - - ScrollView { - HStack { + + // Vertical Scroll for Times + ScrollView(.vertical, showsIndicators: false) { + HStack(alignment: .top) { + // Time labels VStack(alignment: .trailing) { - ForEach(7...12, id: \.self) { hour in - Text("\(hour) AM") + ForEach(0..<25, id: \.self) { hour in + Text("\(hour % 12 == 0 ? 12 : hour % 12) \(hour < 12 ? "AM" : "PM")") .frame(height: 64) } } .foregroundColor(.secondary) - - VStack { - CalendarEvent() - - HStack(spacing: 0) { - Circle() - .fill(.red) - .frame(width: 8, height: 8) - .padding(4) - .background(Circle().fill(.white)) - .clipped() - .shadow(radius: 3) - - VStack { - Divider() - .frame(height: 2) - .background(.red) - } + + // Events + VStack(spacing: 16) { + ForEach(0..<5, id: \.self) { _ in + CalendarEvent() } - - CalendarEvent() - CalendarEvent() } } } @@ -69,39 +47,39 @@ struct CalendarView: View { .padding(.horizontal) .background(Color.blue.opacity(0.05).ignoresSafeArea()) } - + private var monthBar: some View { HStack { Button { } label: { HStack { Image(systemName: "arrow.left") .foregroundColor(.gray) - + Text("Sep") .foregroundColor(.primary) } } - + Spacer() - + Text("October") .font(.title) .fontWeight(.semibold) - + Spacer() - + Button { } label: { HStack { Text("Nov") .foregroundColor(.primary) - + Image(systemName: "arrow.right") .foregroundColor(.gray) } } } } - + private var topBar: some View { HStack { Button { } label: { @@ -114,15 +92,25 @@ struct CalendarView: View { } .foregroundColor(.primary) } - + Spacer() - + Image(systemName: "person.circle") .resizable() .scaledToFit() .frame(width: 40, height: 40) } } + + private func dayOfWeek(for day: Int) -> String { + let formatter = DateFormatter() + formatter.dateFormat = "yyyy-MM-dd" + let calendar = Calendar.current + let dateComponents = DateComponents(year: 2024, month: 10, day: day) + let date = calendar.date(from: dateComponents) ?? Date() + formatter.dateFormat = "E" + return formatter.string(from: date) + } } struct CalendarEvent: View { @@ -130,21 +118,21 @@ struct CalendarEvent: View { VStack(alignment: .leading) { Text("Mobile App Design") .font(.headline) - - Text("Mike and anita") + + Text("Mike and Anita") .font(.subheadline) - + Spacer() - + HStack { Image(systemName: "person.circle.fill") .font(.title) Image(systemName: "person.circle.fill") .font(.title) .offset(x: -16) - + Spacer() - + Text("9.00 AM - 10.00 AM") .font(.caption) } @@ -165,13 +153,13 @@ struct DayBox: View { let date: Int let day: String let isSelected: Bool - + var body: some View { VStack { Text("\(date)") .font(.title) .fontWeight(.semibold) - + Text(day) .fontWeight(.light) }