When writing Swift apps with the Realm Mobile Platform, you’d probably run into writing something like following a lot.

## Extension Method to the Rescue!!

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!!!

## Considerations

• 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 ~/myRealm

Of course there are other fancier ways to construct this but extension methods can keep things quite neat! Enjoy!