Native Code Patterns
Generates production-ready Kotlin and Swift bridge patterns for implementing native functionality in NativePHP plugins.
The source repository doesn't declare a license. Check its terms before reusing the code.
Key features
- Production-ready patterns for asynchronous operations and background threading
- Template-based parameter extraction for diverse data types and nested objects
- Native UI patterns for activity launching and permission management
- Event dispatching templates to communicate native actions back to PHP
- Standardized BridgeResponse implementation for consistent success and error handling
Use cases
- Building native mobile bridges for Laravel applications using NativePHP
- Accessing platform-specific hardware APIs like cameras or scanners
- Implementing standardized native event listeners for mobile plugins
FAQ
What does the Native Code Patterns skill do?
This skill provides standardized, production-ready code templates for Kotlin (Android) and Swift (iOS) bridge functions. It automates the creation of complex bridge logic required for NativePHP plugins, ensuring your native code interacts correctly with the PHP layer.
Why is the BridgeResponse helper important in this skill?
BridgeResponse is a native object required by the NativePHP bridge for consistent success and error handling. This skill ensures all your native functions return the correct data structures that the PHP side expects, preventing communication failures.
How does this skill improve my NativePHP workflow?
It eliminates boilerplate and prevents common integration errors by enforcing the use of the BridgeResponse helper and FragmentActivity patterns. It also provides reliable templates for parameter extraction and event dispatching, significantly speeding up native development.
When should I use this skill?
Use this skill whenever you are building a NativePHP plugin that requires native mobile functionality, such as accessing the camera, managing permissions, launching native UIs, or handling background threading in Kotlin or Swift.
Does this skill support asynchronous native operations?
Yes. It includes specific patterns for handling long-running background tasks using Kotlin Coroutines and Swift concurrency, including templates for dispatching events back to PHP once an operation is complete.
Related skills
iOS 26 Liquid Glass
Implements Apple's iOS 26 Liquid Glass design language using SwiftUI and UIKit APIs for translucent, depth-aware user interfaces.
Mobile Development412 ptsNativePHP Architecture
Explains the internal mechanics of NativePHP Mobile to facilitate seamless communication between PHP and native iOS/Android components.
Mobile Development212 ptsNativePHP Mobile Quickstart
Streamlines the creation and configuration of native iOS and Android applications using PHP and Laravel.
Mobile Development212 pts