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

Package using cocoapods to make it easier to consume in other applications #7

Open
shankari opened this issue Apr 15, 2020 · 8 comments

Comments

@shankari
Copy link

The client is currently packaged using Swift Package Manager. Not everybody uses SPM, and packaging as cocoapods will increase the number of 3rd party apps that can consume the library.
@zssz can you confirm that this is in line with your roadmap for the project?

@shankari
Copy link
Author

If so, feel free to assign to me.

@shankari
Copy link
Author

I'm going to get started with this anyway, and @zssz can disapprove later if he likes.

@shankari
Copy link
Author

The recommended way to create a cocoapod is pod lib create [pod name].
https://guides.cocoapods.org/making/making-a-cocoapod.html
It will create a structure different from the current code structure, but I can always edit the podspec later to make it match what is current. I don't plan to move files around in the final PR unless I have to.

@shankari
Copy link
Author

Documenting other config options for the record:

  • for library name, I copied name: "TCNClient", from the SPM spec
  • wrt testing framework, the only two supported options were [ Quick / None ]. This project uses XCTest, so I picked None.
  • Would we like to do view based testing? Sure, why not? Easier to delete than to add.

@shankari
Copy link
Author

This then created a TCNClient directory in the root of the repo, with the expectation that the code should be there.

ls -lr TCNClient/
total 24
lrwxr-xr-x  1 shankari  649427843    27 Apr 14 18:25 _Pods.xcodeproj -> Example/Pods/Pods.xcodeproj
-rw-r--r--  1 shankari  649427843  1593 Apr 14 18:25 TCNClient.podspec
drwxr-xr-x  4 shankari  649427843   128 Apr 14 18:06 TCNClient
-rw-r--r--  1 shankari  649427843   922 Apr 14 18:25 README.md
-rw-r--r--  1 shankari  649427843  1081 Apr 14 18:25 LICENSE
drwxr-xr-x  9 shankari  649427843   288 Apr 14 18:25 Example

I'm going to move things out and edit paths.

@shankari
Copy link
Author

It looks like the CovidWatch client iOS app does not currently consume this package since it uses cocoapods for dependencies. Maybe making this change will allow it to consume via cocoapods?
https://github.com/covid19risk/covidwatch-ios

@shankari
Copy link
Author

shankari commented Apr 15, 2020

@zssz is there a version number (e.g. v0.1.0) for this library? I don't see one set in Package.swift. I'd like to make SPM and cocoapods be consistent, for obvious reasons.

@shankari
Copy link
Author

Ok, I have an initial build working. Everything looks fine except for a WARNing about UnsafeBufferPointer. I looked to see how this had been handled in the original code and there is no DataRepresentable.swift anywhere else. At this point, I'm just checking in the podspec and not changing any code.

 -> TCNClient (0.1.0)
    - NOTE  | xcodebuild:  note: Using new build system
    - NOTE  | xcodebuild:  note: Building targets in parallel
    - NOTE  | [iOS] xcodebuild:  note: Planning build
    - NOTE  | [iOS] xcodebuild:  note: Constructing build description
    - NOTE  | [iOS] xcodebuild:  warning: Skipping code signing because the target does not have an Info.plist file and one is not being generated automatically. (in target 'App' from project 'App')
    - WARN  | [iOS] xcodebuild:  /Users/shankari/OSS/tcn-client-ios/Sources/TCNClient/Crypto/DataRepresentable.swift:34:29: warning: initialization of 'UnsafeBufferPointer<Self>' results in a dangling buffer pointer
    - NOTE  | [iOS] xcodebuild:  /Users/shankari/OSS/tcn-client-ios/Sources/TCNClient/Crypto/DataRepresentable.swift:34:56: note: implicit argument conversion from 'Self' to 'UnsafePointer<Self>?' produces a pointer valid only for the duration of the call to 'init(start:count:)'
    - NOTE  | [iOS] xcodebuild:  /Users/shankari/OSS/tcn-client-ios/Sources/TCNClient/Crypto/DataRepresentable.swift:34:56: note: use 'withUnsafePointer' in order to explicitly convert argument to pointer valid for a defined scope
    - NOTE  | [iOS] xcodebuild:  note: Execution policy exception registration failed and was skipped: Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted" (in target 'TCNClient' from project 'Pods')
    - NOTE  | [iOS] xcodebuild:  note: Execution policy exception registration failed and was skipped: Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted" (in target 'Pods-App' from project 'Pods')
    - NOTE  | [iOS] xcodebuild:  note: Execution policy exception registration failed and was skipped: Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted" (in target 'App' from project 'App')

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

No branches or pull requests

1 participant