Post

Replies

Boosts

Views

Activity

Comment on IOS warning: instance method 'userNotificationCenter(_:willPresent:withCompletionHandler:)' nearly matches optional requirement
I created a new empty project manually, created a class conforming to UNUserNotificationCenterDelegate and implemented this method - I don't get any warnings. But in a cmake generated project, I get these warnings. The above warnings are in a cmake generated Xcode project (apologies for not mentioning). But any idea what could be the difference?
Feb ’24
Comment on Swift Exception Handling in Apple OSes
Thanks for the response. I've gone through your other post have some clarifications. "Catching machine exceptions is super hard and it only makes sense in very specific circumstances, for example, when you’re working on a language runtime" - I was able to capture these machine exceptions (I've only tried with 2 signals, not all) in C++ using Signal handler mechanism. Is that okay?
2w
Comment on Swift Exception Handling in Apple OSes
Quoting from your other post - "Swift has no facilities for dealing with language exceptions. The exception-like mechanisms you see in Swift are actually syntactic sugar on the Cocoa error facilities (more on that below)". Question: So, the errors I've mentioned in this post, like, - Array's out of index, division by zero etc... there are no ways to handle these kinds of errors, which are programmer bugs, in Swift. Is that right?
2w
Comment on Swift Exception Handling in Apple OSes
And when I encounter a Swift function that throws, then Swift's try and do-catch should be used. Errors like nil references should be handled using Optionals, which are unwrapped carefully using guard-let, if-let and nil coalescing operator. In this way, all possible exceptions/errors except for programming errors, can be handled in Swift. Is my understanding, right?
2w
Comment on Swift Exception Handling in Apple OSes
I'm not trying to do anything complex. If the signal handler is invoked with a signal like SIGSEGV or SIGBUS, then there's nothing much to do but to log some diagnostic info and set the default signal handler, which terminates the process. If the signal handler is invoked with SIGINT (This happens when user launches GUI app from terminal and pressed Ctrl/Cmd + C), then I want to ignore it. This is just a contrived example, but would need to think about other relevant signals and actions
2w