The way I would like to see this spelled is:
weak import UIKit //Only imports UIKit if it has been (non-weakly) imported elsewhere in the project
// Do UIKit specific stuff here
As a framework author, this allows me to provide implementations for different platforms, without adding a requirement to the user of the framework. Thus I can support UIKit, Cocoa, or even just Foundation (if they are working on a command line tool or something). It also allows me to add extra compatibility with 3rd party frameworks (e.g. Facebook’s Pop) without requiring my users to use it. It lets me build a network of frameworks that can work together without forcing the entire network to be included in every project.
The problem with canImport() is that there are times where something could be imported, but it isn’t wanted in that particular case. Think command line tools, XPC, etc…. In those cases, you want to import the minimum necessary, and you may need the basic functionality of a framework without it pulling in something like Cocoa.
Weak import + imported() should still cover all of your use-cases though. All it requires is that one of the files in the entire project directly import the framework, and I can’t think of a case where that wouldn’t happen naturally.