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

Extract private API to external repo #2

Open
markbattistella opened this issue Mar 10, 2025 · 0 comments
Open

Extract private API to external repo #2

markbattistella opened this issue Mar 10, 2025 · 0 comments

Comments

@markbattistella
Copy link

Hey @Aeastr,

Just came across this and nice little package - but noticed your comment on the private API use and how it can affect the usage in real world apps.

Note: trying not to be self-promoting here

I faced the same issue with BezelKit, and what I did was:

  1. Extract the private API into a separate project
  2. Save that data to a JSON log file (https://github.com/markbattistella/BezelKit-Generator/blob/e8607292fb525360d03785d6416346b54ca968da/FetchBezel/FetchBezel/MainApp.swift#L23)
  3. Wrote a NodeJS script (simpler at the time for me) to boot up a simulator, run the project, then conform it to a JSON data file (https://github.com/markbattistella/BezelKit-Generator/blob/e8607292fb525360d03785d6416346b54ca968da/index.js#L2)
  4. At the end of the JS script it does the following to the main repo:

    Once the script completes and updates the bezel.min.json for the actual package, pending and problematic keys are deleted, and the JSON is minified.

  5. Add the new JSON file to your main repo (https://github.com/markbattistella/BezelKit/blob/fc2bdcb9a4a02cfc09b17ce6db028b4b0cdcd75f/Package.swift#L19)
  6. Use it in your package (https://github.com/markbattistella/BezelKit/blob/fc2bdcb9a4a02cfc09b17ce6db028b4b0cdcd75f/Sources/BezelKit/BezelKit.swift#L39)

I know this is a lot of extra overhead to you, but for the user it means these private APIs aren't even a thought in their apps. Everything you provide for them to use is simply an outputted JSON file.

I then have a VM (using VirtualBuddy) to essentially run this every time a new device is released. Currently I manually add the identifier and simulator name to the generator JSON, then it does the rest for me!

If you're interested I can see what parts I can clone into making this work for NotchMyProblem since it is really doing the same thing, and for the user/dev all they really need is to know where the notch is not the calculation within the 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