The current advice on https://developer.apple.com/documentation/swift/managing-a-shared-resource-using-a-singleton actively encourages people to use global class instances, using the singleton pattern.
Singletons are fine if managed sensibly, but global variables used in this way are a horrible idea, because they introduce global state and coupling that basically makes code untestable. These are huge drawbacks of the global singleton approach that absolutely need to be mentioned; the cost of convenience is often untestable, hard-to-reason-about spaghetti code.
Even the mentioned example, of a class to make HTTP requests, is perhaps one of the worst examples that could be given, as this will make it near-impossible to swap out the client and not make real requests during tests.
This documentation should really be updated to reflect modern software development practices - automated testing is kind of a thing these days.
See also:
- https://www.swiftbysundell.com/articles/avoiding-singletons-in-swift/
- https://matteomanferdini.com/swift-singleton/