am/pm time to 24 hour format

Just convert it to a date using NSDateFormatter and the “h:mm a” format and convert it back to a string using the “HH:mm” format. Check out this date formatting guide to familiarize yourself with this material. let dateAsString = “6:35 PM” let dateFormatter = NSDateFormatter() dateFormatter.dateFormat = “h:mm a” dateFormatter.locale = Locale(identifier: “en_US_POSIX”) // fixes … Read more

LiDAR and RealityKit – Capture a Real World Texture for a Scanned Model

Object Reconstruction 10 October 2023, Apple released iOS Reality Composer 1.6 app that is capable of capturing a real world model’s mesh with texture in realtime using the LiDAR scanning process. But at the moment there’s still no native programmatic API for that (but we are all looking forward to it). Also, there’s a methodology … Read more

How to capture local variable inside an async closure in Swift?

To prevent data races you must use synchronized access to variables from concurrent operations and the compiler doesn’t allow you to change your array directly. To avoid the issue you can implement isolated access to your data with an actor instance e.g.: actor Store { var reviewIds: [Int] = [] func append(ids: [Int]) { reviewIds.append(contentsOf: … Read more

SWIFT TASK CONTINUATION MISUSE: leaked its continuation – for delegate?

This message appears if a continuation you created via withCheckedContinuation, or withCheckedThrowingContinuation doesn’t report success or failure before being discarded. This is will lead to resource leaking: Resuming from a continuation more than once is undefined behavior. Never resuming leaves the task in a suspended state indefinitely, and leaks any associated resources. CheckedContinuation logs a … Read more

Difference between NSRange and NSMakeRange

The only difference between them is that NSRange(location: 0, length: 5) is an initializer for NSRange while NSMakeRange(0, 5) is a function which creates a new NSRange instance (by using the same initializer inside most likely) and actually is redundant in Swift. Swift has simply inherited it from Objective-C. I would stick to the former

Swift protocol extension method is called instead of method implemented in subclass

This is just how protocols currently dispatch methods. A protocol witness table (see this WWDC talk for more info) is used in order to dynamically dispatch to implementations of protocol requirements upon being called on a protocol-typed instance. All it is, is really just a listing of the function implementations to call for each requirement … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)