Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swift Package Manager Support for v. 1.X #99

Conversation

eduardoperez-nbcuni
Copy link

Description

This PR implements Swift Package Manager support for the version 1.X.

Change Notes

  • Added new class Package.swift to implement the Swift Package manifest.
  • Since SPM doesn't support Objective-C/Swift code on the same target, a new internal target for all the Obj-C classes was created in the Package manifest: HLSObjectiveC.
  • Target mamba is the only target exposed to be implemented. [Please note that HLSObjectiveC target is an internal target for Swift Package Manager support, which is not open to the implementors.]

Screen Shot 2020-11-14 at 3 38 55 PM

  • There was a small re-structure in the folders containing Obj-C classes:
  1. Now they are contained in the mambaSharedFramework/HLS ObjectiveC folder.
  2. Folder HLS ObjectiveC contains an include folder for the publicly exposed headers.
  3. Mamba.xcodeproj was modified to reflect the new folder structure.
  4. mamba.podspec was modified to exclude SPM support files.
  • New class Exports.swift was created. This class exposes Objective-C public headers for Swift use. More information about this in here. In the section EXPOSING YOUR OBJC TO SWIFT USERS
  • Due the "folder structure" nature of SPM, some imports were added to reflect SWIFT_PACKAGE usage.

What is different from previous PR?

  • This new PR points to develop_1.X, instead of release version 1.5.0.
  • No more Symlinks. Now the public headers are present in the include folder.
  • Exports.swift and Package.swift are inside the Mamba.xcodeproj for ease of access. (But please note that in order to build and compile the Swift package, opening the file Package.swift is required. Mamba.xcodeproj cannot build/compile the Swift Package).
  • Instead of multiple internal headers, only two were required this time:
  1. HLSObjectiveC - Target for ObjC code. [This is needed because we can't mix languages in SPM].
  2. HLSParserError. [This is needed because HLSParserError shares error codes to both ObjC and Swift classes, therefore, in order to make it available for Swift and ObjC targets, it needed to be extracted from both to have its own target.]
  3. Added Copyright notices in new classes. (Exports.swift and Package.swift)

Testing Sample Apps
In order to test these changes, I have created these sample apps that implements mamba as:

  1. Carthage - MyMambaAppCarthage folder
  2. Cocoapods - MyMambaAppCocoapods
  3. SPM - MyMambaAppSwiftPackageManager

MambaSamples-develop_1.x.zip

Pre-submission Checklist

  • I ran the unit tests locally before checking in.
  • I made sure there were no compiler warnings before checking in.
  • I have written useful documentation for all public code.
  • I have written unit tests for this new feature.

SPM Support with ObjC target and Swift target.
Added Comcast copyright notice.
Included Package manifest and Exports in project.
Fixed Cocoapods.
Linked headers in pbxproj.
Copy link
Contributor

@dcoufal dcoufal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks so much for the PR! Looks great to me.

@dcoufal dcoufal merged commit d0654ca into Comcast:develop_1.x Nov 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants