Search results for

calendar

1,863 results found

Post

Replies

Boosts

Views

Activity

Calendar with Correlating Data. Please Help!!!
Basically I need a view with a calendar that will show data attributes from the item. I've tried two different approaches both have their listed problems. There must be a better way to do something like this. Surely it's not ideal to create a new item every time a date is opened or constantly check if something is there, but I don't know any other way. Actual View: import SwiftUI import CoreData struct ContentView: View { @Environment(.managedObjectContext) var managedObjContext @Environment(.calendar) var calenda @Environment(.dismiss) var dismiss @FetchRequest(sortDescriptors: [], predicate: NSPredicate(format: timestamp == %@, Date.now as CVarArg)) var items: FetchedResults @State private var date = Date.now var body: some View { NavigationView{ VStack{ DatePicker(Calendar, selection: $date, in: Date.now...,displayedComponents: [.date]) .datePickerStyle(.graphical) .onAppear(perform: { if (items.isEmpty){ PersistenceController().addItem(date: date, context: managedObjContext) } }
2
0
1.6k
Jun ’22
Reply to EKCalendar Not Persisting
We were seeing something similar to this. The new calendar did persist sometimes, but other times our users would lose the calendar and all events entered in it. It was not easily/reliably reproducible.In the end, we decided to just direct users to the iOS Calendar app to create new calendars, but this is far from ideal.The fact that the iOS Calendar app can do it reliably, and we couldn't however does seem to imply that we're doing something wrong, because both probably use the same API to create the calendars (of course this is not certain because Apple's apps do have access to much more functionality).Did you come up with a solution?
Topic: App & System Services SubTopic: General Tags:
Jan ’19
Reply to How to create an iCloud Calendar?
This is my solution. I didn't take into account any error catching, but I put the variables in for if it was needed.func checkCalendar() -> EKCalendar { var retCal: EKCalendar? let calendars = eventStore.calendarsForEntityType(EKEntityTypeEvent) as! [EKCalendar] // Grab every calendar the user has var exists: Bool = false for calendar in calendars { // Search all these calendars if calendar.title == Auto Schedule Cal { exists = true retCal = calendar } } var err : NSError? if !exists { let newCalendar = EKCalendar(forEntityType:EKEntityTypeEvent, eventStore:eventStore) newCalendar.title=Auto Schedule Cal newCalendar.source = eventStore.defaultCalendarForNewEvents.source eventStore.saveCalendar(newCalendar, commit:true, error:&err) retCal = newCalendar } return retCal! }This functions searches for a calendar named Auto Schedule Cal. If it doesn't find it, it creates one. It then returns the calender for use.Usage:(Given an EKEventStore title
Topic: App & System Services SubTopic: General Tags:
Jun ’15
Bug in system Calendar app when opening it on specific date
I'm using an URL Scheme like this:let interval = date.timeIntervalSinceReferenceDate let scheme = URL(string: calshow:(interval)) UIApplication.shared.open(url, options: [:], completionHandler: nil)This should open the system Calendar app on the determined date. However, when I first open the app, it starts on the correct date and then automatically changes back to the current date. Then, the next time I call this url it starts correctly and stays on the selected date.It looks like a bug, does anyone have a solution?
0
0
542
Jun ’18
Calendar date incorrect for some ISO8601 durations
When testing some code which parses an Iso8601 duration string and generates a TimeInterval, I came across some interesting behavior, which I take to be bug, but I may have missed some setup which would set things right. The short of it... Given the Iso8601 duration string, e.g., P10675199DT2H48M5.4775 which has been parsed into DateComponents, use Calendar.current.date(byAdding:to:) to get a future date. When futureDate.timeIntervalSince(currentDate) is calculated, the interval returned MAY be different from the result of a manual calculation - off by one hour, or incorrect fractional seconds. The inital test was run using a number-of-days value for ~30k yrs. However, using other, smaller values can produce errors as well. Copy/Paste the following code into a playground to check me. Anyone know what might be happenging?import Cocoa var str = Hello, playground // Given the Iso8601 duration string P10675199DT2H48M5.4775 (Yeah, made up for testing. Who really cares about a duration of ~30k yrs. Yikes!) let nano
0
0
539
Mar ’20
Reply to If current time is between value 1 and value 2, run this code
Something like thislet now = Date() let calendar = Calendar.current let year = calendar.component(.year, from: now) let month = calendar.component(.month, from: now) let day = calendar.component(.day, from: now) let beginDate = DateComponents(calendar: calendar, timeZone: .current, year: year, month: month, day: day, hour: 13, minute: 0) let endDate = DateComponents(calendar: calendar, year: year, month: month, day: day, hour: 15, minute: 0)
Topic: Programming Languages SubTopic: Swift Tags:
Jul ’18
Can we get users apple ID synced with iPhone calendar programmatically using swift 3.0
Hi,One of my applications needs calendar synchronization. Events are added to the email ID from server end.There are two options for us.1. Synch Google Calendar with iPhone calendar2. Try to find get users apple ID (from settings - we assume as it is already synched with iPhone calendar) programatically using swift 3.0 and add events to that ID.Drawback of Google Calendar Sync:Users of this application is registered with our server with different email Id's other than Google. We need to cover all the users. At the same time we dont want user to do any manual action from their side in order to perform perform. Few manual actions which we discovered are: creating Google calendar account using existing email ID, once Google calendar account is created then add this accout to the Settings->Calendar->Accounts->Add Account->Other->Add CalDav Account-> (Giver server, Username, Password, description here).Thus we are thinking to fetch us
0
0
1.2k
Feb ’17
Reply to Get localized week days
Doc states:https://developer.apple.com/documentation/foundation/calendar/2292848-shortweekdaysymbolsBy default, Calendars have no locale set. If you wish to receive a localized answer, be sure to set the locale property first - most likely to Locale.autoupdatingCurrent.I did the following: var calendar = Calendar(identifier: .gregorian) calendar.locale = NSLocale(localeIdentifier: fr_FR) as Locale print(calendar.shortWeekdaySymbols)To get[dim., lun., mar., mer., jeu., ven., sam.]
Topic: UI Frameworks SubTopic: AppKit Tags:
Jun ’19
Are we allowed to add address/GPS locations returned from MKLocal​Search to a users calendar?
I am working on an app that lets a user look up a location on a map and then create an event in their calendar, adding the address/GPS data to the event. My question is, are we allowed to add address/GPS locations returned from MKLocalSearch to a users calendar? I am wondering because of Apple Maps usage agreement, which states: You must not access or use the Service in any manner that attempts to copy, extract, scrape or reutilize any portions of the data or content provided by the Service, including bulk downloads or feeds of map data or imagery, or the creation of any databases based upon results from the Service http://www.apple.com/legal/internet-services/maps/terms-en.html I asked a similar question to the Yelp team about their data (which has similar terms) and they said they only allow you to save the address to the calendar, not the GPS coordinates. I know Apple Maps uses Yelp data for some things, so I thought I would ask to check.
0
0
350
Apr ’17