Generating formatted string representations of various kinds of values can often be quite tricky, especially if we want those strings to be fully adapted to the user’s language, locale and other system-wide preferences.
Thankfully, Apple ships a quite comprehensive suite of fully localized formatters as part of each of their platforms […] in this article, let’s instead explore some of the lesser-known
Formatter
subclasses, and how they can prove to be incredibly useful in certain situations.
If we go to Apple’s documentation for URL’s
init(string:)
method, then this comes with a huge yellow banner describing new behavior in iOS 17.
Data Protection is an iOS feature that is automatically enabled the moment a passcode is set on the device. As this is enabled automatically, you get a lot of encryption support for free on your apps. You do not need to do anything especial when reading and writing files to ensure they are protected by Data Protection. Instead, you just use all reading and writing APIs as you would normally do, and the system will take care of encryption on the fly for you. This process is automatic, and when available, they use hardware-accelerated features.
This is slightly misleading, though. Despite what the preview shows, Date has no concept of days, months, years, any of that stuff. It deals solely with time, and more specifically, the number of seconds that have passed since midnight of 1 January 2001, in UTC.