Search results for

calendar

1,863 results found

Post

Replies

Boosts

Views

Activity

Reproduce the apple macos calendar scroll layout
I am trying to recreate the apple calendar in swiftui but I have issues creating scroll layout. So I want to have: When I scroll horizontally the hours on the side have to stay fixed but the header with the day number day String and the full day events have to scroll When I scroll vertically the hours on the side have to move but the header don't For the moment I have : HStack(alignment: .top, spacing:0) { // The hours on the side LateralHours(height: geometry.size.height * 24/10) . offset(y: -offset) ScrollViewReader { proxy in ScrollView (.horizontal, showsIndicators: false) { VStack { // The day number and the full day events Header(width: width) ScrollView { LazyHStack (spacing: 0) { ForEach($loadedDays, id: .self) { day in // The day grid with the events DayContentView( cellHeight: geometry.size.height / 10, width: width, selectedEvent: $selectedEvent, day: day, store: $store, modifiedEvent: $modifiedEvent ) } } .frame(height: 24*geometry.size.height / 10) // This code block is used to track the
3
0
542
Jul ’24
Swift MultiDatePicker doesn't detect dates that have been saved previously and then loaded in from firebase.
Hey, currently working on my first SwiftUI app in college and would appreciate any help. I have an issue where when dates are loaded from firebase into the selectedDates array of my MultiDatePicker, the onChange function does not recognize dates that are already in the selectedDates array, instead re-adding them to the array. I.e. if I have loaded July 19th into the multidatePicker, it displays on the calendar, but clicking July 19th on the multidatepicker calendar view doesn't remove it from the selectedDates array. This is the code for the view: VStack { MultiDatePicker(Select dates, selection: $selectedDates) .padding() .onChange(of: selectedDates) { oldValue, newValue in saveDates(dates: selectedDates) } List(savedDates, id: .self) { date in Text((date, formatter: dateFormatter)) } .listStyle(.plain) } .onAppear { loadSavedDates() } Where selectedDates is a state variable: @State var selectedDates: Set = [] If nothing is on Firebase, the selection and deselection of dates happens fine, b
0
0
451
Jul ’24
iPhone X restart
bug_type:210,timestamp:2024-06-01 14:21:43.00 +0400,os_version:iPhone OS 16.7.4 (20H240),roots_installed:0,incident_id:2D658 A3E-807D-4239-A262-1560CDB5A77F} { build : iPhone OS 16.7.4 (20H240), product : iPhone10,6, socId : 8015, socRevision : 11, incident : 2D658A3E-807D-4239-A262-1560CDB5A77F, crashReporterKey : b9deae4c29b808d36d6d04c34edc95561cd25808, kernel : Darwin Kernel Version 22.6.0: Tue Nov 7 21:41:17 PST 2023; root:xnu-8796.142.1.702.91/RELEASE_ARM64_T8015, date : 2024-06-01 14:21:43.37 +0400, panicString : panic(cpu 2 caller 0xfffffff01d52a4fc): userspace watchdog timeout: no successful checkins from thermalmonitordnservice returned not alive with context : is_alive_func returned unhealthy : current 7fffffffeff, mask 67fffffffff, expected 67fffffffff. SD: 0 BC: 0 RC: 0 BS: 0, Missing sensor(s): TP0Z nservice: backboardd, total successful checkins in 225 seconds: 17, last successful checkin: 0 seconds agonservice: SpringBoard, total successful checkins in 176 seconds: 15, last successful checkin:
3
0
918
Jul ’24
Reply to .chartXScale not scaling domain of Chart as expected
[quote='795150022, AppleCare Staff, /thread/759244?answerId=795150022#795150022'] So just a few lines of code would be enough, I think it should fit in 20 lines or less. For data, you can inline an array of tuples as I described. No need for preview, extensions, structs etc. just a single Chart. [/quote] Apologies, I thought perhaps an example with a Preview would be beneficial for demonstration purposes. I'm happy to reduce the amount of code a bit. No more extra structs, previews or extensions! However, I can't really get it down to 20 lines if I am to simulate my issue. I need a month of measurements and I'm not sure I can even create the array of ~30 items (with plenty of Calendar.current operations) in 20 lines of code. I hope about 40 lines of code is okay! let cal: Calendar = .current struct ChartWithNilValues2: View { let start: Date = cal.date(from: cal.dateComponents([.year, .month], from: .now))! let end: Date init() { end = cal.date(byAdding: .month, value: 1, to: start)! } var body: some
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jul ’24
Reply to .chartXScale not scaling domain of Chart as expected
[quote='794978022, AppleCare Staff, /thread/759244?answerId=794978022#794978022'] No need for an entire repo, just a minimal, but runnable example that exhibits the issue. [/quote] Alright! This should do: import SwiftUI import Charts struct ChartWithoutNilValues: View { let firstDayOfMonth: Date let firstDayOfNextMonth: Date let measurements: [PerformanceMeasurement] init() { firstDayOfMonth = Date.now.firstDayOfMonth()! firstDayOfNextMonth = Calendar.current.date(byAdding: .month, value: 1, to: firstDayOfMonth)! measurements = DataGenerator.generateMeasurements( interval: DateInterval(start: firstDayOfMonth, end: firstDayOfNextMonth), component: .day ) } var body: some View { Chart(measurements, id: .timestamp) { measurement in BarMark( x: .value( Timestamp, measurement.timestamp, unit: .weekOfYear, calendar: .current ), y: .value( Solar production, measurement.production?.total ?? 0 ) ) } .chartXAxis { AxisMarks(values: .stride(by: .weekOfYear)) { value in AxisValueLabel((value.index), centered: t
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jul ’24
Reply to How to open Calendar app event's detail by its ID
To open the Apple Calendar app's event detail view programmatically, you can use the EventKit framework. In my investigation observed there isn't a direct URL scheme to open a specific event in the Calendar app. Instead, you can open the Calendar app and focus on the date of the event. let eventStore = EKEventStore() eventStore.requestAccess(to: .event) { (granted, error) in if granted { let event = eventStore.event(withIdentifier: your_event_identifier) if let event = event { DispatchQueue.main.async { let eventViewController = EKEventViewController() eventViewController.event = event eventViewController.allowsEditing = true eventViewController.allowsCalendarPreview = true if let viewController = UIApplication.shared.keyWindow?.rootViewController { let navigationController = UINavigationController(rootViewController: eventViewController) viewController.present(navigationController, animated: true, completion: nil) } } } else { print(not found) } } else { print(denied) } } Make sure
Topic: App & System Services SubTopic: General Tags:
Jul ’24
How to open Calendar app event's detail by its ID
Hey there, I'd like to ask for guidance on how to open the Apple Calendar app's event programmatically. I can already list events, but I'm struggling to open the calendar detail view (upon user interaction). I've tried many variants, such as using the x-apple-calevent URL scheme or calshow:, etc., but none of them worked. Here's the code I'm using: if let eventIdentifier = event.eventIdentifier as String?, let calendarId = event.calendarId as String? { if let url = URL(string: x-apple-calevent://(calendarId)/(eventIdentifier)) { NSWorkspace.shared.open(url) } } Once the action is triggered, it tells me that: There is no application set to open the URL x-apple-calevent://909114A0-6352-47DB-B70E-2770H7D5B6D3:7q50iih7fvbio3qipk5m7osjig@google.com Thanks a bunch! Tom
1
0
1.3k
Jul ’24
.chartXScale not scaling domain of Chart as expected
Hi, I'm currently wrestling with the .chartXScale(domain:) modifier in order to get my Chart to display correctly. The basics of the Chart look like this. Chart(measurements, id: .timestamp) { measurement in if let total = measurement.production?.total { BarMark( x: .value( Timestamp, measurement.timestamp, unit: .weekOfYear, calendar: .current ), y: .value( Solar production, total ) ) } } As anyone familiar with Charts can see, I sort data into columns based on what week of the year the measurements belong to. Some of them can be null, and when they are, I still want space in the Chart where a BarMark would've been to be taken up, like week number 4 in this example chart (in which I've defaulted all measurements that are null in week 4 to 0, for demonstration purposes): To achieve that, as I understand, I'm meant to use the .chartXScale(domain:) modifier, but when I apply the following modifier... .chartXScale(domain: firstDayOfMonth...firstDayOfNextMonth) ... (where the domain is from the first day
9
0
1.3k
Jul ’24
Reply to Non-tinted image in complications using WidgetKit
Here's the code. I have a basic widget bundle @main struct TestWidgetBundle: WidgetBundle { var body: some Widget { TestCounterWidget() } } And a simple timeline entry struct TestEntry: TimelineEntry { var date: Date } My timeline provider doesn't do much for now either. struct TestTimelineProvider: TimelineProvider { typealias Entry = TestEntry func placeholder(in context: Context) -> TestEntry { TestEntry(date: .now) } func getSnapshot(in context: Context, completion: @escaping (TestEntry) -> Void) { let entry = TestEntry(date: .now) completion(entry) } func getTimeline(in context: Context, completion: @escaping (Timeline) -> Void) { let calendar = Calendar.current let currentDate = Date() let entries = [TestEntry(date: .now)] let timeline = Timeline(entries: entries, policy: .after(currentDate)) completion(timeline) } } and finally the widget struct TestCounterWidget: Widget { let kind: String = TestCounterWidget var body: some WidgetConfiguration { StaticConfiguration(kind: kind, provide
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jul ’24
Reply to dateFromString results in nil
[formatter setLocale:[[NSLocale alloc] initWithLocaleIdentifier:NSCalendarIdentifierGregorian]]; This creates a locale with a calendar identifier. That makes no sense. If you’re using an NSDateFormatter with a fixed format, you must pin the locale to en_US_POSIX. See QA1480 NSDateFormatter and Internet Dates for the full backstory. Also, you’re parsing a date without a time component. That’s trickier than you might think. See Parsing Dates Without Times. Share and Enjoy — Quinn “The Eskimo!” @ Developer Technical Support @ Apple let myEmail = eskimo + 1 + @ + apple.com
Topic: Programming Languages SubTopic: General Tags:
Jul ’24
Screen Time | How to enable/disable screen time for a game app by setting start and end times?
let schedule = DeviceActivitySchedule( intervalStart: DateComponents(calendar: Calendar.current ,hour: 20, minute: 0), intervalEnd: DateComponents(calendar: Calendar.current ,hour: 22, minute: 59), repeats: true, warningTime: nil ) store.shield.applications = selectionToDiscourage.applicationTokens.isEmpty ? nil : selectionToDiscourage.applicationTokens store.shield.applicationCategories = selectionToDiscourage.categoryTokens.isEmpty ? nil : ShieldSettings.ActivityCategoryPolicy.specific(selectionToDiscourage.categoryTokens) store.shield.webDomains = selectionToDiscourage.webDomainTokens store.application.blockedApplications = selectionToDiscourage.applications try center.startMonitoring(.daily, during: schedule)
0
0
430
Jun ’24
Screen Time | How to enable/disable screen time for a game app by setting start and end times?
try center.startMonitoring(.daily, during: schedule) let schedule = DeviceActivitySchedule( intervalStart: DateComponents(calendar: Calendar.current ,hour: 20, minute: 0), intervalEnd: DateComponents(calendar: Calendar.current ,hour: 22, minute: 59), repeats: true, warningTime: nil ) extension DeviceActivityName { static let daily = Self(daily) }
1
0
431
Jun ’24
What are some other actionable items I can do, so that I can get through "Guideline 4.3(a) - Design - Spam" app update rejection?
I have an app which is in the app store since 2022. It is an app with combined features of note taking, todo list and calendar. My most recent app update is rejected with the following message. Guideline 4.3(a) - Design - Spam We noticed your app shares a similar binary, metadata, and/or concept as apps submitted to the App Store by other developers, with only minor differences. Submitting similar or repackaged apps is a form of spam that creates clutter and makes it difficult for users to discover new apps. Next Steps Since we do not accept spam apps on the App Store, we encourage you to review your app concept and submit a unique app with distinct content and functionality. Resources Some factors that contribute to a spam rejection may include: Submitting an app with the same source code or assets as other apps already submitted to the App Store Creating and submitting multiple similar apps using a repackaged app template Purchasing an app template with problematic code from a third party Submittin
2
0
1.2k
Jun ’24
Reply to The DateFormatter is returning wrong date format 2024-04-23T7:52:49.352 AMZ, 2024-05-23T11:16:24.706 a.m.Z
Right. They have almost certainly overridden the default 12-/24-hour setting for their locale, which is one of the two most common causes of problems like this (they other being to choose a non-Gregorian calendar). Share and Enjoy — Quinn “The Eskimo!” @ Developer Technical Support @ Apple let myEmail = eskimo + 1 + @ + apple.com
Topic: Programming Languages SubTopic: Swift Tags:
Jun ’24
Let's talk about SwiftUI DefaultDatePickers
Is there a way to add the day of the week to the wheel picker that pops up inside the Default calendar picker? How about an optional way to type a date in instead of lots of scrolling? DatePicker(Enter a date, selection: $date1, displayedComponents: .date) .datePickerStyle(DefaultDatePickerStyle()) This works OK, but it seems slow when entering a date to need to scroll and then tap the calendar again to fix the day of the week. Maybe a custom entering screen is the best path? It's frustrating that SwiftUI doesn't offer more options. I see that Contacts goes right to the Wheel style, but Calendar uses this pop up calendar (Default) style) Maybe someone thinks that 3 scroll wheels are too much?
Topic: UI Frameworks SubTopic: SwiftUI
0
0
377
Jun ’24