Skip to content
Snippets Groups Projects
Paulo Oliveira's avatar
Paulo Oliveira authored
Update file NpawPluginTritonAdapter.podspec

See merge request !18
354fbaaa

NpawPluginTritonAdapter

Welcome to the NpawPluginTritonAdapter integration guide. This library facilitates seamless interaction with the Triton framework. Below you'll find comprehensive steps on how to integrate this library into your project using CocoaPods and Swift Package Manager, alongside setting up the accompanying demo.

Repository Sources:

Before integrating the library, ensure you've added the necessary repository sources to your CocoaPods:

source 'https://repo.plugin.npaw.com/release/plugin-ios-cocoapods.git'
source 'https://cdn.cocoapods.org'

Integration with CocoaPods:

1. Add the library to your Podfile:

Include the following pods:

# Pods for your project
pod 'NpawPluginPkg'
pod 'NpawPluginTritonAdapter'

2. Workaround for CocoaPods:

Due to a specific configuration with the NpawPluginTritonAdapter, you will need to add a post-install script to your Podfile:

post_install do |installer|
    target = installer.pods_project.targets.find { |t| t.name == "NpawPluginTritonAdapter" }
    
    if target
        framework_path = File.expand_path("Frameworks/TritonPlayerSDK.xcframework", __dir__)
        file_ref = installer.pods_project.new_file(framework_path)

        # Add to the main group (root) if you want
        installer.pods_project.main_group.children << file_ref

        # Create or find the Frameworks group and add the file reference to it
        frameworks_group = installer.pods_project.groups.find { |g| g.name == 'Frameworks' } || installer.pods_project.new_group('Frameworks')
        frameworks_group.children << file_ref

        # Ensure the framework is linked in your target
        target.frameworks_build_phase.add_file_reference(file_ref)
    end
end

Make sure to place the TritonPlayerSDK.xcframework in the recommended path. As a suggestion, create a folder named Frameworks in the root directory of your project and place the .xcframework there. The path should then look like this: Frameworks/TritonPlayerSDK.xcframework.

Integration with Swift Package Manager:

1. Open your project in Xcode and navigate to File > Swift Packages > Add Package Dependency.

2. In the search bar, enter the following URL:

https://git.codavel.com/release/plugin-ios-triton-adapter

3. Follow the on-screen instructions to add NpawPluginTritonAdapter as a package dependency.

4. Download TritonPlayerSDK.xcframework from the provided link and add it to your project:

  • Drag and drop TritonPlayerSDK.xcframework into the Frameworks, Libraries, and Embedded Content section under General settings of your target.

NpawTritonDemo (Example)

Within the project, an example demo named NpawTritonDemo can be found at Examples/NpawTritonDemo. This demo can be configured using either the Swift Package Manager (SPM) or CocoaPods.

Setting up with Swift Package Manager (SPM):

  1. Open the Project:

    open NpawTritonDemo.xcodeproj
  2. Download the Triton XCFramework:

  3. Add the Framework to the Project:

    • Navigate to NpawTritonDemo -> General -> Frameworks, Libraries, and Embedded Content.
    • Drag and drop the downloaded TritonPlayerSDK.xcframework.
  4. Add the Package Dependency:

    • Go to NpawTritonDemo -> Project -> Package Dependencies.
    • Click on the '+' and add the following URL:
      https://git.codavel.com/release/plugin-ios-triton-adapter

Setting up with CocoaPods:

  1. Download the Triton XCFramework:

  2. Setup the Framework Folder:

    • Create a folder named Frameworks within Examples/NpawTritonDemo.
    • Copy the downloaded TritonPlayerSDK.xcframework into this folder. Ensure the path Examples/NpawTritonDemo/Frameworks/TritonPlayerSDK.xcframework exists.
  3. Install the Pods:

    pod install
  4. Open the Workspace:

    open NpawTritonDemo.xcworkspace
  5. Link the Triton Framework:

    • Navigate to NpawTritonDemo -> General -> Frameworks, Libraries, and Embedded Content.
    • Drag and drop TritonPlayerSDK from the Pods/TritonPlayerSDK directory.