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

Add CocoaPods support #1685

Open
bourdakos1 opened this issue May 17, 2023 · 11 comments
Open

Add CocoaPods support #1685

bourdakos1 opened this issue May 17, 2023 · 11 comments
Labels
lang: swift An issue with a Swift client library P3 Priority 3 issue (default for bugs or new feature requests; things we'd like to work on) platform: apple An issue with the macOS or iOS implementation project: connections An issue with the Connections project type: feature-request Desire for new functionality

Comments

@bourdakos1
Copy link
Collaborator

What would you like to be added?

Add CocoaPods support as an alternative to Swift Package Manager for Nearby Connections.

Why is this needed?

Frameworks like Flutter and React Native rely on CocoaPods for their plugin system. This makes it nearly impossible to distribute Nearby Connections as a plugin for these frameworks.

@bourdakos1 bourdakos1 added type: feature-request Desire for new functionality needs-triage Issue still needs to be assigned, labeled and deduplicated P3 Priority 3 issue (default for bugs or new feature requests; things we'd like to work on) platform: apple An issue with the macOS or iOS implementation lang: swift An issue with a Swift client library project: connections An issue with the Connections project and removed needs-triage Issue still needs to be assigned, labeled and deduplicated labels May 17, 2023
@bourdakos1
Copy link
Collaborator Author

CC @IgVelasco @eliabruni

@edgarclerigo
Copy link

What's the status of this? Do we have support for cocoapods already available?

@bourdakos1
Copy link
Collaborator Author

We do not have support for cocoapods and no one on the team is working on this yet. Happy to accept contributions if this is something you're interested in helping out with :)

@IgVelasco
Copy link

@bourdakos1 Hi I might try to get this running on my free time, no promises haha

I noticed the following dependencies:

  dependencies: [
    // Dependencies declare other packages that this package depends on.
    .package(
      name: "abseil",
      url: "https://github.com/bourdakos1/abseil-cpp-SwiftPM.git",
      branch: "cxx17"
    ),
    .package(
      name: "BoringSSL-GRPC",
      url: "https://github.com/firebase/boringssl-SwiftPM.git",
      "0.7.1"..<"0.8.0"
    ),
  ],

Is there a reason to continue using your fork? I think the official has the same code as the fork, it also looks like it might be trickier since I think I should add support to both of these dependencies, and maybe another one that I'm missing

@bourdakos1
Copy link
Collaborator Author

Haha no worries, any attempt is greatly appreciated, even if it doesn’t work out 😊

Nearby needs C++17 support, so my fork has a cxx17 branch that compiles abseil with C++17 instead of 14. Otherwise I get a bunch of linker errors (if I remember correctly). However, if you are able to get this building with the main abseil repo, that would be a huge win!

@IgVelasco
Copy link

@bourdakos1 I've been trying to make a pod of NearbyCoreAdapter, with no luck I want to see if I can build it before in order to debug it a little better, could you give me a hand on building the code, there's a BUILD file but not sure how to use it

Thanks for your support

@bourdakos1
Copy link
Collaborator Author

The BUILD file is for Bazel, which I’m not sure if that even works for NearbyCoreAdapter.

I normally use SPM to build. You should just be able to run “swift build” from the repo root. Hope that helps :) don’t hesitate to reach out if you have any other questions on the build process

@IgVelasco
Copy link

I think I hit a big wall right now.

Im not experience in iOS development in the least. But for what I gathered working around with the library is that it does not support simulator. And what I found is that CocoaPods does not have a way to disable said support, I might be wrong but im getting this kind of errors when building NearbyCoreAdapter usingo cocoapods:

 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.4.sdk/usr/include/c++/v1/stdexcept:204:62: error: unknown type name 'string'

@bourdakos1
Copy link
Collaborator Author

Hmm the library should support the simulator. (I’m able to run an app built with the SPM version on the simulator)

“Unknown type name ‘string’” sounds like a C++ header is being exposed to Swift. Do you have a branch I can take a look at?

@IgVelasco
Copy link

Yep that was it, I don't have much of a branch since I'm playing around with it trying to make it work. Now I have a different error but will try to work more on it. Thanks!

This is the podspec that I have for now:

Pod::Spec.new do |s|
  s.name         = 'NearbyCoreAdapter'
  s.version      = '1.0.0'
  s.summary      = 'A summary of your NearbyCoreAdapter package.'
  s.description  = 'A detailed description of your NearbyCoreAdapter package.'
  s.homepage     = 'https://github.com/yourusername/NearbyCoreAdapter'
  s.license      = { :type => 'MIT', :file => 'LICENSE' }
  s.author       = { 'Your Name' => 'your.email@example.com' }
  s.source       = { :git => 'https://github.com/yourusername/NearbyCoreAdapter.git', :tag => s.version.to_s }
  s.swift_version = '5.0'
  s.platform     = :ios, '13.0'
  s.compiler_flags = '-std=c++11'
  s.pod_target_xcconfig = { 'CLANG_CXX_LANGUAGE_STANDARD' => 'c++11' }

  s.public_header_files = "connections/swift/NearbyCoreAdapter/Sources/Public/NearbyCoreAdapter/*.h"
  s.source_files = [
    "connections/swift/NearbyCoreAdapter/Sources/**/*.h",
    "connections/swift/NearbyCoreAdapter/Sources/**/*.mm",
    'third_party/**/*.mm',
  ]

  # Specify dependencies located in the third_party folder
  s.private_header_files = [
    "third_party/**/*.cpp",
    "third_party/**/*.hpp",
    "third_party/**/*.h"
  ]
  
  s.dependency 'GoogleToolboxForMac'
  s.dependency 'Protobuf', '3.24'

  # You can add other third-party dependencies here
  s.preserve_paths = "NearbyCoreAdapter.framework/*"
  s.xcconfig = {
    'FRAMEWORK_SEARCH_PATH[sdk=iphoneos*]' => '$(inherited) "$(PODS_ROOT)/NearbyCoreAdapter"',
    'OTHERCFLAGS[sdk=iphoneos*]' => '$(inherited) -iframework "$(PODS_ROOT)/NearbyCoreAdapter"',
    'OTHER_LDFLAGS[sdk=iphoneos*]' => '$(inherited) -framework NearbyCoreAdapter'
}
  # ...
end

@Droppix
Copy link

Droppix commented Mar 14, 2024

Does anyone have a solution for Cocoapods?
I'll take it...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lang: swift An issue with a Swift client library P3 Priority 3 issue (default for bugs or new feature requests; things we'd like to work on) platform: apple An issue with the macOS or iOS implementation project: connections An issue with the Connections project type: feature-request Desire for new functionality
Projects
None yet
Development

No branches or pull requests

4 participants