Search results for

calendar

1,863 results found

Post

Replies

Boosts

Views

Activity

Reply to How to set timeFormat of DatePicker in swift
[quote='789178022, BabyJ, /thread/756212?answerId=789178022#789178022, /profile/BabyJ'] How are you setting your locale? If you aren't already, you can set it through the environment, like this: DatePicker(...) .environment(.locale, myCustomLocale) You can customise a Locale object with the values you want for specified properties, such as the region or calendar. [/quote] In UIKit above property isn't available
Topic: UI Frameworks SubTopic: UIKit Tags:
Jun ’24
Reply to How to set timeFormat of DatePicker in swift
How are you setting your locale? If you aren't already, you can set it through the environment, like this: DatePicker(...) .environment(.locale, myCustomLocale) You can customise a Locale object with the values you want for specified properties, such as the region or calendar.
Topic: UI Frameworks SubTopic: UIKit Tags:
May ’24
Write Only permission not working with provided snippet
Hi, I am evaluating the write ony mode and on my Development iPhone (14 Max Pro / 17.2) I get an error when trying to add an event in write only access mode. I am using the provided snippet let store = EKEventStore() // Request write-only access guard try await store.requestWriteOnlyAccessToEvents() else { return } // Create an event let event = EKEvent(eventStore: store) event.calendar = store.defaultCalendarForNewEvents event.title = WWDC23 Keynote event.startDate = myEventStartDate event.endDate = myEventEndDate event.timeZone = TimeZone(identifier: America/Los_Angeles) event.location = 1 Apple Park Way, Cupertino, CA, United States event.notes = Kick off an exhilarating week of technology and community. // Save the event guard try eventStore.save(event, span: .thisEvent) else { return } On the .save step I receive the following Error (The calendar is read only) Failed to save event: Error Domain=EKErrorDomain Code=6 Der Kalender ist schreibgeschützt. UserInfo={NSLocalizedDescription=Der Kalender
1
0
891
Dec ’23
Scheduling Local Notifications with repeat interval
I am building an application where I need to implement a use case where a local notification is set for a specific date / time (e.g 05/6/24 8 PM) to display to the user (e.g. Take your Meds) and I want him to continue to get that alert every X minutes (e.g. every 2 minutes) until I cancel it (e.g. when the user indicates he has taken his medicene). NOTE: I do NOT want to rely on push notifications from the server for doing the reminders because it needs to work when the device is off the network (like on a plane or a cruise ship in the middle of the ocean or whatever). This would seem to be a pretty common use case, but looking at the previous and existing local notification frameworks, I only see the option to create a calendar based trigger with a boolean repeat (UNCalendarNotificationTrigger) or a time interval based trigger with a boolean repeat (UnTimeIntervalNotificationTrigger), but nothing that combines these in a way that allows me to implement the above stated use case.
1
0
791
May ’24
Reply to TipKit: "The filter function is not supported in this rule."
Just to follow up on this a bit, I did find that Apple apparently changed semantics since the WWDC video was made, and they introduced a DonationTimeRange structure that you can use like this: #Rule(Self.viewedDetails) { $0.donations .donatedWithin(.days(5)) .count > 0 Unfortunately, this doesn't provide a way to achieve what I want for one of my rules, which is to determine if the user has been using the app for at least a calendar day. You might think that you could construct an expression comparing the count of two .donatedWithin ranges: #Rule(Self.viewedDetails) { $0.donations.donatedWithin(.weeks(52)).count > $0.donations.donatedWithin(.days(1)).count But no, you can't. This doesn't work because the #Rule macro explicitly requires a count comparison. If you try to write it as a raw predicate expression, it will compile but assert at runtime. So, at this point, I've given up trying to write the rule that I wanted to write. But perhaps someone will see the question and point out something th
Topic: App & System Services SubTopic: General Tags:
May ’24
Reply to Central American NSTimeZone instances returning CST rather than permanently CDT
Consider this: import Foundation func main() { var c = Calendar(identifier: .gregorian) c.timeZone = .gmt let jan2022 = c.date(from: .init(year: 2022, month: 1, day: 1))! let jun2022 = c.date(from: .init(year: 2022, month: 6, day: 1))! let jan2023 = c.date(from: .init(year: 2023, month: 1, day: 1))! let jun2023 = c.date(from: .init(year: 2023, month: 6, day: 1))! let tz = TimeZone(identifier: America/Merida)! for d in [jan2022, jun2022, jan2023, jun2023] { print(tz.isDaylightSavingTime(for: d), tz.daylightSavingTimeOffset(for: d), tz.secondsFromGMT(for: d) / 60 / 60) } } main() On macOS 14.4.1 it prints: false 0.0 -6 true 3600.0 -5 false 0.0 -6 false 0.0 -6 That definitely matches your assertion that this time zone is ‘stuck’ on standard time rather than daylight savings time. However, I’m confused by this assertion: Essentially America/Merida permanently changed to -0500 (CDT) on October 31, 2021 The Wikipedia summary of Mexican time zones suggests that America/Merida is effectively deprecated in fa
Topic: App & System Services SubTopic: General Tags:
May ’24
Reply to Query with Predicate
Thanks @MobileTen. So I am selecting the seasoned in the sidebar view as follows: import SwiftData struct SidebarView: View { @EnvironmentObject var navigationManager: NavigationStateManager @State private var isShowingSeasonSelection = false var body: some View { VStack { List(selection: $navigationManager.SelectionState) { Label(Home, systemImage: house.fill) .tag(SelectionState.home) Section(Squadra) { Label(Rosa, systemImage: person.2.fill) .tag(SelectionState.rosa) Label(Calendario, systemImage: calendar) .tag(SelectionState.calendarioSquadra) } Section(Campionato) { Label(Calendario, systemImage: calendar) .tag(SelectionState.calendarioCampionato) Label(Classifica, systemImage: list.bullet.rectangle.fill) .tag(SelectionState.classifica) } Section(Allenatore) { Label(Esercizi, systemImage: pencil.and.list.clipboard) .tag(SelectionState.esercizi) } Section(Impostazioni) { Label(Impostazioni, systemImage: gear) .tag(SelectionState.settings) } } .listStyle(.sidebar) Spacer() Button(action:
May ’24
Returning to previously opened app
Hi everyone, I’m just starting with swift and Xcode and have a basic question. I have the following code I found online for an app that generates math addition questions. I would like to run this Math app on my iPhone just before I open the apps I use most often (let’s say mail, WhatsApp, calendar and notes) ask me a maths question and if I answer correctly, carryon with the app originally intended to be opened. I can do the opening of the Math app before the apps I use more often with shortcuts. I would like to modify the code bellow so that if I answer correctly it “closes” itself and returns to the originally intended app. With that intention I included the “exit(0)”, but I get an error. Thanks for your help in advance! Best, Tom struct ContentView: View { @State private var correctAnswer = 0 @State private var choiceArray : [Int] = [0, 1, 2, 3] @State private var firstNumber = 0 @State private var secondNumber = 0 @State private var difficulty = 1000 var body: some View { VStack { Text((firstNumb
1
0
430
May ’24
Error Domain=com.apple.healthkit Code=3 "Unable to invalidate interval: no data source available."
I have used below source code to get the steps from HealthKit. It's working fine many users but few users face the issue regards to get the steps from HealthKit in the our Application. After tracking the logs that issue found **: Error Domain=com.apple.healthkit Code=3 Unable to invalidate interval: no data source available. ** Please help to know what exactly issue in the below source code. -(void) HealthKitSteps { HKHealthStore *healthStore = [[HKHealthStore alloc] init]; NSCalendar *calendar = [NSCalendar currentCalendar]; [calendar setTimeZone:[NSTimeZone localTimeZone]]; NSDateComponents *interval = [[NSDateComponents alloc] init]; interval.hour = 2; NSDateComponents *anchorComponents = [calendar components:NSCalendarUnitDay | NSCalendarUnitMonth | NSCalendarUnitYear fromDate:[NSDate date]]; anchorComponents.hour = 0; NSDate *anchorDate = [calendar dateFromComponents:anchorComponents]; HKQuantityType *quantityType = [HKObjectType quantityTypeForIdentifier:HKQuantityTyp
1
0
998
Dec ’22
SwiftUI needs MacOS 10.15?
Hey, I'm working on a new multi-platform application, and part of the application requires a calendar. I've created Day, Week, and Month calendar and they are all working as expected on Mac/iPhone and iPad. So I decided that I would make them a Library/Package and share with the community. I created a package project, moved all the working code into it, and then added the package into my project as a local dependency. Now I'm getting lots of errors in the package code about everything is only available in macOS 10.15. It's not the code as I know it works. I have platforms: [ .macOS(.v10_14), .iOS(.v15) ] This is my first attempt at a package. Is there something I'm not doing? Thanks, Mark
2
0
907
Apr ’24
TabView's page style is broken on iOS 17.4
I have an infinite week scroller implemented using a TabView's page styling. basically when you scroll to the next week, it pre-loads the week after so that you can scroll infinitely. Since iOS 17.4, it seems to partially scroll two pages ahead. Scrolling backwards works fine. I made a radar: FB13718482 Here is a simplified implementation that has the issue reproduced. It uses the swift ordered collections library. Video of the issue: https://youtu.be/JW8dHqawURA import Foundation import OrderedCollections import SwiftUI struct ContentView: View { private let calendar: Calendar private let dateFormatter: DateFormatter @State var weeks: OrderedDictionary @State var selectedWeek: WeekView.Week.ID init() { let calendar = Calendar.autoupdatingCurrent self.calendar = calendar let formatter = DateFormatter() formatter.calendar = calendar formatter.dateFormat = MMM d dateFormatter = formatter // Setup initial week let currentDate = Date() let weekIdentifier = Self.weekIde
1
0
543
Apr ’24
Sonoma CPU panic
panic(cpu 1 caller 0xfffffff017a8bf60): x86 CPU CATERR detected Debugger message: panic Memory ID: 0xff OS release type: User OS version: 21P3049 macOS version: 23D60 Kernel version: Darwin Kernel Version 23.3.0: Wed Dec 20 22:31:16 PST 2023; root:xnu-10002.81.5~10/RELEASE_ARM64_T8010 KernelCache UUID: 5055C553638BB2B9A72F9B074650402D Kernel UUID: 98C51133-18A2-37CC-8054-0C2A5A0CC992 Boot session UUID: 10AF6C85-ABD5-4EFC-B894-FCA5526A15B3 iBoot version: iBoot-10151.81.1 secure boot?: YES roots installed: 0 x86 EFI Boot State: 0xd x86 System State: 0x0 x86 Power State: 0x0 x86 Shutdown Cause: 0x5 x86 Previous Power Transitions: 0x10001000100 PCIeUp link state: 0x89473614 macOS kernel slide: 0xa400000 Paniclog version: 14 Kernel slide: 0x0000000011820000 Kernel text base: 0xfffffff018824000 mach_absolute_time: 0x11dabe93a329 Epoch Time: sec usec Boot : 0x65fa28af 0x00067d4f Sleep : 0x660be300 0x0005f658 Wake : 0x660be3c7 0x000e9358 Calendar: 0x660e9064 0x000acc96 Zone info: Zone map: 0xffffffddcf6fc000
1
0
827
Apr ’24