RLMSyncConfiguration.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. ////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright 2016 Realm Inc.
  4. //
  5. // Licensed under the Apache License, Version 2.0 (the "License");
  6. // you may not use this file except in compliance with the License.
  7. // You may obtain a copy of the License at
  8. //
  9. // http://www.apache.org/licenses/LICENSE-2.0
  10. //
  11. // Unless required by applicable law or agreed to in writing, software
  12. // distributed under the License is distributed on an "AS IS" BASIS,
  13. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. // See the License for the specific language governing permissions and
  15. // limitations under the License.
  16. //
  17. ////////////////////////////////////////////////////////////////////////////
  18. #import <Foundation/Foundation.h>
  19. @class RLMRealmConfiguration;
  20. @class RLMSyncUser;
  21. NS_ASSUME_NONNULL_BEGIN
  22. /**
  23. A configuration object representing configuration state for a Realm which is intended to sync with a Realm Object
  24. Server.
  25. */
  26. @interface RLMSyncConfiguration : NSObject
  27. /// The user to which the remote Realm belongs.
  28. @property (nonatomic, readonly) RLMSyncUser *user;
  29. /**
  30. The URL of the remote Realm upon the Realm Object Server.
  31. @warning The URL cannot end with `.realm`, `.realm.lock` or `.realm.management`.
  32. */
  33. @property (nonatomic, readonly) NSURL *realmURL;
  34. /**
  35. Whether SSL certificate validation is enabled for the connection associated
  36. with this configuration value. SSL certificate validation is ON by default.
  37. @warning NEVER disable certificate validation for clients and servers in production.
  38. */
  39. @property (nonatomic) BOOL enableSSLValidation;
  40. /**
  41. Whether this Realm should be opened in 'partial synchronization' mode.
  42. Partial synchronization mode means that no objects are synchronized from the remote Realm
  43. except those matching queries that the user explicitly specifies.
  44. @warning Partial synchronization is a tech preview. Its APIs are subject to change.
  45. */
  46. @property (nonatomic) BOOL isPartial;
  47. /**
  48. Create a sync configuration instance.
  49. @param user A `RLMSyncUser` that owns the Realm at the given URL.
  50. @param url The unresolved absolute URL to the Realm on the Realm Object Server, e.g.
  51. `realm://example.org/~/path/to/realm`. "Unresolved" means the path should
  52. contain the wildcard marker `~`, which will automatically be filled in with
  53. the user identity by the Realm Object Server.
  54. */
  55. - (instancetype)initWithUser:(RLMSyncUser *)user realmURL:(NSURL *)url;
  56. /**
  57. Return a Realm configuration for syncing with the default Realm of the currently logged-in sync user.
  58. Partial synchronization is enabled in the returned configuration.
  59. */
  60. + (RLMRealmConfiguration *)automaticConfiguration;
  61. /**
  62. Return a Realm configuration for syncing with the default Realm of the given sync user.
  63. Partial synchronization is enabled in the returned configuration.
  64. */
  65. + (RLMRealmConfiguration *)automaticConfigurationForUser:(RLMSyncUser *)user;
  66. /// :nodoc:
  67. - (instancetype)init __attribute__((unavailable("This type cannot be created directly")));
  68. /// :nodoc:
  69. + (instancetype)new __attribute__((unavailable("This type cannot be created directly")));
  70. @end
  71. NS_ASSUME_NONNULL_END