LogmeinRescue / iOS-SDK

Rescue In-App Support iOS SDK
http://secure.logmeinrescue.com/welcome/webhelp/EN/SDKi/MobileSDK/c_riossdk_overview.html
Other
6 stars 7 forks source link

Add Package.swift and framework sources files #79

Closed jamesdownsjr2913 closed 2 years ago

jamesdownsjr2913 commented 2 years ago

To enable Swift Package Manager (SPM) support should hopefully be fairly straight forward for this project. The changes here show the files needed to be able to distribute the RescueSDK as a binary target through SPM.

This change is based off of the work done by Salesforce and Dext on distributing the Salesforce ServiceSDK as a binary target in this same way: https://github.com/Salesforce-Async-Messaging/Swift-Package-ServiceChat

The given URLs and checksums are not real as the xcframeworks would need to be distributed individually at the root of their respective zip files. See here: https://developer.apple.com/documentation/PackageDescription/Target/binaryTarget(name:url:checksum:)

The additional overhead added here would be that the headers module maps from the xcframeworks would need to be maintained here if they change. The headers and module maps in the Sources folders are from the 5.14 release of the RescueSDK. They are just copied and not modified in any way. Only the LMICoreMedia "include" files are placeholders and would never have to change since there are no public headers at this time.

This change is related to this issue: https://github.com/LogmeinRescue/iOS-SDK/issues/78

jamesdownsjr2913 commented 2 years ago

This pull request as been updated with the correct checksums to match the newly created URLs for the xcframeworks on GitHub.

jamesdownsjr2913 commented 2 years ago

As of now, I've added this branch as a Swift Package dependency on my project and the RescueSDK functions as expected while using it.

exceptioncatcher91 commented 2 years ago

Hi @jamesdownsjr2913,

Thanks for reaching out. Now I'm testing the SPM package integration in a test project, but unfortunately I got an error in RescueSDK.swift: No such module 'RescueBroadcast'. Have you already met with this issue? Did you set something extra in your project?

Thanks for this pr!

jamesdownsjr2913 commented 2 years ago

I had only seen that when including the SDK as part of a Broadcast Extension. Is that where you are seeing it too? Or is it anywhere you try to use it.

I had not seen it since updating the package to use remote xcframeworks rather than my locally downloaded xcframeworks.

I will investigate a little further though to see if there is just something obviously missing here.

exceptioncatcher91 commented 2 years ago

Hi @jamesdownsjr2913

I finally fixed the issue. I tried to integrate the SPM package into an older example project, but when I created a new project, everything worked properly.

I also opened a PR for SPM support which is based on your solution. I had to modify your solution a little bit. The difference is in the Package.swift file: https://github.com/LogmeinRescue/iOS-SDK/pull/80/files#diff-f913940c58e8744a2af1c68b909bb6383e49007e6c5a12fb03104a9006ae677e We should support modularisation (as in case Cocoapods), so that i would define three products (RescueCore, RescueBroadcast, LMICoreMedia) instead of only one.

Daniel

exceptioncatcher91 commented 2 years ago

Hi @jamesdownsjr2913 ,

Just one more question. Why do the wrappers needed? The following Package structure is also working for me (from Objective-C too). https://github.com/LogmeinRescue/iOS-SDK/blob/spm-playground/Package.swift

Daniel

jamesdownsjr2913 commented 2 years ago

@exceptioncatcher91

Good call testing that out. I was using the wrappers when I was doing this with locally downloaded xcframeworks and it wouldn't work without them.

I have tested with your "spm-playground" branch which has the structure you mentioned and it works fine for me. I think you'd be good to go forward with that change instead based off that considering it is less maintenance. You may not need that "Sources" folder at all anymore then.

jamesdownsjr2913 commented 2 years ago

This change was handled by another PR: https://github.com/LogmeinRescue/iOS-SDK/pull/80

Closing.