-
Notifications
You must be signed in to change notification settings - Fork 20
Description
Describe the problem
As a developer integrating CameraKit into a modular architecture, I need to customize the launchData sent to a lens before it’s launched. However, the method launchData(for:) is declared as private, which prevents me from overriding it in a custom subclass of CameraController.
This restriction makes it impossible to inject custom parameters (e.g. apiVersion) into the lens launch payload, unless I fully reimplement parts of the SDK or rely on unsupported workarounds like method swizzling.
Proposed solution
Please consider changing the visibility of:
private func launchData(for lens: Lens) -> LensLaunchData
To something accessible to subclasses, such as:
open func launchData(for lens: Lens) -> LensLaunchData
This would allow us to subclass CameraController and inject custom launch data while preserving the default behavior.
Why this matters
- It would enable more flexible integration scenarios (e.g. feature flags, A/B testing, backend-driven parameters).
- It avoids needing to resort to unsafe or fragile techniques like method swizzling.
- It respects the spirit of modular and extensible design.
Workaround attempts
I’ve tried:
- Subclassing CameraController: not viable due to private method.
- Wrapping it and trying to inject launch data indirectly: no clear entry point.
- Swizzling: possible, but brittle and discouraged in production apps.
Conclusion
Opening up launchData(for:) would make the SDK significantly more customizable with minimal change.
Thanks for your consideration!