In addition to this merged PR, using canImport() is an improvement because it lets you focus on what functionality you want rather than what operating system.
So, for example, if UIKit becomes available on macOS tomorrow you won’t need to change your code to use it.
P.S.: Something similar happened for the visionOS already.
In addition to this merged PR, using
canImport()
is an improvement because it lets you focus on what functionality you want rather than what operating system.So, for example, if
UIKit
becomes available onmacOS
tomorrow you won’t need to change your code to use it.P.S.: Something similar happened for the visionOS already.