Skip to content

Commit

Permalink
Add dependency injection helper
Browse files Browse the repository at this point in the history
  • Loading branch information
ssimek committed Apr 9, 2022
1 parent 0514e2a commit 90efa51
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
namespace Microsoft.Extensions.DependencyInjection;

using triaxis.BluetoothLE;

/// <summary>
/// triaxis.BluetoothLE dependency injection extension methods
/// </summary>
public static class BluetoothLEDependencyInjectionExtensions
{
/// <summary>
/// Add the platform-specific <see cref="IBluetoothLE" /> implementation to the container
/// </summary>
public static IServiceCollection AddBluetoothLE(this IServiceCollection services)
{
services.AddSingleton<IBluetoothLE, Platform>();
return services;
}
}
4 changes: 4 additions & 0 deletions src/triaxis.BluetoothLE.Maui/triaxis.BluetoothLE.Maui.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,8 @@
<ItemGroup Condition="$(TargetFramework.Contains('-maccatalyst'))">
<Compile Include="$(CommonSources)/iOS/*.cs" />
</ItemGroup>

<ItemGroup Condition=" '$(UseMaui)' == 'true' ">
<Compile Include="*.cs" />
</ItemGroup>
</Project>

0 comments on commit 90efa51

Please sign in to comment.