Construct Synced Realms - The Simple Way!
When writing Swift apps with the Realm Mobile Platform, you’d probably run into writing something like following a lot.
let syncConfig = SyncConfiguration(
Well let’s keep things DRY (Don’t Repeat Yourself). Copy and paste this little snippet in your apps.
Now you can just do this all over your app!!!
let realm = try! Realm(urlString: "realm://localhost:9080/~/myRealm")
- This just a gist that constructs the simplest synced Realm with the current user. So take care that your user is already authenticated.
- Remember, the url string is the full realm:// or realms:// URL string not a path!. So you can’t supply
Of course there are other fancier ways to construct this but extension methods can keep things quite neat! Enjoy!