Nets-mobile-acceptance / Netaxept-iOS-SDK

PiA Netaxept iOS SDK is a library that provides the native in-app interactions to accept payments with Netaxept directly from native iOS apps while minimizing PCI DSS requirements for you.
39 stars 7 forks source link

Unable to install using --use-xcframeworks #40

Closed olafandreas-itf closed 2 years ago

olafandreas-itf commented 2 years ago

Problem Releases made up until this point cannot be used together with --use-xcframeworks, this is because the release is missing required meta information and binaries from the release itself.

This SDK does not provide its source code and we are left to unzipping and moving the content of the compressed file(s) manually in scripts during build phase. This is a huge pain point when working with remote CI/CD agents.

Solution A proper solution would be to utilize Carthage´s built-in functionality -> Binary Project Specification

I will give a brief explanation on how you could achieve this:

Step One A binary project specification needs to be made, for example Pia.json:

{
    "2.6.3": "https://github.com/Nets-mobile-acceptance/Netaxept-iOS-SDK/releases/download/2.6.3/Pia.framework.zip?alt=https://github.com/Nets-mobile-acceptance/Netaxept-iOS-SDK/releases/download/2.6.3/Pia.xcframework.zip"
}

When releasing a new version of the framework, a new version:url entry must be added to Pia.json

Step Two When creating the release, the compressed frameworks needs to be added to the release and should not be a part of the source code package itself, but the latter is needed because multiple teams are basing their implementation of this SDK on the fact that the compressed files are a part of the source code.. The name of compressed files needs to have the same name as what's defined in the Pia.json and also need to follow a naming convention defined in the Carthage docs.

Example: Pia.framework.zip previously named PiaSDKFramework.zip Pia.xcframework.zip same as before.

After creating the release, the Assets should include the following files:

Pia.framework.zip
Pia.xcframework.zip
Source code (zip)
Source code (tar.gz) 

Now it should be ready to go

Install as dependency When other teams need to use this SDK, their Cartfile would look something like this:

github "https://github.com/Nets-mobile-acceptance/Netaxept-iOS-SDK" "2.6.3"

Simply run the following code

carthage update --use-xcframeworks

This will target the specific version and Carthage will make sure to download the correct binary based on information given in the Pia.json. The prebuilt framework will be found under Carthage/Build/Pia.xcframework and can be added to Xcode using that file location. No scripts, unzipping or manual labor required :tada:

Miss-PiA commented 2 years ago

Thanks for highlighting the issue. We will get back to you on this

Miss-PiA commented 2 years ago

Thanks for the suggestion. We are working on it.

Miss-PiA commented 2 years ago

We will make the above improvement given by you in our coming Pia iOS SDK v3.0.