What’s New in Swift 5.8, Xcode 14.3 & iOS 16.4

Uplift iOS Interview

The Guide is for YOU if
  • You are preparing for an iOS interview and want to improve your skills and knowledge and looking to level up your interview game and land your dream job.
  • You want to gain confidence and ease during iOS interviews by learning expert tips and curated strategies.
  • You want access to a comprehensive list of iOS interview QA to practice and prepare.

Swift 5.8 is set to release with a host of new features and improvements, including implicit self for weak self captures, conditional compilation for attributes, and the addition of the new type StaticBigInt to the standard library.

  • Swift brings a new feature to the table with SE-0376, allowing for smooth backwards compatibility for functions, methods, and subscripts. With the new backDeployed(before: …) attribute, developers can indicate that a copy of the function should be emitted into the client, to be used at runtime when executing on an OS prior to the version identified with the before: argument. This means developers can use backDeployed to ensure the smooth functioning of their app on older versions of iOS, without compromising on newer versions. For instance, in the example below, the backDeployed attribute ensures that greet() function will be available for use on iOS versions 13.0 to 16.0.
struct HelloWorld {
  @available(iOS 13.0, *)
  @backDeployed(before: iOS 16.0)
  public func greet() {}
}
  • The new StaticBigInt type in SE-0368, will pave the way for adding even more integer types in the future. This update is a game-changer and will make handling larger integer types an absolute breeze.
  • SE-0372 is also bringing in some fantastic changes to Swift’s sorting functions. The update marks them as stable, ensuring that if two elements in an array are considered to be equal, they will remain in the same relative order in the sorted array. This means that they will stay together in the sorted array, maintaining their original order.
  • Are you tired of writing ‘self’ in your closures, even after capturing it weakly? Well, good news for you! With the introduction of SE-0365, you can now allow implicit self for weak self captures, after self is unwrapped.This update is a significant step towards simplifying the closure syntax and making our code more concise and readable.
  • If you’ve ever dealt with Clock existentials, you may have noticed a slight imbalance between the sleep APIs for clocks and tasks. With the introduction of SE-0374 in the latest release, we now have a solution: the addition of a new sleep(for:) method to Clock. This new method deals only with durations, not instants, making it easier to use on an existential.
  • SE-0274 introduces a new format for the #file magic identifier. Instead of using the entire path to the Swift file, the format Module/Filename (e.g., CreativeCanvas/ContentView.swift) will be used. Previously, #file contained the whole path, e.g. /Users/Ishtiak/Desktop/AppDev/CreativeCanvas/ContentView.swift. This new format is much shorter and less revealing of sensitive information.
  • Debugging with print statements is a go-to technique for many developers, and it’s now even easier to use in SwiftUI Previews with Xcode 14.3. When you use print statements in your code, the output will appear in the console for your SwiftUI Previews. To access it, simply select the “Previews” tab in the console. This enhancement makes it quicker and more convenient to debug and refine your SwiftUI code.
  • iOS 15 brought us the delightful .presentationDetents feature, giving us the ability to showcase a sheet that is not full-sized. But, unfortunately, we were unable to interact with the view behind the sheet, leaving us yearning for more. Luckily, iOS 16.4 came to our rescue with the brilliant .presentationBackgroundInteraction(.enabled) modifier, making it possible to interact with the view behind the sheet. Additionally, the update addressed the pesky issue of sheet resizing taking precedence over a scroll view embedded in the sheet. Now, with the .presentationContentInteraction(.scrolls) modifier, scrolling can take precedence over sheet resizing. Plus, the presentationBackground(:) modifier lets us make the sheet background translucent, which is fantastic! And, as if that wasn’t enough, we can now adjust the corner radius of a sheet using the .presentationCornerRadius() modifier, making our UIs even more attractive. Finally, the new .presentationCompactAdaptation(:) modifier allows us to control this behavior. These updates are bound to make many iOS developers extremely happy!



✍️ Written by Ishtiak Ahmed

👉 Follow me on XLinkedIn



Get Ready to Shine: Mastering the iOS Interview




Enjoying the articles? Get the inside scoop by subscribing to my newsletter.

Get access to exclusive iOS development tips, tricks, and insights when you subscribe to my newsletter. You'll also receive links to new articles, app development ideas, and an interview preparation mini book.

If you know someone who would benefit from reading this article, please share it with them.