I have a Package.swift in my project like:
import PackageDescription let package = Package( name: \"ProjectName\", dependencies: [ .P
Use conditional compilation blocks:
#if canImport(UIKit) // Code specific to platforms where UIKit is available #endif
Source: https://developer.apple.com/documentation/xcode/creating_a_swift_package_with_xcode