Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MacCatalyst support #96

Closed
innoreq opened this issue Sep 22, 2019 · 7 comments
Closed

MacCatalyst support #96

innoreq opened this issue Sep 22, 2019 · 7 comments

Comments

@innoreq
Copy link

innoreq commented Sep 22, 2019

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.
        .library(
            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.
        .target(
            name: "Log",
            dependencies: []),
        .testTarget(
            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

@weissi
Copy link
Member

weissi commented Sep 22, 2019

I think this is an SDK bug in Xcode unfortunately. Please file a Feedback Request for this.

@weissi
Copy link
Member

weissi commented Sep 22, 2019

If that turns out to be true, then it's good that it's "just" and SDK bug because SDK bugs can be fixed by using a newer Xcode release, I don't think the bug is in the OS itself (which would be a bigger issue).

@weissi
Copy link
Member

weissi commented Sep 22, 2019

@innoreq yes, I think the issue is the presence of those:

$ find /Applications/Xcode.app/ -name 'Logging.framework' -type d
/Applications/Xcode.app//Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/Logging.framework
/Applications/Xcode.app//Contents/Developer/Platforms/WatchOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/watchOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/Logging.framework
/Applications/Xcode.app//Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/Frameworks/Logging.framework

despite the fact that they don't actually exist on the OSes if I'm not mistaken. I don't think Logging.framework should actually be part of any SDKs but clearly they are in Xcode 11.0.

@weissi
Copy link
Member

weissi commented Sep 25, 2019

@innoreq hmm, actually, I just tried that and it works just fine for me. See the gif below where I create an iOS app with swift-log which I then use for Catalyst just fine:

ezgif-5-469770c97da1

@weissi
Copy link
Member

weissi commented Sep 25, 2019

@innoreq I would suggest to start with a normal Xcode app project and to then add the swift-log dependency through File -> Swift Packages -> Add Package Dependency. Like this:

ezgif-5-460f405cae89

@weissi
Copy link
Member

weissi commented Dec 13, 2019

@innoreq is this still an issue?

@weissi
Copy link
Member

weissi commented Jun 17, 2020

I think this is done.

@weissi weissi closed this as completed Jun 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants