AgoraIO / AgoraRtcEngine_iOS

iOS Package for Agora Video RTE SDK. Perfect for video calls and live streaming.
https://agoraio.github.io/AgoraRtcEngine_iOS/
MIT License
58 stars 17 forks source link

How to use this framework at SPM project? #21

Closed canbalkaya closed 2 years ago

canbalkaya commented 2 years ago

I tried to use this framework in my SPM project, but this error came our: product 'AgoraRtcKit' required by package 'PROJECT_NAME' target 'TARGET_NAME' not found.

My Package.swift file is like this:

let package = Package(
    name: "PROJECT_NAME",
    platforms: [.iOS(.v13)],
    products: [.library(name: "LIBRARY_NAME", targets: ["TARGET_NAME"])],
    dependencies: [
        .package(url: "https://github.com/AgoraIO/AgoraRtcEngine_iOS.git", from: "3.7.0"),
    ],
    targets: [
        .target(
            name: "TARGET_NAME",
            dependencies: [
                "AgoraRtcKit",
            ]
        ),
        .testTarget(name: "PROJECT_NAME", dependencies: ["PROJECT_NAME"]),
    ],
    swiftLanguageVersions: [.v5]
)

How can I fix this error?

canbalkaya commented 2 years ago

I found the solution. There are no dependency that named as "AgoraRtctKit". I changed Package.swift like below:

let package = Package(
    name: "PROJECT_NAME",
    platforms: [.iOS(.v13)],
    products: [.library(name: "LIBRARY_NAME", targets: ["TARGET_NAME"])],
    dependencies: [
        .package(url: "https://github.com/AgoraIO/AgoraRtcEngine_iOS.git", from: "3.7.0"),
    ],
    targets: [
        .target(
            name: "TARGET_NAME",
            dependencies: [
                .product(name: "RtcBasic", package: "AgoraRtcEngine_iOS"),
            ]
        ),
        .testTarget(name: "PROJECT_NAME", dependencies: ["PROJECT_NAME"]),
    ],
    swiftLanguageVersions: [.v5]
)
maxxfrazer commented 2 years ago

For future reference, the Agora UIKit (soon to be renamed Video Starter Kit) is a good example of using this:

https://github.com/AgoraIO-Community/iOS-UIKit/blob/main/Package.swift