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

[QUESTION] Looking for any guidance as to how one might connect to a macOS XPC service on the same machine #2134

Open
michelcrypt4d4mus opened this issue Jun 7, 2024 · 1 comment
Labels
enhancement New feature or request Needs: Triage 🔍

Comments

@michelcrypt4d4mus
Copy link

Summary

Apologies for calling this a "feature request" i just wasn't sure how else to ask about this...

I've been poking around the internet trying to figure out how i might get my RNM app connect to an XPC service offered by another part of my app bundle and come up pretty empty. All I've really managed to gather is that React Native (maybe) has the ability to connect to the Bluetooth XPC service offered by iOS. I'm assuming that somewhere under the hood RNM also does this but grepping the repo for "XPC" yielded no results.

i don't need to connect to bluetooth - i want to connect to another service i will write - but i'm just not sure how to approach this problem so i figured it was worth asking here. In more concrete terms my questions are:

  1. Would I have to do something like this through fully customized components or is there some part of RN or RNM that i haven't found out about yet that would simplify this? i've already managed to build some customized components in Swift and successfully integrate them to my RNM app so this isn't overwhelmingly intimidating though i'm not sure if exporting Swift functions that aren't react components works any differently.

  2. Anyone have any other guidance or links that would help me understand how RN utilizes XPC for bluetooth or anything else? despite a bunch of issues in the official RN repo mentioning XPC the string "XPC" doesn't appear anywhere in the actual RN codebase.

Motivation

RNM is theoretically a great tool for building a front end configuration panel to a multi-part macOS app or service (at least that's what i've done with it and despite some frustrations it worked great) but IPC on macOS is supposed to be done with XPC services and it's unclear how to even approach doing that kind of thing.

Basic Example

No response

Open Questions

No response

@Saadnajmi
Copy link
Collaborator

Sorry for the late reply. I think for this case, you'd probably just have to write your own turbomodule and implement all the native code yourself. I think that can be done with Swift, though it'll go through an extra hop of Objective C wrappers. The process for writing a turbo module on macOS is the same as one for iOS. More recent versions of React Native also support pure Cxx turbo modules.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Needs: Triage 🔍
Projects
None yet
Development

No branches or pull requests

2 participants