# Unity native plug-in example for iOS

> Use the native plug-in example to understand how to develop a plug-in with Swift or Objective-C.

Use the native plug-in example to understand how to develop a plug-in with Swift or Objective-C.

The [Unity native plug-in example for Apple platforms](https://github.com/Unity-Technologies/nativePlugin-example) project, hosted on Unity GitHub, demonstrates how to integrate native Objective-C and Swift code with Unity. This example shows integrations for Apple platforms, including iOS, tvOS, and visionOS. It highlights two different native implementations that share a single, unified C# API, allowing you to change the native back end without modifying your managed code.

The project is compatible with Unity 6000.0 or later, and works on both device and simulator SDKs.

> **Note:**
>
> The Swift Xcode project type and the Unity Swift API is available from Unity 6000.5 and later. For more information, refer to [Swift Xcode project type for iOS and tvOS](https://docs.unity3d.com/Manual/ios-swift-xcode-project-type.html).

The repository contains two native plug-ins that illustrate different integration strategies:

* **Objective-C**: A deep integration with the Unity runtime that uses class loading (`+load`, `+initialize`) and direct `AppController` subclassing.
* **Swift**: A lighter integration that uses Swift-native patterns and the Unity Swift API.

Both implementations expose an identical C API, ensuring C# scripts can work with either plug-in without modification. Demonstrated techniques include different initialization methods, singleton patterns, `UnitySendMessage` callbacks, and handling data between managed and native code.

For the complete source code and technical details, refer to [Unity native plug-in example for Apple platforms](https://github.com/Unity-Technologies/nativePlugin-example) (Unity GitHub).

## Additional resources

* [Unity native plug-in example for Apple platforms](https://github.com/Unity-Technologies/nativePlugin-example) (Unity GitHub)
