Installation
Compatibility
Currently, the C# SDK runs on iOS, macOS, Windows, and Linux. Peer to peer capabilites of the C# SDK vary by platform. All platforms can connect to other Ditto instances over a local LAN via WiFi. iOS and macOS can connect to each other over Bluetooth LE and WiFi Direct (AWDL). See below for Xamarin support.
LAN | WiFi Direct | Bluetooth | |
---|---|---|---|
iOS | ✓ | ✓ | ✓ |
macOS | ✓ | ✓ | ✓ |
Windows | ✓ | x | x |
Linux | ✓ | x | x |
Android | x | x | x |
Setup
The C# SDK is available as part of NuGet. The common ways to install the SDK is with either the NuGet Package Manager, the .NET CLI, or by adding a reference to the CSProj XML file.
Install-Package Ditto -Version 4.8.1-rc.1
dotnet add package Ditto --version 4.8.1-rc.1
<PackageReference Include="Ditto" Version="4.8.1-rc.1" />
For more installation options visit the NuGet Page
Now in your code you can call:
try{ DittoLogger.SetMinimumLogLevel(DittoLogLevel.Debug); var ditto = new Ditto(DittoIdentity.OnlinePlayground("REPLACE_ME_WITH_YOUR_APP_ID", "REPLACE_ME_WITH_YOUR_PLAYGROUND_TOKEN", true), path); ditto.StartSync();}catch (DittoException ex){ Console.WriteLine($"Ditto Error {ex.Message}");}
var docId = ditto.Store.Collection("people").Upsert( new Dictionary<string, object> { { "name", "Susan" }, { "age", 31 }, });
Xamarin
info
Xamarin.iOS is currently supported on physical devices, however the iOS simulator is not supported yet. Xamarin.Android support is coming soon.
Follow the Xamarin tutorial to build your first Tasks application with Ditto.