Search results for

calendar

1,868 results found

Post

Replies

Boosts

Views

Activity

iOS15 UIDatePicker shows strange year
Xcode13 and iOS15 Chinese calendar UIDatepicker the year of 2021 will become 38, how to change it back to 2021 in UIDatepicker datePicker.datePickerMode = .date datePicker.locale = Locale.init(identifier: zh) datePicker.calendar = Calendar(identifier: .chinese)
Topic: UI Frameworks SubTopic: UIKit Tags:
2
0
1.7k
Oct ’21
Reply to iOS15 UIDatePicker shows strange year
let datePicker = UIDatePicker() datePicker.locale = .current datePicker.datePickerMode = .date datePicker.preferredDatePickerStyle = .wheels datePicker.locale = Locale(identifier: zh) datePicker.calendar = Calendar(identifier: .chinese) The same code I got different result in iOS15 and iOS 14.2. The year become38 but not 2021 in iOS 15
Topic: UI Frameworks SubTopic: UIKit Tags:
Oct ’21
Reply to iOS15 UIDatePicker shows strange year
I tested your code in an app. I get a correct 2021 date as shown below: But you're right, when I select a date, I get a different year (and month) I did the same test with Xcode 12 / iOS 14.4 and got the same problem. So it is not an iOS 15 bug. I removed datePicker.calendar = Calendar(identifier: .chinese) And it worked well. It is not a bug. The reason is that chinese calendar is sexagenary based. If you don't specify era, you get a value between 1 and 60 ! So, setting calendar to .chinese make you display dates (as at top left of the view) in the current era. Read this: https://stackoverflow.com/questions/60936744/how-to-convert-gregorian-dates-to-chinese-not-sexagenary-cycle-in-swift What is the Month and Day of Chinese New Year for a Gregorian year?. In my journey I learned that the Chinese calendar follows the sexagenary cycle of 60year eras. Era is an important concept because you need to use it to get to the right Gregorian year. Not specifying the an Era on the Chi
Topic: UI Frameworks SubTopic: UIKit Tags:
Oct ’21
Xcode12 iOS 14 Date Picker UI Testing adjust toPickerWheelValue issue
I am getting this UI Testing error when I try to adjust the month-year calendar in new compact date picker. Assertions: Assertion Failure at ***.swift:4: Unsupported picker wheel 2020 PickerWheel of type 6 My code is let compactDatePicker = self.app.descendants(matching: .any)[Date Picker] compactDatePicker.tap() self.app.buttons[Show year picker].tap() self.app.pickerWheels.element(boundBy: 1).adjust(toPickerWheelValue: 2020) self.app.pickerWheels.element(boundBy: 0).adjust(toPickerWheelValue: September) self.app.buttons[Hide year picker].tap() let calendarDateButton = self.app.buttons.containing(NSPredicate(format: label CONTAINS '%d %@', 27, September) calendarDateButton.tap() self.app.swipeDown() I have no idea what this error means. I am just guessing this should be a bug in Xcode 12.0. Anyone can help me to have a look on this?
6
0
4.8k
Oct ’21
Reply to Calendar's date(bySetting:value:of:) returns nil when changing year
I thought two dropdown buttons would be nicer, so I used two NSPopUpButtons, one which contains a list on month names, and one with a list of years. In that case I recommend that you use these values to build a set of date components and then run that through the calendar to produce a new date each time. That’s much easier (and more performant) than dealing with date(bySetting:value:of:). For example: let m = 7 let y = 2020 let dc = DateComponents(year: y, month: m, day: 1, hour: 12) let d = Calendar(identifier: .gregorian).date(from: dc) print(d) // -> Optional(2020-07-01 11:00:00 +0000) Note how I’m pinning the day and hour. Pinning the day isn’t really necessary but pinning the hour is important because, depending on your time zone, you may end up landing on a date that doesn’t exist (some folks transition to DST at midnight). If you want the start of the day, call Calendar.startOfDay(for:). Also, I’m hard wiring Gregorian here. If you use Calendar.current you will encounter users who
Topic: App & System Services SubTopic: General Tags:
Oct ’21
Ptrauth failure with IA key panic on M1 using IOKit
I have a driver that was written with IOKit. It works fine on BigSur with an Intel Processor. It is compiled as a universal binary. Each time I try to use kextload to load the kext, the machine crashes with the following.... panic(cpu 5 caller 0xfffffe001e0b9320): Break 0xC470 instruction exception from kernel. Ptrauth failure with IA key resulted in 0xbffffe001cbc0630 at pc 0xfffffe001df2a5d4, lr 0x0addfe001df2a548 (saved state: 0xfffffe306b8c34e0) x0: 0xfffffe306b8c3860 x1: 0x0000000000000000 x2: 0x0000000000000000 x3: 0xfffffe306b8c3890 x4: 0x0000000000000000 x5: 0x0000000000000000 x6: 0x00626778632e7265 x7: 0x0000000000000d80 x8: 0x000000000000000c x9: 0xfffffe0020892df8 x10: 0x00000000016a016a x11: 0x0000000000000001 x12: 0x00000000016a016a x13: 0x000000000000016a x14: 0xfffffe16669f5448 x15: 0x00000000016a016b x16: 0xbffffe001cbc0630 x17: 0xfffffe001cbc0630 x18: 0x0000000000000000 x19: 0xfffffe233197ee60 x20: 0x0000000000000001 x21: 0x0000000000000001 x22: 0x8a8afe001cbc0630 x23: 0xfffffe001cb90000 x24:
2
0
1.4k
Sep ’21
Reply to Xcode 13 - warning: Could not read serialized diagnostics file: error("Invalid diagnostics signature")
I also have the Could not read serialized diagnostics file: error(Invalid diagnostics signature) warning. I've tried a few improvements with restarting Project after deleting it's xcuserdata. Thank you for posting this Question, hope it gets resolved as soon as possible. I WILL be back frequently on the status of the Question. It's on my Calendar. How many other Developers have the same situation?
Topic: Programming Languages SubTopic: Swift Tags:
Sep ’21
iOS App Create Custom Calendar prompt dilemma
Hi all, I'm writing an iOS app for the iPhone and iPad and it's basically done. I'm going through lots of regression testing and I'm sort of stuck on a scenario that I'm not sure of the most elegant way to handle it. My app uses a custom calendar, EKCalendar, for my users to do scheduling. When the user first launches the app, it prompts the user to enter a custom calendar name. I don't want them to default to the standard apple Calendar because it will mix appointments with my app when I display their appointments for this app. Should I force them to enter a custom calendar name or should I allow them to just default to the 'Calendar' for their scheduling? And then maybe down the road offer an update where they can change this custom calendar name as I am storing it using CoreData.
1
0
895
Sep ’21
Reply to iOS App Create Custom Calendar prompt dilemma
Ok, I solved this overnight with some quality sleep. Instead of forcing the user to enter an arbitrary Calendar name, I'm just going to set the custom calendar to the name of the app so they don't have to deal with it. I was also debating on how to handle the app if the user chooses don't allow for access to the Calendar request and now I will just prompt them if they try to go in to the section of the app that uses the calendar and I will inform them that they need to go into the settings to enable the Calendar for this application versus some other initial more extreme options of quitting the app or disabling the front end. After further thought and reading, I determined that a better practice is to let the user still use the other parts of the app and prompt them on the section they can't access with a solution to correct this if they changed their mind and wanted to now allow access to the calendar.
Topic: Programming Languages SubTopic: Swift Tags:
Sep ’21
EventKit - Display calendar events & reminders
Hello All, It appears I've hit a dead-end in developing a scheduling app in terms of utilizing the Date Picker control as a calendar that actually functions like the apple calendar. It also appears the EventViewController will only display one event versus an array of events??? So in order to list events/reminders in an app, we have to build this out in a table view or stack view??? I'm finding it hard to believe we can't simulate the current calendar display that when you click on a day, it will display that days events/reminders and have the 7 day view on top of it, etc... Also, I did look at the calendar kit in CocoaPods. I was hoping to build my own using EventKit though. Lastly, I was going to post a screenshot of this calendar/schedule image from an iPhone 11 simulator but it looks like we can't post screen shots in here???
2
0
1.9k
Sep ’21
Reply to Date in Swift printed is wrong
Mm, comments don't format very well. Here it is again.... let currentHour = Calendar.current.component(.hour, from: Date()) if currentHour < 12 {print(now is morning)} This gets the hour, as an Integer, from the current local time, i.e. the Calendar function converts the UTC time to the user's current timezone and summertime (or not) settings. I suggest that you experiment with Date formatting and with Calendar in a Playground.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Sep ’21
List updates very slowly and blocks UI
I am building an app using SwiftUI that should display work orders I get from a web service. I have successfully got them from a web service using the following function:func getAllWorkOrders(completion: @escaping ([WorkOrder]) -> ()) { guard let url = URL(string: http://somedomain/api/workOrders) else { fatalError(URL is not correct) } let conn = URLSession(configuration: URLSessionConfiguration.ephemeral, delegate: self, delegateQueue: nil) conn.dataTask(with: url) { data, _, _ in let decoder = JSONDecoder() decoder.dateDecodingStrategy = .formatted(DateFormatter.iso8601Full) let workOrders = try! decoder.decode([WorkOrder].self, from: data!) DispatchQueue.main.async { completion(workOrders) } }.resume() }while my WorkOrder struct look like this:struct WorkOrder: Identifiable, Codable { var id: Int var ticket: Int? var date: Date var description: String var astue: Bool var state: WorkOrderState var jobs: [WorkOrderJob] var project: Project }I have also created a view model which looks like this:class Wor
8
0
4.9k
Sep ’21
Error on main view implementing List
Hello, I don't know why I'm getting the error Failed to produce diagnostic for expression, I have use the List before on a similar way and can't find the error. I'll appreciate some help Working with Xcode 12.5.1 If I Change the List to this it works: List(1 ..< 6) { mood in HStack { Text(Hola) .frame(width: 200, height: 50, alignment: .leading) } } MoodScreen.swift import SwiftUI struct MoodScreen: View { @State private var addMoodModal = false var body: some View { VStack { VStack { MoodView(addMoodModal: $addMoodModal) .sheet(isPresented: $addMoodModal, content: { AddNewMoodScreen(addMoodModal: $addMoodModal) }) MoodListView() Spacer() } } .navigationTitle(Mood summary) .embedInNavigationView() } } struct MoodScreen_Previews: PreviewProvider { static var previews: some View { MoodScreen() } } MoodListView.swift import SwiftUI struct MoodListView: View { @ObservedObject var moodsScreen = MoodsViewModel() var body: some View { //Error is shown here VStack{ List(moodsScreen.moodsVM) {mood in HStack { Text(
1
0
664
Sep ’21