Is there a way to create a "macro" or something so I don't have to have this code in EVERY file of a multi-target project? somehow I can predefine it once, and use a single line shortcut everywhere?
#if !os(macOS)
import UIKit
#else
import Cocoa
#endif
import Foundation
One solution would be to create a "shim" framework that re-exports UIKit or Cocoa. The framework OpenCombine uses this technique and creates a module with a single Swift file that reads: