Search results for

calendar

1,869 results found

Post

Replies

Boosts

Views

Activity

Reply to How to compare dates from two view controllers (Core Data and Swift)?
I'll repeat my answer, because the code looks bizarre. Right, sorry. So model is a variable for the Entity, dateSaved is an attribute of the entity and it is a string (as I use a date formatter that converts the date from a date picker into a string). dateFromFirstView is also a string. The thing is that I added a print but the if else statement only gets triggered once so if I change the date on the datePicker the if else statement doesn't get triggered. let model = Calendar(context: context) print(model.dateSaved) if model.dateSaved == dateFromFirstView{ print(dates are identical ,model.dateSaved, ,dateFromFirstView) } else{ print(dates are not identical ,model.dateSaved, ,dateFromFirstView) } @IBAction func datePickerChanged(_ sender: Any){ let dateFormatter = DateFormatter() dateFormatter.dateFormat = dd-MM-YYYY dateFromFirstView = dateFormatter.string(from: datePicker.date) } @IBAction func datePickerChanged(_ sender: Any){ let dateFormatter = DateFormatter() dateFormatter.dateFormat = dd-MM-YYY
Topic: Programming Languages SubTopic: Swift Tags:
Aug ’21
Reply to Calendar's date(bySetting:value:of:) returns nil when changing year
Hmmm, this is a tricky one. The date(bySetting:value:of:) method is more-or-less a wrapper around the Objective-C -nextDateAfterDate:matchingUnit:value:options: method. By default this searches forwards, with the options parameter letting you request a backwards search (NSCalendarSearchBackwards). So things (kinda) work if you try to set the year to 2022: let date2 = Calendar.current.date(bySetting: .year, value: 2022, of: date) print(date2) // -> Optional(2022-01-01 00:00:00 +0000) However, this still isn’t the result you’re looking for, because the semantics of this method don’t really align with your requirements. Try this instead: let c = Calendar(identifier: .gregorian) var dc = c.dateComponents([.era, .year, .month, .day, .hour, .minute, .second], from: date) dc.year = 2020 let date2 = c.date(from: dc) print(date2) // -> Optional(2020-07-29 08:17:33 +0000) There are some serious caveats here: In my code I hard-wired the calendar to Gregorian. The year 2020 only makes sense in tha
Topic: App & System Services SubTopic: General Tags:
Jul ’21
Reply to MacOS Big Sur Lagging
Since upgrading to Big Sur, I have been experiencing slow reboots, crashes, spinning beach balls of death, lagging applications (mail, Firefox, Chrome, MS Office, Notes, Calendar, etc), and very poor battery life. The battery duration went from 6-7 hours of regular use to less than 2 hours of same use. The battery health reports Normal, but it's anything but normal. I installed the latest 11.4 patch with no improvement of battery life or performance. The Big Sur has essentially killed my Mac Air. Please fix both battery and performance to pre-Big Sur. MacBook Air (13-inch 2017) 1.8 GHz Dual-Core Intel Core i5 8GB 1600 MHz DDR3 Intel HD Graphics 6000 1536MB Thanks!
Topic: App & System Services SubTopic: Core OS Tags:
Jul ’21
Open view deep in NavigationView from push notification
Hi, I want to open a view after taping on a push notification. The views and notifications are all working fine but my problem is when I try to open the view from the push notification via .sheet(isPresented) it is always presenting the view as modal. I would like to achieve that the view is actually opened embedded in the NavigationView it would usually be when accessing it manually. To make it more clear: import SwiftUI struct ContentView: View { ttvar body: some View { NavigationView{ VStack{ NavigationLink(destination: ListView()){ Text(Going one level down) } } } tt} } struct ContentView_Previews: PreviewProvider { ttstatic var previews: some View { ttttContentView() tt} } struct ListView: View { var body: some View{ NavigationLink(destination: DetailView()){ Text(Click me) } } } struct DetailView: View { var body: some View{ Text(I want to display this view after tapping on a notification.) } } After tapping on the push notification, I want to jump directly to the DetailView() down in the NavigationView
1
0
1.2k
Jul ’21
Duplicate Keys of Type 'EKEvent' were found in a Dictionary
I have been playing around with EventKit recently and I added a fetch request for all Events in my calendar. But after like 20 seconds after launch, I get this error: Fatal error: Duplicate keys of type 'EKEvent' were found in a Dictionary. This usually means either that the type violates Hashable's requirements, or that members of such a dictionary were mutated after insertion. 2021-06-22 08:56:13.202792+0200 Assisty[1779:332215] Fatal error: Duplicate keys of type 'EKEvent' were found in a Dictionary. This usually means either that the type violates Hashable's requirements, or that members of such a dictionary were mutated after insertion. 2021-06-22 08:57:03.745222+0200 Assisty[1779:332215] [error] precondition failure: setting value during update: 1560 I am a beginner to Xcode debugging and SwiftUI, but I can see that it thinks I have mutated something when I haven't. My app only fetches events from the user calendar and stores it in a variable of type [EKEvent]. I have no idea why this
3
0
2k
Jul ’21
Reply to How to get current time
Date() includes current date and time all in one package. You just need to extract the time parts from it. Have a look at Calendar class DateComponents method to get hour and minute as variables, or DateFormat() to just format them as a string. Examples: import UIKit // current date and time let date = Date() // Calender dateComponents let components = Calendar.current.dateComponents([.hour,.minute], from: date) let hour = components.hour let minute = components.minute // DateFormatter let dateFormatter = DateFormatter() dateFormatter.dateFormat = hh:mm let hoursMinutesString = dateFormatter.string(from: date)
Jun ’21
Core Data and Random NULL Values
I created the test application with Xcode Version 12.5 (12E262) on a Mac Mini (M1) as a Swift Core Data application. I am not certain whether the group's documentation illustrates a solution. I apologize for not discovering a previous solution. My code mimics the code in a previous question, located here: (https://developer.apple.com/forums/thread/123767), and answered by the group experts, so I thought I would try the same code to save the data, since the answer satisfied the author without any subsequent issues. My test Core Data application version generates and stores multiple random NULL values, at the same time my application stores my singular data entry. The random incremental NULL values are separate entries, and appear before, or after my data input is saved. I check the input values with DB Browser for SQLite, where the NULL entries are visible. I would like to post the entire application code but the data entry limits me to a certain character count. For the moment, I am at a loss, where I must th
1
0
2.2k
Jun ’21
Reply to ios14 calendar widget does not show events from Exchange Online calendar
Still a problem in iOS 14.6. A big feature introduced in iOS 14 was these widgets and now the one I actually would use doesn't work well. SMH The calendar ON the phone is updated with a change to todays schedule. I know that was the case after a sync, because the calendar display on my Watch face shows the actual updated calendar (which it gets from the phone). Just the phone's widget doesn't update with the new information and still displays stale meeting information. If I open the calendar app (directly or tapping on the widget), it shows the current correct daily meeting state, and then leaving the calendar app causes the home screen widget to redraw and then reflect the current correct calendar state of upcoming events. That widget needs to redraw its desktop render whenever a calendar data change on the phone happens.. even without the calendar app itself being running in the foreground. That activity seems to be missing/broken.
Topic: App & System Services SubTopic: Core OS Tags:
Jun ’21
Reply to com.apple.hiservices-xpcservice (Not Responding)
I am having the same issue with a new 13 MBP (2020 M1 Big Sur) with a very lean system build. The problem is intermittent and difficult to reproduce, so the following may not be correct, but I think it might only be happening when both of the following are true: (a) upon wake from sleep and (b) when connected to my external display (an Apple Thunderbolt Display). As the Hiservices framework contains interfaces for internet config, I wonder if it could be related to switching network interface from wifi to Display Ethernet. I believe I have ruled out anything having to do with Date & Time, as I have Set time zone automatically turned off, together with the applicable Location access in Security & Privacy. Other things I had initially suspected that I have ruled out so far: Any apps with Accessibility access; SteerMouse Manager; Bartender 4; Carbon Copy Cloner's daemon; MS Exchange calendars; and Parallels 16.5. I also have an older 15 MBP (2018 Big Sur, Intel obviously) with a nearly identical
Topic: App & System Services SubTopic: Hardware Tags:
Jun ’21