Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Redth/Microsoft.Maui.Platform.Channels
A simple bridge for messaging between .NET and iOS/MacCatalyst/Android Platforms at runtime
https://github.com/Redth/Microsoft.Maui.Platform.Channels
Last synced: 30 days ago
JSON representation
A simple bridge for messaging between .NET and iOS/MacCatalyst/Android Platforms at runtime
- Host: GitHub
- URL: https://github.com/Redth/Microsoft.Maui.Platform.Channels
- Owner: Redth
- License: mit
- Created: 2021-11-26T21:43:06.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-02-06T20:11:59.000Z (10 months ago)
- Last Synced: 2024-11-10T19:56:23.344Z (about 1 month ago)
- Language: C#
- Size: 531 KB
- Stars: 52
- Watchers: 5
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
- awesome-dotnet-maui - Microsoft.Maui.Platform.Channels - square)](https://github.com/Redth/Microsoft.Maui.Platform.Channels/stargazers)|[![GitHub last-commit](https://img.shields.io/github/last-commit/Redth/Microsoft.Maui.Platform.Channels?style=flat-square)](https://github.com/Redth/Microsoft.Maui.Platform.Channels/commits) (UI)
README
# Microsoft.Maui.Platform.Channels
A simple bridge for messaging between .NET and iOS/MacCatalyst/Android Platforms at runtime## Getting Started
1. Install prerequisites:
* Install [Xcode](https://developer.apple.com/xcode/).
* Install [Android Studio](https://developer.android.com/studio) and JDK 17.
* Install the latest [.NET 8 SDK](https://dotnet.microsoft.com/download/dotnet/8.0) and `maui` workload.2. Build `Platforms`:
```shell
dotnet build Platforms/build.proj
```3. Build `Microsoft.PlatformChannels.sln`:
```shell
dotnet build Microsoft.PlatformChannels.sln
```4. Run the sample
```shell
dotnet build SamplePlatformChannels/SamplePlatformChannels.csproj -t:Run -f net8.0-android
dotnet build SamplePlatformChannels/SamplePlatformChannels.csproj -t:Run -f net8.0-ios
dotnet build SamplePlatformChannels/SamplePlatformChannels.csproj -t:Run -f net8.0-maccatalyst
```## ViewChannels
1. Create your platform ViewChannel implementations using whatever platform specific code, libraries/sdks, etc. you like: https://github.com/Redth/Microsoft.Maui.Platform.Channels/blob/main/Platforms/Android/sample/src/main/java/com/microsoft/dotnet/platformchannels/sample/LabelViewChannel.java#L19-L23
2. Reference your platform project from your .NET MAUI project: https://github.com/Redth/Microsoft.Maui.Platform.Channels/blob/main/SamplePlatformChannels/SamplePlatformChannels.csproj#L44
3. Use the `PlatformChannelView` MAUI control to display your ViewChannel: https://github.com/Redth/Microsoft.Maui.Platform.Channels/blob/main/SamplePlatformChannels/MainPage.xaml#L17
4. Send messages across to the platform: https://github.com/Redth/Microsoft.Maui.Platform.Channels/blob/main/SamplePlatformChannels/MainPage.xaml.cs#L18
5. You can receive messages originating from the platform too: https://github.com/Redth/Microsoft.Maui.Platform.Channels/blob/main/SamplePlatformChannels/MainPage.xaml.cs#L48