2020-12-01 22:08

MacCatalyst support

I experience a Catalyst problem - is there a solution or workaround?

Expected behavior

I expected the library to work also in a combined iOS/macOS project (Catalyst).

Actual behavior

I created a lightweight wrapper around the lib and put it into a "Log" Swift Package. For "import Logging", the compiler tells: "Logging is not available when building for Mac Catalyst. Consider using#if !targetEnvironment(macCatalyst)to conditionally import this framework."

SwiftLog version/commit hash

The Package.swift content for the Log wrapper:

import PackageDescription

let package = Package(
    name: "Log",
    products: [
        // Products define the executables and libraries produced by a package, and make them visible to other packages.
            name: "Log",
            targets: ["Log"]),
    dependencies: [
        // Dependencies declare other packages that this package depends on.
        // .package(url: /* package url */, from: "1.0.0"),
        .package(url: "https://github.com/apple/swift-log.git", from: "1.0.0"),
    targets: [
        // Targets are the basic building blocks of a package. A target can define a module or a test suite.
        // Targets can depend on other targets in this package, and on products in packages which this package depends on.
            name: "Log",
            dependencies: []),
            name: "LogTests",
            dependencies: ["Log"]),

Swift & OS version (output of swift --version && uname -a)

Xcode 11.0 (11A419c) / Swift 5 / macOS 10.15 / iOS 13.0


  • 点赞
  • 回答
  • 收藏
  • 复制链接分享