Skip to content
This repository has been archived by the owner on Sep 24, 2024. It is now read-only.

SwiftUI Previews

MarcoEidinger edited this page Jul 30, 2021 · 1 revision

SwiftUI Previews do not work with the current package manifest setup.

You may encounter an error during building the SwiftUI preview in Xcode, Failed to build .swift (Linking failed: no such file or directory: '.../DerivedData/cloud-sdk-ios-cai-.../Build/Intermediates.noindex/Previews/SAPCAI/Products/Debug-iphonesimulator/PackageFrameworks/...

Please adjust Package.swift to make SwiftUI Previews work for scheme "SAPCAI"

    // ...
    products: [
        .library(
            name: "SAPCAI",
            targets: ["SAPCAI"] // CHANGED !!! (previous: "SAPCAI-withBinaryDependencies")
        ),
        // ...
    ],
    dependencies: [
        .package(name: "URLImage", url: "/~https://github.com/dmytro-anokhin/url-image", .upToNextMajor(from: "2.0.0")),
        .package(name: "Down", url: "/~https://github.com/johnxnguyen/Down", .upToNextMinor(from: "0.11.0")),
        .package(name: "cloud-sdk-ios", url: "/~https://github.com/SAP/cloud-sdk-ios", .exact("5.1.3-xcfrwk"))
    ],
    targets: [
        // ...
        .target(
            name: "SAPCAI",
            dependencies: [
                "URLImage",
                "Down",
                .product(name: "SAPFoundation", package: "cloud-sdk-ios"), // ADDED !!!
                .product(name: "SAPCommon", package: "cloud-sdk-ios")      // ADDED !!!
            ],
            resources: [
                .process("Foundation/Utility/Font/SAP-icons.ttf"),
                .process("UI/Common/VideoPlayer/YTPlayer.html")
            ]
        ),
        // ...
    ]
)
Clone this wiki locally