marinofaggiana 4 years ago
parent
commit
4d11c4d45a
100 changed files with 0 additions and 23541 deletions
  1. 0 6
      Carthage/Checkouts/realm-cocoa/.dir-locals.el
  2. 0 2
      Carthage/Checkouts/realm-cocoa/.gitattributes
  3. 0 121
      Carthage/Checkouts/realm-cocoa/.gitignore
  4. 0 4
      Carthage/Checkouts/realm-cocoa/.gitmodules
  5. 0 724
      Carthage/Checkouts/realm-cocoa/.jenkins.yml
  6. 0 43
      Carthage/Checkouts/realm-cocoa/.swiftlint.yml
  7. 0 39
      Carthage/Checkouts/realm-cocoa/.travis.yml
  8. 0 4946
      Carthage/Checkouts/realm-cocoa/CHANGELOG.md
  9. 0 64
      Carthage/Checkouts/realm-cocoa/CONTRIBUTING.md
  10. 0 75
      Carthage/Checkouts/realm-cocoa/Configuration/Base.xcconfig
  11. 0 12
      Carthage/Checkouts/realm-cocoa/Configuration/Debug.xcconfig
  12. 0 11
      Carthage/Checkouts/realm-cocoa/Configuration/Realm/Realm iOS static.xcconfig
  13. 0 28
      Carthage/Checkouts/realm-cocoa/Configuration/Realm/Realm.xcconfig
  14. 0 7
      Carthage/Checkouts/realm-cocoa/Configuration/Realm/Tests iOS static.xcconfig
  15. 0 22
      Carthage/Checkouts/realm-cocoa/Configuration/Realm/Tests.xcconfig
  16. 0 12
      Carthage/Checkouts/realm-cocoa/Configuration/RealmSwift/RealmSwift.xcconfig
  17. 0 18
      Carthage/Checkouts/realm-cocoa/Configuration/RealmSwift/Tests.xcconfig
  18. 0 7
      Carthage/Checkouts/realm-cocoa/Configuration/Release.xcconfig
  19. 0 25
      Carthage/Checkouts/realm-cocoa/Configuration/TestHost.xcconfig
  20. 0 15
      Carthage/Checkouts/realm-cocoa/Configuration/object-server-config.yml
  21. 0 306
      Carthage/Checkouts/realm-cocoa/Jenkinsfile.releasability
  22. 0 248
      Carthage/Checkouts/realm-cocoa/LICENSE
  23. 0 114
      Carthage/Checkouts/realm-cocoa/Realm.podspec
  24. 0 46
      Carthage/Checkouts/realm-cocoa/Realm/NSError+RLMSync.h
  25. 0 43
      Carthage/Checkouts/realm-cocoa/Realm/NSError+RLMSync.m
  26. 0 20
      Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/Object-Server-Tests-Bridging-Header.h
  27. 0 22
      Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/ObjectServerTests-Info.plist
  28. 0 58
      Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/RLMAncillaryObjectServerTests.m
  29. 0 2451
      Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/RLMObjectServerTests.mm
  30. 0 1095
      Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/RLMPermissionsAPITests.m
  31. 0 618
      Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/RLMPermissionsTests.mm
  32. 0 25
      Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/RLMSyncSessionRefreshHandle+ObjectServerTests.h
  33. 0 66
      Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/RLMSyncSessionRefreshHandle+ObjectServerTests.m
  34. 0 152
      Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/RLMSyncTestCase.h
  35. 0 594
      Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/RLMSyncTestCase.mm
  36. 0 32
      Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/RLMSyncUser+ObjectServerTests.h
  37. 0 72
      Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/RLMSyncUser+ObjectServerTests.mm
  38. 0 26
      Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/RLMTestUtils.h
  39. 0 53
      Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/RLMTestUtils.m
  40. 0 587
      Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/SwiftObjectServerTests.swift
  41. 0 227
      Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/SwiftPermissionsAPITests.swift
  42. 0 280
      Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/SwiftPermissionsTests.swift
  43. 0 170
      Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/SwiftSyncTestCase.swift
  44. 0 27
      Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/certificates/ca-key.pem
  45. 0 19
      Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/certificates/ca.pem
  46. 0 27
      Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/certificates/localhost-cert-key.pem
  47. 0 19
      Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/certificates/localhost-cert.pem
  48. 0 19
      Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/certificates/localhost-other-cert.pem
  49. BIN
      Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/certificates/localhost-other.cer
  50. BIN
      Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/certificates/localhost.cer
  51. 0 19
      Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/certificates/not-localhost-cert.pem
  52. BIN
      Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/certificates/not-localhost.cer
  53. 0 156
      Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/test-ros-server.js
  54. 0 53
      Carthage/Checkouts/realm-cocoa/Realm/RLMAccessor.h
  55. 0 117
      Carthage/Checkouts/realm-cocoa/Realm/RLMAccessor.hpp
  56. 0 823
      Carthage/Checkouts/realm-cocoa/Realm/RLMAccessor.mm
  57. 0 55
      Carthage/Checkouts/realm-cocoa/Realm/RLMAnalytics.hpp
  58. 0 247
      Carthage/Checkouts/realm-cocoa/Realm/RLMAnalytics.mm
  59. 0 517
      Carthage/Checkouts/realm-cocoa/Realm/RLMArray.h
  60. 0 599
      Carthage/Checkouts/realm-cocoa/Realm/RLMArray.mm
  61. 0 32
      Carthage/Checkouts/realm-cocoa/Realm/RLMArray_Private.h
  62. 0 71
      Carthage/Checkouts/realm-cocoa/Realm/RLMArray_Private.hpp
  63. 0 113
      Carthage/Checkouts/realm-cocoa/Realm/RLMClassInfo.hpp
  64. 0 130
      Carthage/Checkouts/realm-cocoa/Realm/RLMClassInfo.mm
  65. 0 428
      Carthage/Checkouts/realm-cocoa/Realm/RLMCollection.h
  66. 0 460
      Carthage/Checkouts/realm-cocoa/Realm/RLMCollection.mm
  67. 0 31
      Carthage/Checkouts/realm-cocoa/Realm/RLMCollection_Private.h
  68. 0 82
      Carthage/Checkouts/realm-cocoa/Realm/RLMCollection_Private.hpp
  69. 0 224
      Carthage/Checkouts/realm-cocoa/Realm/RLMConstants.h
  70. 0 36
      Carthage/Checkouts/realm-cocoa/Realm/RLMConstants.m
  71. 0 103
      Carthage/Checkouts/realm-cocoa/Realm/RLMJSONModels.h
  72. 0 233
      Carthage/Checkouts/realm-cocoa/Realm/RLMJSONModels.m
  73. 0 42
      Carthage/Checkouts/realm-cocoa/Realm/RLMListBase.h
  74. 0 147
      Carthage/Checkouts/realm-cocoa/Realm/RLMListBase.mm
  75. 0 568
      Carthage/Checkouts/realm-cocoa/Realm/RLMManagedArray.mm
  76. 0 127
      Carthage/Checkouts/realm-cocoa/Realm/RLMMigration.h
  77. 0 170
      Carthage/Checkouts/realm-cocoa/Realm/RLMMigration.mm
  78. 0 40
      Carthage/Checkouts/realm-cocoa/Realm/RLMMigration_Private.h
  79. 0 65
      Carthage/Checkouts/realm-cocoa/Realm/RLMNetworkClient.h
  80. 0 449
      Carthage/Checkouts/realm-cocoa/Realm/RLMNetworkClient.mm
  81. 0 712
      Carthage/Checkouts/realm-cocoa/Realm/RLMObject.h
  82. 0 238
      Carthage/Checkouts/realm-cocoa/Realm/RLMObject.mm
  83. 0 44
      Carthage/Checkouts/realm-cocoa/Realm/RLMObjectBase.h
  84. 0 710
      Carthage/Checkouts/realm-cocoa/Realm/RLMObjectBase.mm
  85. 0 82
      Carthage/Checkouts/realm-cocoa/Realm/RLMObjectBase_Dynamic.h
  86. 0 30
      Carthage/Checkouts/realm-cocoa/Realm/RLMObjectBase_Private.h
  87. 0 72
      Carthage/Checkouts/realm-cocoa/Realm/RLMObjectSchema.h
  88. 0 364
      Carthage/Checkouts/realm-cocoa/Realm/RLMObjectSchema.mm
  89. 0 71
      Carthage/Checkouts/realm-cocoa/Realm/RLMObjectSchema_Private.h
  90. 0 32
      Carthage/Checkouts/realm-cocoa/Realm/RLMObjectSchema_Private.hpp
  91. 0 92
      Carthage/Checkouts/realm-cocoa/Realm/RLMObjectStore.h
  92. 0 278
      Carthage/Checkouts/realm-cocoa/Realm/RLMObjectStore.mm
  93. 0 83
      Carthage/Checkouts/realm-cocoa/Realm/RLMObject_Private.h
  94. 0 55
      Carthage/Checkouts/realm-cocoa/Realm/RLMObject_Private.hpp
  95. 0 153
      Carthage/Checkouts/realm-cocoa/Realm/RLMObservation.hpp
  96. 0 523
      Carthage/Checkouts/realm-cocoa/Realm/RLMObservation.mm
  97. 0 36
      Carthage/Checkouts/realm-cocoa/Realm/RLMOptionalBase.h
  98. 0 163
      Carthage/Checkouts/realm-cocoa/Realm/RLMOptionalBase.mm
  99. 0 47
      Carthage/Checkouts/realm-cocoa/Realm/RLMPlatform.h.in
  100. 0 22
      Carthage/Checkouts/realm-cocoa/Realm/RLMPredicateUtil.hpp

+ 0 - 6
Carthage/Checkouts/realm-cocoa/.dir-locals.el

@@ -1,6 +0,0 @@
-;; Project specific Emacs settings
-((nil . ((c-basic-offset . 4)
-         (indent-tabs-mode . nil)
-         (c-file-style . "ellemtel")
-         (c-file-offsets . ((innamespace . 0)))
-         (show-trailing-whitespace . t))))

+ 0 - 2
Carthage/Checkouts/realm-cocoa/.gitattributes

@@ -1,2 +0,0 @@
-CHANGELOG.md merge=union
-*.mm linguist-language=Objective-C

+ 0 - 121
Carthage/Checkouts/realm-cocoa/.gitignore

@@ -1,121 +0,0 @@
-*~
-.DS_Store
-
-# Merge files
-*.orig
-
-# Binaries
-*.dylib
-*.a
-*.o
-*.d
-*.libdeps
-*.zip
-*.realm
-*.realm.lock
-
-# core
-core
-core-*
-
-# sync
-/sync-*
-
-# sh build.sh config
-/Realm/config.mk
-
-# sh build.sh test
-build/
-
-# sh build.sh build-iphone
-/iphone-lib/include
-
-# sh build.sh ios-framework
-# sh build.sh package-examples
-*/Realm.framework
-Realm.framework
-
-# sh build.sh build-cocoa
-bin
-
-# sh build.sh cocoapods-setup
-/include
-
-# sh build.sh docs
-/docs/objc_output
-/docs/swift_output
-/Realm/RLMPlatform.h
-
-# XCode
-*.bak
-xcuserdata/
-project.xcworkspace
-*.xccheckout
-DerivedData
-/.build
-
-# AppCode
-.idea/
-*.iml
-# backup and crash files
-*.swp
-
-# xcpretty
-build.log
-
-# ruby
-*.gem
-*.rbc
-/.config
-/coverage/
-/InstalledFiles
-/pkg/
-/spec/reports/
-/test/tmp/
-/test/version_tmp/
-/tmp/
-
-## Specific to RubyMotion:
-.dat*
-.repl_history
-build/
-
-## Documentation cache and generated files:
-/.yardoc/
-/_yardoc/
-/doc/
-/rdoc/
-
-## Environment normalisation:
-/.bundle/
-/lib/bundler/man/
-
-# for a library or gem, you might want to ignore these files since the code is
-# intended to run in multiple environments; otherwise, check them in:
-# Gemfile.lock
-# .ruby-version
-# .ruby-gemset
-
-# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
-.rvmrc
-
-## Carthage
-# Cartfiles are ignored because they're generated on demand in the installation examples
-Cartfile
-Carthage
-
-## Swift Version
-SwiftVersion.swift
-
-examples/ios/objc/Draw/Constants.h
-
-## Sync testing
-test-ros-instance
-Realm/ObjectServerTests/node_modules
-
-## Swiftpm
-.swiftpm
-.build
-Package.resolved
-
-examples/installation/ios/swift/SwiftPackageManagerExample/SwiftPackageManagerExample.xcodeproj

+ 0 - 4
Carthage/Checkouts/realm-cocoa/.gitmodules

@@ -1,4 +0,0 @@
-[submodule "Realm/ObjectStore"]
-	path = Realm/ObjectStore
-	url = https://github.com/realm/realm-object-store.git
-	branch = master

+ 0 - 724
Carthage/Checkouts/realm-cocoa/.jenkins.yml

@@ -1,724 +0,0 @@
-
-# Yaml Axis Plugin
-# https://wiki.jenkins-ci.org/display/JENKINS/Yaml+Axis+Plugin
-# This is a generated file produced by scripts/pr-ci-matrix.rb.
-
-xcode_version: 
- - 11.3
- - 11.4.1
- - 11.5
- - 11.6
- - 12.0
-target: 
- - docs
- - swiftlint
- - osx
- - osx-encryption
- - osx-object-server
- - ios-static
- - ios-dynamic
- - watchos
- - tvos
- - osx-swift
- - ios-swift
- - tvos-swift
- - catalyst
- - catalyst-swift
- - xcframework
- - cocoapods-osx
- - cocoapods-ios
- - cocoapods-ios-dynamic
- - cocoapods-watchos
- - swiftpm
- - swiftpm-address
- - swiftpm-thread
- - swiftpm-ios
-configuration: 
- - Debug
- - Release
-
-exclude:
-
-  - xcode_version: 11.3
-    target: docs
-    configuration: Debug
-
-  - xcode_version: 11.3
-    target: docs
-    configuration: Release
-
-  - xcode_version: 11.4.1
-    target: docs
-    configuration: Debug
-
-  - xcode_version: 11.4.1
-    target: docs
-    configuration: Release
-
-  - xcode_version: 11.5
-    target: docs
-    configuration: Debug
-
-  - xcode_version: 11.5
-    target: docs
-    configuration: Release
-
-  - xcode_version: 11.6
-    target: docs
-    configuration: Debug
-
-  - xcode_version: 11.6
-    target: docs
-    configuration: Release
-
-  - xcode_version: 12.0
-    target: docs
-    configuration: Debug
-
-  - xcode_version: 11.3
-    target: swiftlint
-    configuration: Debug
-
-  - xcode_version: 11.3
-    target: swiftlint
-    configuration: Release
-
-  - xcode_version: 11.4.1
-    target: swiftlint
-    configuration: Debug
-
-  - xcode_version: 11.4.1
-    target: swiftlint
-    configuration: Release
-
-  - xcode_version: 11.5
-    target: swiftlint
-    configuration: Debug
-
-  - xcode_version: 11.5
-    target: swiftlint
-    configuration: Release
-
-  - xcode_version: 11.6
-    target: swiftlint
-    configuration: Debug
-
-  - xcode_version: 11.6
-    target: swiftlint
-    configuration: Release
-
-  - xcode_version: 12.0
-    target: swiftlint
-    configuration: Debug
-
-  - xcode_version: 11.3
-    target: osx-encryption
-    configuration: Debug
-
-  - xcode_version: 11.4.1
-    target: osx-encryption
-    configuration: Debug
-
-  - xcode_version: 11.4.1
-    target: osx-encryption
-    configuration: Release
-
-  - xcode_version: 11.5
-    target: osx-encryption
-    configuration: Debug
-
-  - xcode_version: 11.5
-    target: osx-encryption
-    configuration: Release
-
-  - xcode_version: 11.6
-    target: osx-encryption
-    configuration: Debug
-
-  - xcode_version: 11.6
-    target: osx-encryption
-    configuration: Release
-
-  - xcode_version: 12.0
-    target: osx-encryption
-    configuration: Debug
-
-  - xcode_version: 11.3
-    target: osx-object-server
-    configuration: Debug
-
-  - xcode_version: 11.4.1
-    target: osx-object-server
-    configuration: Debug
-
-  - xcode_version: 11.4.1
-    target: osx-object-server
-    configuration: Release
-
-  - xcode_version: 11.5
-    target: osx-object-server
-    configuration: Debug
-
-  - xcode_version: 11.5
-    target: osx-object-server
-    configuration: Release
-
-  - xcode_version: 11.6
-    target: osx-object-server
-    configuration: Debug
-
-  - xcode_version: 11.6
-    target: osx-object-server
-    configuration: Release
-
-  - xcode_version: 12.0
-    target: osx-object-server
-    configuration: Debug
-
-  - xcode_version: 11.3
-    target: ios-static
-    configuration: Debug
-
-  - xcode_version: 11.4.1
-    target: ios-static
-    configuration: Debug
-
-  - xcode_version: 11.4.1
-    target: ios-static
-    configuration: Release
-
-  - xcode_version: 11.5
-    target: ios-static
-    configuration: Debug
-
-  - xcode_version: 11.5
-    target: ios-static
-    configuration: Release
-
-  - xcode_version: 11.6
-    target: ios-static
-    configuration: Debug
-
-  - xcode_version: 11.6
-    target: ios-static
-    configuration: Release
-
-  - xcode_version: 12.0
-    target: ios-static
-    configuration: Debug
-
-  - xcode_version: 11.3
-    target: ios-dynamic
-    configuration: Debug
-
-  - xcode_version: 11.4.1
-    target: ios-dynamic
-    configuration: Debug
-
-  - xcode_version: 11.4.1
-    target: ios-dynamic
-    configuration: Release
-
-  - xcode_version: 11.5
-    target: ios-dynamic
-    configuration: Debug
-
-  - xcode_version: 11.5
-    target: ios-dynamic
-    configuration: Release
-
-  - xcode_version: 11.6
-    target: ios-dynamic
-    configuration: Debug
-
-  - xcode_version: 11.6
-    target: ios-dynamic
-    configuration: Release
-
-  - xcode_version: 12.0
-    target: ios-dynamic
-    configuration: Debug
-
-  - xcode_version: 11.3
-    target: watchos
-    configuration: Debug
-
-  - xcode_version: 11.4.1
-    target: watchos
-    configuration: Debug
-
-  - xcode_version: 11.4.1
-    target: watchos
-    configuration: Release
-
-  - xcode_version: 11.5
-    target: watchos
-    configuration: Debug
-
-  - xcode_version: 11.5
-    target: watchos
-    configuration: Release
-
-  - xcode_version: 11.6
-    target: watchos
-    configuration: Debug
-
-  - xcode_version: 11.6
-    target: watchos
-    configuration: Release
-
-  - xcode_version: 12.0
-    target: watchos
-    configuration: Debug
-
-  - xcode_version: 11.3
-    target: tvos
-    configuration: Debug
-
-  - xcode_version: 11.4.1
-    target: tvos
-    configuration: Debug
-
-  - xcode_version: 11.4.1
-    target: tvos
-    configuration: Release
-
-  - xcode_version: 11.5
-    target: tvos
-    configuration: Debug
-
-  - xcode_version: 11.5
-    target: tvos
-    configuration: Release
-
-  - xcode_version: 11.6
-    target: tvos
-    configuration: Debug
-
-  - xcode_version: 11.6
-    target: tvos
-    configuration: Release
-
-  - xcode_version: 12.0
-    target: tvos
-    configuration: Debug
-
-  - xcode_version: 11.3
-    target: ios-swift
-    configuration: Debug
-
-  - xcode_version: 11.4.1
-    target: ios-swift
-    configuration: Debug
-
-  - xcode_version: 11.4.1
-    target: ios-swift
-    configuration: Release
-
-  - xcode_version: 11.5
-    target: ios-swift
-    configuration: Debug
-
-  - xcode_version: 11.5
-    target: ios-swift
-    configuration: Release
-
-  - xcode_version: 11.6
-    target: ios-swift
-    configuration: Debug
-
-  - xcode_version: 11.6
-    target: ios-swift
-    configuration: Release
-
-  - xcode_version: 12.0
-    target: ios-swift
-    configuration: Debug
-
-  - xcode_version: 11.3
-    target: tvos-swift
-    configuration: Debug
-
-  - xcode_version: 11.4.1
-    target: tvos-swift
-    configuration: Debug
-
-  - xcode_version: 11.4.1
-    target: tvos-swift
-    configuration: Release
-
-  - xcode_version: 11.5
-    target: tvos-swift
-    configuration: Debug
-
-  - xcode_version: 11.5
-    target: tvos-swift
-    configuration: Release
-
-  - xcode_version: 11.6
-    target: tvos-swift
-    configuration: Debug
-
-  - xcode_version: 11.6
-    target: tvos-swift
-    configuration: Release
-
-  - xcode_version: 12.0
-    target: tvos-swift
-    configuration: Debug
-
-  - xcode_version: 11.3
-    target: catalyst
-    configuration: Debug
-
-  - xcode_version: 11.4.1
-    target: catalyst
-    configuration: Debug
-
-  - xcode_version: 11.4.1
-    target: catalyst
-    configuration: Release
-
-  - xcode_version: 11.5
-    target: catalyst
-    configuration: Debug
-
-  - xcode_version: 11.5
-    target: catalyst
-    configuration: Release
-
-  - xcode_version: 11.6
-    target: catalyst
-    configuration: Debug
-
-  - xcode_version: 11.6
-    target: catalyst
-    configuration: Release
-
-  - xcode_version: 12.0
-    target: catalyst
-    configuration: Debug
-
-  - xcode_version: 11.3
-    target: catalyst-swift
-    configuration: Debug
-
-  - xcode_version: 11.4.1
-    target: catalyst-swift
-    configuration: Debug
-
-  - xcode_version: 11.4.1
-    target: catalyst-swift
-    configuration: Release
-
-  - xcode_version: 11.5
-    target: catalyst-swift
-    configuration: Debug
-
-  - xcode_version: 11.5
-    target: catalyst-swift
-    configuration: Release
-
-  - xcode_version: 11.6
-    target: catalyst-swift
-    configuration: Debug
-
-  - xcode_version: 11.6
-    target: catalyst-swift
-    configuration: Release
-
-  - xcode_version: 12.0
-    target: catalyst-swift
-    configuration: Debug
-
-  - xcode_version: 11.3
-    target: xcframework
-    configuration: Debug
-
-  - xcode_version: 11.3
-    target: xcframework
-    configuration: Release
-
-  - xcode_version: 11.4.1
-    target: xcframework
-    configuration: Debug
-
-  - xcode_version: 11.4.1
-    target: xcframework
-    configuration: Release
-
-  - xcode_version: 11.5
-    target: xcframework
-    configuration: Debug
-
-  - xcode_version: 11.5
-    target: xcframework
-    configuration: Release
-
-  - xcode_version: 11.6
-    target: xcframework
-    configuration: Debug
-
-  - xcode_version: 11.6
-    target: xcframework
-    configuration: Release
-
-  - xcode_version: 12.0
-    target: xcframework
-    configuration: Debug
-
-  - xcode_version: 11.3
-    target: cocoapods-osx
-    configuration: Debug
-
-  - xcode_version: 11.4.1
-    target: cocoapods-osx
-    configuration: Debug
-
-  - xcode_version: 11.5
-    target: cocoapods-osx
-    configuration: Debug
-
-  - xcode_version: 11.6
-    target: cocoapods-osx
-    configuration: Debug
-
-  - xcode_version: 12.0
-    target: cocoapods-osx
-    configuration: Debug
-
-  - xcode_version: 11.3
-    target: cocoapods-ios
-    configuration: Debug
-
-  - xcode_version: 11.4.1
-    target: cocoapods-ios
-    configuration: Debug
-
-  - xcode_version: 11.4.1
-    target: cocoapods-ios
-    configuration: Release
-
-  - xcode_version: 11.5
-    target: cocoapods-ios
-    configuration: Debug
-
-  - xcode_version: 11.5
-    target: cocoapods-ios
-    configuration: Release
-
-  - xcode_version: 11.6
-    target: cocoapods-ios
-    configuration: Debug
-
-  - xcode_version: 11.6
-    target: cocoapods-ios
-    configuration: Release
-
-  - xcode_version: 12.0
-    target: cocoapods-ios
-    configuration: Debug
-
-  - xcode_version: 11.3
-    target: cocoapods-ios-dynamic
-    configuration: Debug
-
-  - xcode_version: 11.4.1
-    target: cocoapods-ios-dynamic
-    configuration: Debug
-
-  - xcode_version: 11.4.1
-    target: cocoapods-ios-dynamic
-    configuration: Release
-
-  - xcode_version: 11.5
-    target: cocoapods-ios-dynamic
-    configuration: Debug
-
-  - xcode_version: 11.5
-    target: cocoapods-ios-dynamic
-    configuration: Release
-
-  - xcode_version: 11.6
-    target: cocoapods-ios-dynamic
-    configuration: Debug
-
-  - xcode_version: 11.6
-    target: cocoapods-ios-dynamic
-    configuration: Release
-
-  - xcode_version: 12.0
-    target: cocoapods-ios-dynamic
-    configuration: Debug
-
-  - xcode_version: 11.3
-    target: cocoapods-watchos
-    configuration: Debug
-
-  - xcode_version: 11.4.1
-    target: cocoapods-watchos
-    configuration: Debug
-
-  - xcode_version: 11.4.1
-    target: cocoapods-watchos
-    configuration: Release
-
-  - xcode_version: 11.5
-    target: cocoapods-watchos
-    configuration: Debug
-
-  - xcode_version: 11.5
-    target: cocoapods-watchos
-    configuration: Release
-
-  - xcode_version: 11.6
-    target: cocoapods-watchos
-    configuration: Debug
-
-  - xcode_version: 11.6
-    target: cocoapods-watchos
-    configuration: Release
-
-  - xcode_version: 12.0
-    target: cocoapods-watchos
-    configuration: Debug
-
-  - xcode_version: 11.3
-    target: swiftpm
-    configuration: Debug
-
-  - xcode_version: 11.4.1
-    target: swiftpm
-    configuration: Debug
-
-  - xcode_version: 11.4.1
-    target: swiftpm
-    configuration: Release
-
-  - xcode_version: 11.5
-    target: swiftpm
-    configuration: Debug
-
-  - xcode_version: 11.5
-    target: swiftpm
-    configuration: Release
-
-  - xcode_version: 11.6
-    target: swiftpm
-    configuration: Debug
-
-  - xcode_version: 11.6
-    target: swiftpm
-    configuration: Release
-
-  - xcode_version: 12.0
-    target: swiftpm
-    configuration: Debug
-
-  - xcode_version: 11.3
-    target: swiftpm-address
-    configuration: Debug
-
-  - xcode_version: 11.3
-    target: swiftpm-address
-    configuration: Release
-
-  - xcode_version: 11.4.1
-    target: swiftpm-address
-    configuration: Debug
-
-  - xcode_version: 11.4.1
-    target: swiftpm-address
-    configuration: Release
-
-  - xcode_version: 11.5
-    target: swiftpm-address
-    configuration: Debug
-
-  - xcode_version: 11.5
-    target: swiftpm-address
-    configuration: Release
-
-  - xcode_version: 11.6
-    target: swiftpm-address
-    configuration: Debug
-
-  - xcode_version: 11.6
-    target: swiftpm-address
-    configuration: Release
-
-  - xcode_version: 12.0
-    target: swiftpm-address
-    configuration: Debug
-
-  - xcode_version: 11.3
-    target: swiftpm-thread
-    configuration: Debug
-
-  - xcode_version: 11.3
-    target: swiftpm-thread
-    configuration: Release
-
-  - xcode_version: 11.4.1
-    target: swiftpm-thread
-    configuration: Debug
-
-  - xcode_version: 11.4.1
-    target: swiftpm-thread
-    configuration: Release
-
-  - xcode_version: 11.5
-    target: swiftpm-thread
-    configuration: Debug
-
-  - xcode_version: 11.5
-    target: swiftpm-thread
-    configuration: Release
-
-  - xcode_version: 11.6
-    target: swiftpm-thread
-    configuration: Debug
-
-  - xcode_version: 11.6
-    target: swiftpm-thread
-    configuration: Release
-
-  - xcode_version: 12.0
-    target: swiftpm-thread
-    configuration: Debug
-
-  - xcode_version: 11.3
-    target: swiftpm-ios
-    configuration: Debug
-
-  - xcode_version: 11.3
-    target: swiftpm-ios
-    configuration: Release
-
-  - xcode_version: 11.4.1
-    target: swiftpm-ios
-    configuration: Debug
-
-  - xcode_version: 11.4.1
-    target: swiftpm-ios
-    configuration: Release
-
-  - xcode_version: 11.5
-    target: swiftpm-ios
-    configuration: Debug
-
-  - xcode_version: 11.5
-    target: swiftpm-ios
-    configuration: Release
-
-  - xcode_version: 11.6
-    target: swiftpm-ios
-    configuration: Debug
-
-  - xcode_version: 11.6
-    target: swiftpm-ios
-    configuration: Release
-
-  - xcode_version: 12.0
-    target: swiftpm-ios
-    configuration: Debug

+ 0 - 43
Carthage/Checkouts/realm-cocoa/.swiftlint.yml

@@ -1,43 +0,0 @@
-included:
-  - Realm/ObjectServerTests
-  - RealmSwift
-  - Realm/Swift
-  - examples/installation/watchos/swift
-  - examples/installation/osx/swift
-  - examples/installation/ios/swift
-  - examples/ios/swift
-  - examples/tvos/swift
-identifier_name:
-  min_length: # not possible to disable this partial rule, so set it to zero
-    warning: 0
-    error: 0
-  excluded:
-    - _nilValue()
-    - _nsError
-    - _nsErrorDomain
-    - _observe(_:)
-    - _realmColumnNames()
-    - _realmObjectName()
-    - _rlmArray()
-    - id
-    - pk
-    - to
-disabled_rules:
-  - block_based_kvo
-  # SwiftLint considers 'Realm' and 'Realm.Private' to be duplicate imports
-  # because we're using submodules in an unsual way, and normally the parent
-  # module re-exports all of its children.
-  - duplicate_imports
-  - file_length
-  - force_cast
-  - force_try
-  - function_body_length
-  - line_length
-  - nesting
-  - syntactic_sugar
-  - todo
-  - type_body_length
-  - vertical_whitespace
-  # swiftlint complains about superfluous disable commands when the violation
-  # occurs in an inactive #if and doesn't support conditionally disabling it
-  - cyclomatic_complexity

+ 0 - 39
Carthage/Checkouts/realm-cocoa/.travis.yml

@@ -1,39 +0,0 @@
-language: objective-c
-osx_image: xcode11.6
-branches:
-  only: master
-script: placeholder # workaround for https://github.com/travis-ci/travis-ci/issues/4681
-matrix:
-  include:
-    - script: ./build.sh verify-swiftlint
-      env: JOB=verify-swiftlint
-      before_install: brew update; brew outdated swiftlint || brew upgrade swiftlint
-    - script: ./build.sh verify-docs
-      env: JOB=verify-docs
-      before_install: gem install jazzy
-    - script: ./build.sh verify-osx-swift
-      env: JOB=verify-osx-swift
-    - script: ./build.sh test-tvos
-      env: JOB=test-tvos
-    - script: ./build.sh verify-osx
-      env: JOB=verify-osx
-    # These jobs are disabled pending work to fix their configuration when running
-    # on the Travis machines, without also breaking our internal CI system.
-    # - script: ./build.sh test-ios-swift
-    #   env: JOB=test-ios-swift
-    # - script: ./build.sh test-ios-static
-    #   env: JOB=test-ios-static
-
-    ############################################################################
-    # These jobs pass but are disabled because they occasionally make Travis
-    # exceed its maximum of 50 minutes in aggregate for matrix builds.
-    ############################################################################
-
-    # - script: ./build.sh verify-ios-dynamic
-    #   env: JOB=verify-ios-dynamic
-    # - script: ./build.sh verify-osx-encryption
-    #   env: JOB=verify-osx-encryption
-  exclude:
-    - script: placeholder # workaround for https://github.com/travis-ci/travis-ci/issues/4681
-notifications:
-  email: false

+ 0 - 4946
Carthage/Checkouts/realm-cocoa/CHANGELOG.md

@@ -1,4946 +0,0 @@
-5.4.0 Release notes (2020-09-09)
-=============================================================
-
-This version bumps the Realm file format version. This means that older
-versions of Realm will be unable to open Realm files written by this version,
-and a new version of Realm Studio will be required. There are no actual format
-changes and the version bump is just to force a re-migration of incorrectly
-upgraded Realms.
-
-### Fixed
-
-* Upgrading pre-5.x files with string primary keys would result in a file where
-  `realm.object(ofType:forPrimaryKey:)` would fail to find the object.
-  ([#6716](https://github.com/realm/realm-cocoa/issues/6716), since 5.2.0)
-* A write transaction which modifies an object with more than 16 managed
-  properties and causes the Realm file to grow larger than 2 GB could cause an
-  assertion failure mentioning "m_has_refs". ([JS #3194](https://github.com/realm/realm-js/issues/3194), since 5.0.0).
-* Objects with more than 32 properties could corrupt the Realm file and result
-  in a variety of crashes. ([Java #7057](https://github.com/realm/realm-java/issues/7057), since 5.0.0).
-
-### Compatibility
-
-* File format: Generates Realms with format v11 (Reads and upgrades all previous formats)
-* Realm Object Server: 3.21.0 or later.
-* Realm Studio: 3.12 or later.
-* APIs are backwards compatible with all previous releases in the 5.x.y series.
-* Carthage release for Swift is built with Xcode 11.6.
-
-### Internal
-
-* Upgraded realm-core from v6.0.23 to v6.0.25
-* Upgraded realm-sync from v5.0.20 to v5.0.22
-
-5.3.6 Release notes (2020-09-02)
-=============================================================
-
-### Fixed
-
-* Work around iOS 14 no longer allowing the use of file locks in shared
-  containers, which resulted in the OS killing an app which entered the
-  background while a Realm was open ([#6671](https://github.com/realm/realm-cocoa/issues/6671)).
-* If an attempt to upgrade a realm has ended with a crash with "migrate_links()"
-  in the call stack, the realm was left in an invalid state. The migration
-  logic now handles this state and can complete upgrading files which were
-  incompletely upgraded by pre-5.3.4 versions.
-* Fix deadlocks when writing to a Realm file on an exFAT partition from macOS.
-  ([#6691](https://github.com/realm/realm-cocoa/issues/6691)).
-
-### Compatibility
-
-* File format: Generates Realms with format v10 (Reads and upgrades all previous formats)
-* Realm Object Server: 3.21.0 or later.
-* Realm Studio: 3.11 or later.
-* APIs are backwards compatible with all previous releases in the 5.x.y series.
-* Carthage release for Swift is built with Xcode 11.6.
-
-### Internal
-
-* Upgraded realm-core from v6.0.19 to v6.0.23
-* Upgraded realm-sync from v5.0.16 to v5.0.20
-
-5.3.5 Release notes (2020-08-20)
-=============================================================
-
-### Fixed
-
-* Opening Realms on background threads could produce spurious Incorrect Thread
-  exceptions when a cached Realm existed for a previously existing thread with
-  the same thread ID as the current thread.
-  ([#6659](https://github.com/realm/realm-cocoa/issues/6659),
-  [#6689](https://github.com/realm/realm-cocoa/issues/6689),
-  [#6712](https://github.com/realm/realm-cocoa/issues/6712), since 5.0.0).
-* Upgrading a table with incoming links but no properties would crash. This was
-  probably not possible to hit in practice as we reject object types with no
-  properties.
-* Upgrading a non-nullable List which nonetheless contained null values would
-  crash. This was possible due to missing error-checking in some older versions
-  of Realm.
-
-### Compatibility
-
-* File format: Generates Realms with format v10 (Reads and upgrades all previous formats)
-* Realm Object Server: 3.21.0 or later.
-* Realm Studio: 3.11 or later.
-* APIs are backwards compatible with all previous releases in the 5.x.y series.
-* Carthage release for Swift is built with Xcode 11.6.
-
-### Internal
-
-* Upgraded realm-core from v6.0.18 to v6.0.19
-* Upgraded realm-sync from v5.0.15 to v5.0.16
-
-5.3.4 Release notes (2020-08-17)
-=============================================================
-
-### Fixed
-
-* Accessing a Realm after calling `deleteAll()` would sometimes throw an
-  exception with the reason 'ConstIterator copy failed'. ([#6597](https://github.com/realm/realm-cocoa/issues/6597), since 5.0.0).
-* Fix an assertion failure inside the `migrate_links()` function when upgrading
-  a pre-5.0 Realm file.
-* Fix a bug in memory mapping management. This bug could result in multiple
-  different asserts as well as segfaults. In many cases stack backtraces would
-  include members of the EncyptedFileMapping near the top - even if encryption
-  was not used at all. In other cases asserts or crashes would be in methods
-  reading an array header or array element. In all cases the application would
-  terminate immediately. ([Core #3838](https://github.com/realm/realm-core/pull/3838), since v5.0.0).
-
-### Compatibility
-
-* File format: Generates Realms with format v10 (Reads and upgrades all previous formats)
-* Realm Object Server: 3.21.0 or later.
-* Realm Studio: 3.11 or later.
-* APIs are backwards compatible with all previous releases in the 5.x.y series.
-* Carthage release for Swift is built with Xcode 11.6.
-
-### Internal
-
-* Upgraded realm-core from v6.0.14 to v6.0.18
-* Upgraded realm-sync from v5.0.14 to v5.0.15
-
-5.3.3 Release notes (2020-07-30)
-=============================================================
-
-### Enhancements
-
-* Add support for the x86_64 watchOS simulator added in Xcode 12.
-
-### Fixed
-
-* (RLM)Results objects would incorrectly pin old read transaction versions
-  until they were accessed after a Realm was refreshed, resulting in the Realm
-  file growing to large sizes if a Results was retained but not accessed after
-  every write. ([#6677](https://github.com/realm/realm-cocoa/issues/6677), since 5.0.0).
-* Fix linker errors when using SwiftUI previews with Xcode 12 when Realm was
-  installed via Swift Package Manager. ([#6625](https://github.com/realm/realm-cocoa/issues/6625))
-
-### Compatibility
-
-* File format: Generates Realms with format v10 (Reads and upgrades all previous formats)
-* Realm Object Server: 3.21.0 or later.
-* Realm Studio: 3.11 or later.
-* APIs are backwards compatible with all previous releases in the 5.x.y series.
-* Carthage release for Swift is built with Xcode 11.6.
-
-### Internal
-
-* Upgraded realm-core from v6.0.12 to v6.0.14
-* Upgraded realm-sync from v5.0.12 to v5.0.14
-
-5.3.2 Release notes (2020-07-21)
-=============================================================
-
-### Fixed
-
-* Fix a file format upgrade bug when opening older Realm files. Could cause
-  assertions like "Assertion failed: ref != 0" during opning of a Realm.
-  ([Core #6644](https://github.com/realm/realm-cocoa/issues/6644), since 5.2.0)
-* A use-after-free would occur if a Realm was compacted, opened on multiple
-  threads prior to the first write, then written to while reads were happening
-  on other threads. This could result in a variety of crashes, often inside
-  realm::util::EncryptedFileMapping::read_barrier.
-  (Since v5.0.0, [#6626](https://github.com/realm/realm-cocoa/issues/6626),
-  [#6628](https://github.com/realm/realm-cocoa/issues/6628),
-  [#6652](https://github.com/realm/realm-cocoa/issues/6652),
-  [#6655](https://github.com/realm/realm-cocoa/issues/6555),
-  [#6656](https://github.com/realm/realm-cocoa/issues/6656)).
-
-### Compatibility
-
-* File format: Generates Realms with format v10 (Reads and upgrades all previous formats)
-* Realm Object Server: 3.21.0 or later.
-* Realm Studio: 3.11 or later.
-* APIs are backwards compatible with all previous releases in the 5.x.y series.
-* Carthage release for Swift is built with Xcode 11.6.
-
-### Internal
-
-* Upgraded realm-core from v6.0.11 to v6.0.12
-* Upgraded realm-sync from v5.0.11 to v5.0.12
-
-5.3.1 Release notes (2020-07-17)
-=============================================================
-
-### Enhancements
-
-* Add prebuilt binary for Xcode 11.6 to the release package.
-
-### Fixed
-
-* Creating an object inside migration which changed that object type's primary
-  key would hit an assertion failure mentioning primary_key_col
-  ([#6613](https://github.com/realm/realm-cocoa/issues/6613), since 5.0.0).
-* Modifying the value of a string primary key property inside a migration with
-  a Realm file which was upgraded from pre-5.0 would corrupt the property's
-  index, typically resulting in crashes. ([Core #3765](https://github.com/realm/realm-core/issues/3765), since 5.0.0).
-* Some Realm files which hit assertion failures when upgrading from the pre-5.0
-  file format should now upgrade correctly (Since 5.0.0).
-
-### Compatibility
-
-* File format: Generates Realms with format v10 (Reads and upgrades all previous formats)
-* Realm Object Server: 3.21.0 or later.
-* Realm Studio: 3.11 or later.
-* APIs are backwards compatible with all previous releases in the 5.x.y series.
-* Carthage release for Swift is built with Xcode 11.6.
-
-### Internal
-
-* Upgraded realm-core from v6.0.9 to v6.0.11
-* Upgraded realm-sync from v5.0.8 to v5.0.11
-
-5.3.0 Release notes (2020-07-14)
-=============================================================
-
-### Enhancements
-
-* Add `Realm.objectWillChange`, which is a Combine publisher that will emit a
-  notification each time the Realm is refreshed or a write transaction is
-  commited.
-
-### Fixed
-
-* Fix the spelling of `ObjectKeyIdentifiable`. The old spelling is available
-  and deprecated for compatiblity.
-* Rename `RealmCollection.publisher` to `RealmCollection.collectionPublisher`.
-  The old name interacted with the `publisher` defined by `Sequence` in very
-  confusing ways, so we need to use a different name. The `publisher` name is
-  still available for compatiblity. ([#6516](https://github.com/realm/realm-cocoa/issues/6516))
-* Work around "xcodebuild timed out while trying to read
-  SwiftPackageManagerExample.xcodeproj" errors when installing Realm via
-  Carthage. ([#6549](https://github.com/realm/realm-cocoa/issues/6549)).
-* Fix a performance regression when using change notifications. (Since 5.0.0,
-  [#6629](https://github.com/realm/realm-cocoa/issues/6629)).
-
-### Compatibility
-
-* File format: Generates Realms with format v10 (Reads and upgrades all previous formats)
-* Realm Object Server: 3.21.0 or later.
-* Realm Studio: 3.11 or later.
-* APIs are backwards compatible with all previous releases in the 5.x.y series.
-* Carthage release for Swift is built with Xcode 11.5.
-
-### Internal
-
-* Upgraded realm-core from v6.0.8 to v6.0.9
-* Upgraded realm-sync from v5.0.7 to v5.0.8
-
-5.2.0 Release notes (2020-06-30)
-=============================================================
-
-Xcode 11.3 and iOS 9 are now the minimum supported versions.
-
-### Enhancements
-
-* Add support for building with Xcode 12 beta 1. watchOS currently requires
-  removing x86_64 from the supported architectures. Support for the new 64-bit
-  watch simulator will come in a future release.
-
-### Fixed
-
-* Opening a Realm file in file format v6 (created by Realm Cocoa versions
-  between 2.4 and 2.10) would crash. (Since 5.0.0, [Core #3764](https://github.com/realm/realm-core/issues/3764)).
-* Upgrading v9 (pre-5.0) Realm files would create a redundant search index for
-  primary key properties. This index would then be removed the next time the
-  Realm was opened, resulting in some extra i/o in the upgrade process.
-  (Since 5.0.0, [Core #3787](https://github.com/realm/realm-core/issues/3787)).
-* Fixed a performance issue with upgrading v9 files with search indexes on
-  non-primary-key properties. (Since 5.0.0, [Core #3767](https://github.com/realm/realm-core/issues/3767)).
-* `List.index(of:)` would give incorrect results if it was the very first thing
-  called on that List after a Realm was refreshed following a write which
-  modified the List. (Since 5.0.0, [#6606](https://github.com/realm/realm-cocoa/issues/6606)).
-* If a ThreadSafeReference was the only remaining reference to a Realm,
-  multiple copies of the file could end up mapped into memory at once. This
-  probably did not have any symptoms other than increased memory usage. (Since 5.0.0).
-
-### Compatibility
-
-* File format: Generates Realms with format v10 (Reads and upgrades all previous formats)
-* Realm Object Server: 3.21.0 or later.
-* Realm Studio: 3.11 or later.
-* APIs are backwards compatible with all previous releases in the 5.x.y series.
-* Carthage release for Swift is built with Xcode 11.5.
-
-### Internal
-
-* Upgraded realm-core from v6.0.6 to v6.0.8
-* Upgraded realm-sync from v5.0.5 to v5.0.7
-
-5.1.0 Release notes (2020-06-22)
-=============================================================
-
-### Enhancements
-
-* Allow opening full-sync Realms in read-only mode. This disables local schema
-  initialization, which makes it possible to open a Realm which the user does
-  not have write access to without using asyncOpen. In addition, it will report
-  errors immediately when an operation would require writing to the Realm
-  rather than reporting it via the sync error handler only after the server
-  rejects the write.
-
-### Fixed
-
-* Opening a Realm using a configuration object read from an existing Realm
-  would incorrectly bind the new Realm to the original Realm's thread/queue,
-  resulting in "Realm accessed from incorrect thread." exceptions.
-  ([#6574](https://github.com/realm/realm-cocoa/issues/6574),
-  [#6559](https://github.com/realm/realm-cocoa/issues/6559), since 5.0.0).
-
-### Compatibility
-
-* File format: Generates Realms with format v10 (Reads and upgrades all previous formats)
-* Realm Object Server: 3.21.0 or later.
-* Realm Studio: 3.11 or later.
-* APIs are backwards compatible with all previous releases in the 5.x.y series.
-* Carthage release for Swift is built with Xcode 11.5.
-
-5.0.3 Release notes (2020-06-10)
-=============================================================
-
-### Fixed
-
-* `-[RLMObject isFrozen]` always returned false. ([#6568](https://github.com/realm/realm-cocoa/issues/6568), since 5.0.0).
-* Freezing an object within the write transaction that the object was created
-  in now throws an exception rather than crashing when the object is first
-  used.
-* The schema for frozen Realms was not properly initialized, leading to crashes
-  when accessing a RLMLinkingObjects property.
-  ([#6568](https://github.com/realm/realm-cocoa/issues/6568), since 5.0.0).
-* Observing `Object.isInvalidated` via a keypath literal would produce a
-  warning in Swift 5.2 due to the property not being marked as @objc.
-  ([#6554](https://github.com/realm/realm-cocoa/issues/6554))
-
-### Compatibility
-
-* File format: Generates Realms with format v10 (Reads and upgrades all previous formats)
-* Realm Object Server: 3.21.0 or later.
-* Realm Studio: 3.11 or later.
-* APIs are backwards compatible with all previous releases in the 5.x.y series.
-* Carthage release for Swift is built with Xcode 11.5.
-
-5.0.2 Release notes (2020-06-02)
-=============================================================
-
-### Fixed
-
-* Fix errSecDuplicateItem (-25299) errors when opening a synchronized Realm
-  when upgrading from pre-5.0 versions of Realm.
-  ([#6538](https://github.com/realm/realm-cocoa/issues/6538), [#6494](https://github.com/realm/realm-cocoa/issues/6494), since 5.0.0).
-* Opening Realms stored on filesystems which do not support preallocation (such
-  as ExFAT) would give "Operation not supported" exceptions.
-  ([#6508](https://github.com/realm/realm-cocoa/issues/6508), since 3.2.0).
-* 'NoSuchTable' exceptions would sometimes be thrown after upgrading a Relam
-  file to the v10 format. ([Core #3701](https://github.com/realm/realm-core/issues/3701), since 5.0.0)
-* If the upgrade process was interrupted/killed for various reasons, the
-  following run could stop with some assertions failing. No instances of this
-  happening were reported to us. (Since 5.0.0).
-* Queries filtering a `List` where the query was on an indexed property over a
-  link would sometimes give incomplete results.
-  ([#6540](https://github.com/realm/realm-cocoa/issues/6540), since 4.1.0 but
-  more common since 5.0.0)
-* Opening a file in read-only mode would attempt to make a spurious write to
-  the file, causing errors if the file was in read-only storage (since 5.0.0).
-
-### Compatibility
-
-* File format: Generates Realms with format v10 (Reads and upgrades all previous formats)
-* Realm Object Server: 3.21.0 or later.
-* Realm Studio: 3.11 or later.
-* APIs are backwards compatible with all previous releases in the 5.x.y series.
-* Carthage release for Swift is built with Xcode 11.5.
-
-### Internal
-
-* Upgraded realm-core from v6.0.4 to v6.0.6
-* Upgraded realm-sync from v5.0.3 to v5.0.5
-
-5.0.1 Release notes (2020-05-27)
-=============================================================
-
-### Enhancements
-
-* Add prebuilt binary for Xcode 11.5 to the release package.
-
-### Fixed
-
-* Fix linker error when building a xcframework for Catalyst.
-  ([#6511](https://github.com/realm/realm-cocoa/issues/6511), since 4.3.1).
-* Fix building for iOS devices when using Swift Package Manager
-  ([#6522](https://github.com/realm/realm-cocoa/issues/6522), since 5.0.0).
-* `List` and `RealmOptional` properties on frozen objects were not initialized
-  correctly and would always report `nil` or an empty list.
-  ([#6527](https://github.com/realm/realm-cocoa/issues/6527), since 5.0.0).
-
-### Compatibility
-
-* File format: Generates Realms with format v10 (Reads and upgrades all previous formats)
-* Realm Object Server: 3.21.0 or later.
-* Realm Studio: 3.11 or later.
-* APIs are backwards compatible with all previous releases in the 5.x.y series.
-* Carthage release for Swift is built with Xcode 11.5.
-
-5.0.0 Release notes (2020-05-15)
-=============================================================
-
-NOTE: This version bumps the Realm file format to version 10. It is not
-possible to downgrade version 9 or earlier. Files created with older versions
-of Realm will be automatically upgraded. Only 
-[Studio 3.11](https://github.com/realm/realm-studio/releases/tag/v3.11.0) or later will be able
-to open the new file format.
-
-### Enhancements
-
-* Storing large binary blobs in Realm files no longer forces the file to be at
-  least 8x the size of the largest blob.
-* Reduce the size of transaction logs stored inside the Realm file, reducing
-  file size growth from large transactions.
-* Add support for frozen objects. `Realm`, `Results`, `List` and `Object` now
-  have `freeze()` methods which return a frozen copy of the object. These
-  objects behave similarly to creating unmanaged deep copies of the source
-  objects. They can be read from any thread and do not update when writes are
-  made to the Realm, but creating frozen objects does not actually copy data
-  out of the Realm and so can be much faster and use less memory. Frozen
-  objects cannot be mutated or observed for changes (as they never change).
-  ([PR #6427](https://github.com/realm/realm-cocoa/pull/6427)).
-* Add the `isFrozen` property to `Realm`, `Results`, `List` and `Object`.
-* Add `Realm.Configuration.maxNumberOfActiveVersions`. Each time a write
-  transaction is performed, a new version is created inside the Realm, and then
-  any versions which are no longer in use are cleaned up. If too many versions
-  are kept alive while performing writes (either due to a background thread
-  performing a long operation that doesn't let the Realm on that thread
-  refresh, or due to holding onto frozen versions for a long time) the Realm
-  file will grow in size, potentially to the point where it is too large to be
-  opened. Setting this configuration option will make write transactions which
-  would cause the live version count to exceed the limit to instead fail.
-* Add support for queue-confined Realms. Rather than being bound to a specific
-  thread, queue-confined Realms are bound to a serial dispatch queue and can be
-  used within blocks dispatched to that queue regardless of what thread they
-  happen to run on. In addition, change notifications will be delivered to that
-  queue rather than the thread's run loop. ([PR #6478](https://github.com/realm/realm-cocoa/pull/6478)).
-* Add an option to deliver object and collection notifications to a specific
-  serial queue rather than the current thread. ([PR #6478](https://github.com/realm/realm-cocoa/pull/6478)).
-* Add Combine publishers for Realm types. Realm collections have a `.publisher`
-  property which publishes the collection each time it changes, and a
-  `.changesetPublisher` which publishes a `RealmCollectionChange` each time the
-  collection changes. Corresponding publishers for Realm Objects can be
-  obtained with the `publisher()` and `changesetPublisher()` global functions.
-* Extend Combine publishers which output Realm types with a `.freeze()`
-  function which will make the publisher instead output frozen objects.
-* String primary keys no longer require a separate index, improving insertion
-  and deletion performance without hurting lookup performance.
-* Reduce the encrypted page reclaimer's impact on battery life when encryption
-  is used. ([Core #3461](https://github.com/realm/realm-core/pull/3461)).
-
-### Fixed
-
-* The uploaded bytes in sync progress notifications was sometimes incorrect and
-  wouldn't exactly equal the uploadable bytes when the uploaded completed.
-* macOS binaries were built with the incorrect deployment target (10.14 rather
-  than 10.9), resulting in linker warnings. ([#6299](https://github.com/realm/realm-cocoa/issues/6299), since 3.18.0).
-* An internal datastructure for List properties could be double-deleted if the
-  last reference was released from a thread other than the one which the List
-  was created on at the wrong time. This would typically manifest as
-  "pthread_mutex_destroy() failed", but could also result in other kinds of
-  crashes. ([#6333](https://github.com/realm/realm-cocoa/issues/6333)).
-* Sorting on float or double properties containing NaN values had inconsistent
-  results and would sometimes crash due to out-of-bounds memory accesses.
-  ([#6357](https://github.com/realm/realm-cocoa/issues/6357)).
-
-### Breaking Changes
-
-* The ObjectChange type in Swift is now generic and includes a reference to the
-  object which changed. When using `observe(on:)` to receive notifications on a
-  dispatch queue, the object will be confined to that queue.
-* The Realm instance passed in the callback to asyncOpen() is now confined to
-  the callback queue passed to asyncOpen() rather than the thread which the
-  callback happens to be called on. This means that the Realm instance may be
-  stored and reused in further blocks dispatched to that queue, but the queue
-  must now be a serial queue.
-* Files containing Date properties written by version of Realm prior to 1.0 can
-  no longer be opened.
-* Files containing Any properties can no longer be opened. This property type
-  was never documented and was deprecated in 1.0.
-* Deleting objects now preserves the order of objects reported by unsorted
-  Results rather than performing a swap operation before the delete. Note that
-  it is still not safe to assume that the order of objects in an unsorted
-  Results is the order that the objects were created in.
-* The minimum supported deployment target for iOS when using Swift Package
-  Manager to install Realm is now iOS 11.
-
-### Compatibility
-
-* File format: Generates Realms with format v10 (Reads and upgrades all previous formats)
-* Realm Object Server: 3.21.0 or later.
-* Realm Studio: 3.11 or later.
-* APIs are backwards compatible with all previous releases in the 5.x.y series.
-* Carthage release for Swift is built with Xcode 11.4.1.
-
-### Internal
-
-* Upgraded realm-core from v5.23.8 to v6.0.4
-* Upgraded realm-sync from v4.9.5 to v5.0.3
-
-5.0.0-beta.6 Release notes (2020-05-08)
-=============================================================
-
-### Enhancements
-
-* Add support for queue-confined Realms. Rather than being bound to a specific
-  thread, queue-confined Realms are bound to a serial dispatch queue and can be
-  used within blocks dispatched to that queue regardless of what thread they
-  happen to run on. In addition, change notifications will be delivered to that
-  queue rather than the thread's run loop. ([PR #6478](https://github.com/realm/realm-cocoa/pull/6478)).
-* Add an option to deliver object and collection notifications to a specific
-  serial queue rather than the current thread. ([PR #6478](https://github.com/realm/realm-cocoa/pull/6478)).
-
-### Fixed
-
-* The uploaded bytes in sync progress notifications was sometimes incorrect and
-  wouldn't exactly equal the uploadable bytes when the uploaded completed.
-
-### Breaking Changes
-
-* The Realm instance passed in the callback to asyncOpen() is now confined to
-  the callback queue passed to asyncOpen() rather than the thread which the
-  callback happens to be called on. This means that the Realm instance may be
-  stored and reused in further blocks dispatched to that queue, but the queue
-  must now be a serial queue.
-
-### Compatibility
-
-* File format: Generates Realms with format v10 (Reads and upgrades all previous formats)
-* Realm Object Server: 3.21.0 or later.
-* Carthage release for Swift is built with Xcode 11.4.1.
-
-### Internal
-
-* Upgraded realm-core from v6.0.3 to v6.0.4
-* Upgraded realm-sync from v5.0.1 to v5.0.3
-
-4.4.1 Release notes (2020-04-16)
-=============================================================
-
-### Enhancements
-
-* Upgrade Xcode 11.4 binaries to Xcode 11.4.1.
-
-### Fixed
-
-* Fix a "previous <= m_schema_transaction_version_max" assertion failure caused
-  by a race condition that could occur after performing a migration. (Since 3.0.0).
-
-### Compatibility
-
-* File format: Generates Realms with format v9 (Reads and upgrades all previous formats)
-* Realm Object Server: 3.21.0 or later.
-* Carthage release for Swift is built with Xcode 11.4.1.
-
-5.0.0-beta.3 Release notes (2020-02-26)
-=============================================================
-
-Based on 4.3.2 and also includes all changes since 4.3.0.
-
-### Enhancements
-
-* Add support for frozen objects. `Realm`, `Results`, `List` and `Object` now
-  have `freeze()` methods which return a frozen copy of the object. These
-  objects behave similarly to creating unmanaged deep copies of the source
-  objects. They can be read from any thread and do not update when writes are
-  made to the Realm, but creating frozen objects does not actually copy data
-  out of the Realm and so can be much faster and use less memory. Frozen
-  objects cannot be mutated or observed for changes (as they never change).
-  ([PR #6427](https://github.com/realm/realm-cocoa/pull/6427)).
-* Add the `isFrozen` property to `Realm`, `Results`, `List` and `Object`.
-* Add `Realm.Configuration.maxNumberOfActiveVersions`. Each time a write
-  transaction is performed, a new version is created inside the Realm, and then
-  any versions which are no longer in use are cleaned up. If too many versions
-  are kept alive while performing writes (either due to a background thread
-  performing a long operation that doesn't let the Realm on that thread
-  refresh, or due to holding onto frozen versions for a long time) the Realm
-  file will grow in size, potentially to the point where it is too large to be
-  opened. Setting this configuration option will make write transactions which
-  would cause the live version count to exceed the limit to instead fail.
-
-
-### Compatibility
-
-* File format: Generates Realms with format v10 (Reads and upgrades all previous formats)
-* Realm Object Server: 3.21.0 or later.
-* APIs are backwards compatible with all previous releases in the 5.x.y series.
-* Carthage release for Swift is built with Xcode 11.3.
-
-### Internal
-
-* Upgraded realm-core from v6.0.0-beta.3 to v6.0.3
-* Upgraded realm-sync from v5.0.0-beta.2 to v5.0.1
-
-5.0.0-beta.2 Release notes (2020-01-13)
-=============================================================
-
-Based on 4.3.0 and also includes all changes since 4.1.1.
-
-### Fixed
-
-* Fix compilation when using CocoaPods targeting iOS versions older than 11 (since 5.0.0-alpha).
-
-### Compatibility
-
-* File format: Generates Realms with format v10 (Reads and upgrades all previous formats)
-* Realm Object Server: 3.21.0 or later.
-* APIs are backwards compatible with all previous releases in the 5.x.y series.
-* Carthage release for Swift is built with Xcode 11.3.
-
-### Internal
-
-* Upgraded realm-core from v6.0.0-beta.2 to v6.0.0-beta.3
-* Upgraded realm-sync from v5.0.0-beta.1 to v5.0.0-beta.2
-
-5.0.0-beta.1 Release notes (2019-12-13)
-=============================================================
-
-Based on 4.1.1 and also includes all changes since 4.1.0.
-
-NOTE: This version bumps the Realm file format to version 10. It is not possible to downgrade version 9 or earlier. Files created with older versions of Realm will be automatically upgraded.
-
-### Enhancements
-
-* String primary keys no longer require a separate index, improving insertion
-  and deletion performance without hurting lookup performance.
-* Reduce the encrypted page reclaimer's impact on battery life when encryption
-  is used. ([Core #3461](https://github.com/realm/realm-core/pull/3461)).
-
-### Fixed
-
-* Fix an error when a table-backed Results was accessed immediately after
-  deleting the object previously at the index being accessed (since
-  5.0.0-alpha.1).
-* macOS binaries were built with the incorrect deployment target (10.14 rather
-  than 10.9), resulting in linker warnings. ([#6299](https://github.com/realm/realm-cocoa/issues/6299), since 3.18.0).
-* An internal datastructure for List properties could be double-deleted if the
-  last reference was released from a thread other than the one which the List
-  was created on at the wrong time. This would typically manifest as
-  "pthread_mutex_destroy() failed", but could also result in other kinds of
-  crashes. ([#6333](https://github.com/realm/realm-cocoa/issues/6333)).
-* Sorting on float or double properties containing NaN values had inconsistent
-  results and would sometimes crash due to out-of-bounds memory accesses.
-  ([#6357](https://github.com/realm/realm-cocoa/issues/6357)).
-
-### Known Issues
-
-* Changing which property of an object is the primary key in a migration will
-  break incoming links to objects of that type.
-* Changing the primary key of an object with Data properties in a migration
-  will crash.
-
-### Compatibility
-
-* File format: Generates Realms with format v10 (Reads and upgrades all previous formats)
-* Realm Object Server: 3.21.0 or later.
-* APIs are backwards compatible with all previous releases in the 5.x.y series.
-* Carthage release for Swift is built with Xcode 11.3.
-
-### Internal
-
-* Upgraded realm-core from v6.0.0-alpha.24 to v6.0.0-beta.2
-* Upgraded realm-sync from 4.7.1-core6.5 to v5.0.0-beta.1
-
-5.0.0-alpha.1 Release notes (2019-11-14)
-=============================================================
-
-Based on 4.1.0.
-
-### Enhancements
-
-* Add `-[RLMRealm fileExistsForConfiguration:]`/`Realm.fileExists(for:)`,
-  which checks if a local Realm file exists for the given configuration.
-* Add `-[RLMRealm deleteFilesForConfiguration:]`/`Realm.deleteFiles(for:)`
-  to delete the Realm file and all auxiliary files for the given configuration.
-* Storing large binary blobs in Realm files no longer forces the file to be at
-  least 8x the size of the largest blob.
-* Reduce the size of transaction logs stored inside the Realm file, reducing
-  file size growth from large transactions.
-
-NOTE: This version bumps the Realm file format to version 10. It is not
-possible to downgrade version 9 or earlier. Files created with older versions
-of Realm will be automatically upgraded. This automatic upgrade process is not
-yet well tested. Do not open Realm files with data you care about with this
-alpha version.
-
-### Breaking Changes
-
-* Files containing Date properties written by version of Realm prior to 1.0 can
-  no longer be opened.
-* Files containing Any properties can no longer be opened. This property type
-  was never documented and was deprecated in 1.0.
-
-### Compatibility
-
-* File format: Generates Realms with format v10 (Reads and upgrades v9)
-* Realm Object Server: 3.21.0 or later.
-* APIs are backwards compatible with all previous releases in the 4.x.y series.
-* Carthage release for Swift is built with Xcode 11.3.
-* Carthage release for Swift is built with Xcode 11.2.1.
-
-### Internal
-
-* Upgraded realm-core from 5.23.6 to v6.0.0-alpha.24.
-* Upgraded realm-sync from 4.8.2 to 4.7.1-core6.5.
-
-4.4.0 Release notes (2020-03-26)
-=============================================================
-
-Swift 4.0 and Xcode 10.3 are now the minimum supported versions.
-
-### Enhancements
-
-* Allow setting the `fileUrl` for synchronized Realms. An appropriate local
-  path based on the sync URL will still be used if it is not overridden.
-  ([PR #6454](https://github.com/realm/realm-cocoa/pull/6454)).
-* Add Xcode 11.4 binaries to the release package.
-
-### Fixed
-
-* None.
-
-### Compatibility
-
-* File format: Generates Realms with format v9 (Reads and upgrades all previous formats)
-* Realm Object Server: 3.21.0 or later.
-* Carthage release for Swift is built with Xcode 11.4.
-
-4.3.2 Release notes (2020-02-06)
-=============================================================
-
-### Enhancements
-
-* Similar to `autoreleasepool()`, `realm.write()` now returns the value which
-  the block passed to it returns. Returning `Void` from the block is still allowed.
-
-### Fixed
-
-* Fix a memory leak attributed to `property_copyAttributeList` the first time a
-  Realm is opened when using Realm Swift. ([#6409](https://github.com/realm/realm-cocoa/issues/6409), since 4.0.0).
-* Connecting to a `realms:` sync URL would crash at runtime on iOS 11 (and no
-  other iOS versions) inside the SSL validation code. (Since 4.3.1).
-
-### Compatibility
-
-* File format: Generates Realms with format v9 (Reads and upgrades all previous formats)
-* Realm Object Server: 3.21.0 or later.
-* Carthage release for Swift is built with Xcode 11.3.
-
-### Internal
-
-* Upgraded realm-sync from 4.9.4 to 4.9.5.
-
-4.3.1 Release notes (2020-01-16)
-=============================================================
-
-### Enhancements
-
-* Reduce the encrypted page reclaimer's impact on battery life when encryption
-  is used. ([Core #3461](https://github.com/realm/realm-core/pull/3461)).
-
-### Fixed
-
-* macOS binaries were built with the incorrect deployment target (10.14 rather
-  than 10.9), resulting in linker warnings. ([#6299](https://github.com/realm/realm-cocoa/issues/6299), since 3.18.0).
-* An internal datastructure for List properties could be double-deleted if the
-  last reference was released from a thread other than the one which the List
-  was created on at the wrong time. This would typically manifest as
-  "pthread_mutex_destroy() failed", but could also result in other kinds of
-  crashes. ([#6333](https://github.com/realm/realm-cocoa/issues/6333)).
-* Sorting on float or double properties containing NaN values had inconsistent
-  results and would sometimes crash due to out-of-bounds memory accesses.
-  ([#6357](https://github.com/realm/realm-cocoa/issues/6357)).
-* A NOT query on a `List<Object>` which happened to have the objects in a
-  different order than the underlying table would sometimes include the object
-  immediately before an object which matches the query. ([#6289](https://github.com/realm/realm-cocoa/issues/6289), since 0.90.0).
-
-### Compatibility
-
-* File format: Generates Realms with format v9 (Reads and upgrades all previous formats)
-* Realm Object Server: 3.21.0 or later.
-* Carthage release for Swift is built with Xcode 11.3.
-
-### Internal
-
-* Upgraded realm-core from 5.23.6 to 5.23.8.
-* Upgraded realm-sync from 4.9.0 to 4.9.4.
-
-4.3.0 Release notes (2019-12-19)
-=============================================================
-
-### Enhancements
-
-* Add the ability to set a custom logger function on `RLMSyncManager` which is
-  called instead of the default NSLog-based logger.
-* Expose configuration options for the various types of sync connection
-  timeouts and heartbeat intervals on `RLMSyncManager`.
-* Add an option to have `Realm.asyncOpen()` report an error if the connection
-  times out rather than swallowing the error and attempting to reconnect until
-  it succeeds.
-
-### Fixed
-
-* Fix a crash when using value(forKey:) on a LinkingObjects property (including
-  when doing so indirectly, such as by querying on that property).
-  ([#6366](https://github.com/realm/realm-cocoa/issues/6366), since 4.0.0).
-* Fix a rare crash in `ClientHistoryImpl::integrate_server_changesets()` which
-  would only happen in Debug builds (since v3.0.0).
-
-### Compatibility
-
-* File format: Generates Realms with format v9 (Reads and upgrades all previous formats)
-* Realm Object Server: 3.21.0 or later.
-* Carthage release for Swift is built with Xcode 11.3.
-
-### Internal
-
-* Upgraded realm-sync from 4.8.2 to 4.9.0.
-
-4.2.0 Release notes (2019-12-16)
-=============================================================
-
-### Enhancements
-
-* Add `-[RLMRealm fileExistsForConfiguration:]`/`Realm.fileExists(for:)`,
-  which checks if a local Realm file exists for the given configuration.
-* Add `-[RLMRealm deleteFilesForConfiguration:]`/`Realm.deleteFiles(for:)`
-  to delete the Realm file and all auxiliary files for the given configuration.
-
-### Fixed
-
-* None.
-
-### Compatibility
-
-* File format: Generates Realms with format v9 (Reads and upgrades all previous formats)
-* Realm Object Server: 3.21.0 or later.
-* Carthage release for Swift is built with Xcode 11.3.
-
-4.1.1 Release notes (2019-11-18)
-=============================================================
-
-### Fixed
-
-* The UpdatePolicy passed to `realm.add()` or `realm.create()` was not properly
-  propagated when adding objects within a `List`, which could result in
-  spurious change notifications when using `.modified`.
-  ([#6321](https://github.com/realm/realm-cocoa/issues/6321), since v3.16.0)
-* Fix a rare deadlock when a Realm collection or object was observed, then
-  `refresh()` was explicitly called, and then the NotificationToken from the
-  observation was destroyed on a different thread (since 0.98.0).
-
-### Compatibility
-
-* File format: Generates Realms with format v9 (Reads and upgrades all previous formats)
-* Realm Object Server: 3.21.0 or later.
-* Carthage release for Swift is built with Xcode 11.2.
-
-4.1.0 Release notes (2019-11-13)
-=============================================================
-
-### Enhancements
-
-* Improve performance of queries over a link where the final target property
-  has an index.
-* Restore support for storing `@objc enum` properties on RealmSwift.Object
-  subclasses (broken in 4.0.0), and add support for storing them in
-  RealmOptional properties.
-
-### Fixed
-
-* The sync client would fail to reconnect after failing to integrate a
-  changeset. The bug would lead to further corruption of the client’s Realm
-  file. ([RSYNC-48](https://jira.mongodb.org/browse/RSYNC-48), since v3.2.0).
-
-### Compatibility
-
-* File format: Generates Realms with format v9 (Reads and upgrades all previous formats)
-* Realm Object Server: 3.21.0 or later.
-* Carthage release for Swift is built with Xcode 11.2.
-
-### Internal
-
-* Upgraded realm-core from 5.23.5 to 5.23.6.
-* Upgraded realm-sync from 4.7.11 to 4.8.2
-
-4.0.0 Release notes (2019-11-08)
-=============================================================
-
-### Breaking Changes
-
-* All previously deprecated functionality has now been removed entirely.
-* The schema discovery logic for RealmSwift.Object subclasses has been
-  rewritten in Swift. This should not have any effect on valid class
-  definitions, but there may be types of invalid definitions which previously
-  worked by coincidence and no longer do.
-* `SyncSubscription` no longer has a generic type parameter, as the type was
-  not actually used for anything.
-* The following Swift types have changed from `final class` to `struct`:
-    - AnyRealmCollection
-    - LinkingObjects
-    - ObjectiveCSupport
-    - Realm
-    - Results
-    - SyncSubscription
-    - ThreadSafeReference
-  There is no intended change in semantics from this, but certain edge cases
-  may behave differently.
-* The designated initializers defined by RLMObject and Object other than
-  zero-argument `init` have been replaced with convenience initializers.
-* The implementation of the path-based permissions API has been redesigned to
-  accomodate changes to the server. This should be mostly a transparent change,
-  with two main exceptions:
-  1. SyncPermission objects are no longer live Realm objects, and retrieving
-  permissions gives an Array<SyncPermission> rather than Results<SyncPermission>.
-  Getting up-to-date permissions now requires calling retrievePermissions() again
-  rather than observing the permissions.
-  2. The error codes for permissions functions have changed. Rather than a
-  separate error type and set of error codes, permission functions now produce
-  SyncAuthErrors.
-
-### Enhancements
-
-* Improve performance of initializing Realm objects with List properties.
-
-### Fixed
-
-* None.
-
-### Compatibility
-
-* File format: Generates Realms with format v9 (Reads and upgrades all previous formats)
-* Realm Object Server: 3.21.0 or later.
-* Carthage release for Swift is built with Xcode 11.2.
-
-3.21.0 Release notes (2019-11-04)
-=============================================================
-
-### Enhancements
-
-* Add prebuilt binaries for Xcode 11.2.
-
-### Compatibility
-
-* File format: Generates Realms with format v9 (Reads and upgrades all previous formats)
-* Realm Object Server: 3.21.0 or later.
-* Carthage release for Swift is built with Xcode 11.2.
-
-3.20.0 Release notes (2019-10-21)
-=============================================================
-
-### Enhancements
-
-* Add support for custom refresh token authentication. This allows a user to be
-  authorized with an externally-issued refresh token when ROS is configured to
-  recognize the external issuer as a refresh token validator.
-  ([PR #6311](https://github.com/realm/realm-cocoa/pull/6311)).
-
-### Compatibility
-
-* File format: Generates Realms with format v9 (Reads and upgrades all previous formats)
-* Realm Object Server: 3.21.0 or later.
-* Carthage release for Swift is built with Xcode 11.
-
-3.19.1 Release notes (2019-10-17)
-=============================================================
-
-### Enhancements
-
-* Improve performance of sync changeset integration. Transactions involving a
-  very large number of objects and cheap operations on each object are as much
-  as 20% faster.
-
-### Fixed
-
-* Fix a crash when a RLMArray/List of primitives was observed and then the
-  containing object was deleted before the first time that the background
-  notifier could run.
-  ([Issue #6234](https://github.com/realm/realm-cocoa/issues/6234, since 3.0.0)).
-* Remove an incorrect assertion that would cause crashes inside
-  `TableInfoCache::get_table_info()`, with messages like "Assertion failed: info.object_id_index == 0 [3, 0]".
-  (Since 3.18.0, [#6268](https://github.com/realm/realm-cocoa/issues/6268) and [#6257](https://github.com/realm/realm-cocoa/issues/6257)).
-
-### Compatibility
-
-* File format: Generates Realms with format v9 (Reads and upgrades all previous formats)
-* Realm Object Server: 3.21.0 or later.
-* Carthage release for Swift is built with Xcode 11.0.
-
-### Internal
-
-* Upgrade to REALM_SYNC_VERSION=4.7.11
-
-3.19.0 Release notes (2019-09-27)
-=============================================================
-
-### Enhancements
-
-* Expose ObjectSchema.objectClass in Swift as looking up the class via
-  NSClassFromString() can be complicated for Swift types.
-  ([PR #6244](https://github.com/realm/realm-cocoa/pull/6244)).
-* Add support for suppressing notifications using closure-based write/transaction methods.
-  ([PR #6252](https://github.com/realm/realm-cocoa/pull/6252)).
-
-### Fixed
-
-* IN or chained OR equals queries on an unindexed string column would fail to
-  match some results if any of the strings were 64 bytes or longer.
-  ([Core #3386](https://github.com/realm/realm-core/pull/3386), since 3.14.2).
-* Query Based Sync subscriptions for queries involving a null timestamp were
-  not sent to the server correctly and would match no objects.
-  ([Core #3389](https://github.com/realm/realm-core/pull/3388), since 3.17.3).
-
-### Compatibility
-
-* File format: Generates Realms with format v9 (Reads and upgrades all previous formats)
-* Realm Object Server: 3.21.0 or later.
-* Carthage release for Swift is built with Xcode 11.0.
-
-### Internal
-
-* Upgrade to REALM_CORE_VERSION=5.23.5
-* Upgrade to REALM_SYNC_VERSION=4.7.8
-
-3.18.0 Release notes (2019-09-13)
-=============================================================
-
-The file format for synchronized Realms has changed. Old Realms will be
-automatically upgraded when they are opened. Once upgraded, the files will not
-be openable by older versions of Realm. The upgrade should not take a
-significant amount of time to run or run any risk of errors.
-
-This does not effect non-synchronized Realms.
-
-### Enhancements
-
-* Improve performance of queries on Date properties
-  ([Core #3344](https://github.com/realm/realm-core/pull/3344), [Core #3351](https://github.com/realm/realm-core/pull/3351)).
-* Syncronized Realms are now more aggressive about trimming local history that
-  is no longer needed. This should reduce file size growth in write-heavy
-  workloads. ([Sync #3007](https://github.com/realm/realm-sync/issues/3007)).
-* Add support for building Realm as an xcframework.
-  ([PR #6238](https://github.com/realm/realm-cocoa/pull/6238)).
-* Add prebuilt libraries for Xcode 11 to the release package.
-  ([PR #6248](https://github.com/realm/realm-cocoa/pull/6248)).
-* Add a prebuilt library for Catalyst/UIKit For Mac to the release package
-  ([PR #6248](https://github.com/realm/realm-cocoa/pull/6248)).
-
-### Fixed
-
-* If a signal interrupted a msync() call, Realm would throw an exception and
-  the write transaction would fail. This behavior has new been changed to retry
-  the system call instead. ([Core #3352](https://github.com/realm/realm-core/issues/3352))
-* Queries on the sum or average of an integer property would sometimes give
-  incorrect results. ([Core #3356](https://github.com/realm/realm-core/pull/3356)).
-* Opening query-based synchronized Realms with a small number of subscriptions
-  performed an unneccesary write transaction. ([ObjectStore #815](https://github.com/realm/realm-object-store/pull/815)).
-
-### Compatibility
-
-* File format: Generates Realms with format v9 (Reads and upgrades all previous formats)
-* Realm Object Server: 3.21.0 or later.
-* Carthage release for Swift is built with Xcode 11.0
-
-### Deprecations
-
-* `RLMIdentityProviderNickname` has been deprecated in favor of `RLMIdentityProviderUsernamePassword`.
-* `+[RLMIdentityProvider credentialsWithNickname]` has been deprecated in favor of `+[RLMIdentityProvider credentialsWithUsername]`.
-* `Sync.nickname(String, Bool)` has been deprecated in favor of `Sync.usernamePassword(String, String, Bool)`.
-
-3.17.3 Release notes (2019-07-24)
-=============================================================
-
-### Enhancements
-
-* Add Xcode 10.3 binaries to the release package. Remove the Xcode 9.2 and 9.3 binaries.
-
-### Compatibility
-
-* File format: Generates Realms with format v9 (Reads and upgrades all previous formats)
-* Realm Object Server: 3.21.0 or later.
-* Carthage release for Swift is built with Xcode 10.3.
-
-3.17.1 Release notes (2019-07-10)
-=============================================================
-
-### Enhancements
-
-* Add support for canceling asynchronous opens using a new AsyncOpenTask
-  returned from the asyncOpen() call. ([PR #6193](https://github.com/realm/realm-cocoa/pull/6193)).
-* Importing the Realm SPM package can now be done by pinning to a version
-  rather than a branch.
-
-### Fixed
-
-* Queries on a List/RLMArray which checked an indexed int property would
-  sometimes give incorrect results.
-  ([#6154](https://github.com/realm/realm-cocoa/issues/6154)), since v3.15.0)
-* Queries involving an indexed int property had a memory leak if run multiple
-  times. ([#6186](https://github.com/realm/realm-cocoa/issues/6186)), since v3.15.0)
-* Creating a subscription with `includeLinkingObjects:` performed unneccesary
-  comparisons, making it extremely slow when large numbers of objects were
-  involved. ([Core #3311](https://github.com/realm/realm-core/issues/3311), since v3.15.0)
-
-### Compatibility
-
-* File format: Generates Realms with format v9 (Reads and upgrades all previous formats)
-* Realm Object Server: 3.21.0 or later.
-* Carthage release for Swift is built with Xcode 10.2.1.
-
-3.17.0 Release notes (2019-06-28)
-=============================================================
-
-### Enhancements
-
-* Add support for including Realm via Swift Package Manager. This currently
-  requires depending on the branch "master" rather than pinning to a version
-  (i.e. `.package(url: "https://github.com/realm/realm-cocoa", .branch("master"))`).
-  ([#6187](https://github.com/realm/realm-cocoa/pull/6187)).
-* Add Codable conformance to RealmOptional and List, and Encodable conformance to Results.
-  ([PR #6172](https://github.com/realm/realm-cocoa/pull/6172)).
-
-### Fixed
-
-* Attempting to observe an unmanaged LinkingObjects object crashed rather than
-  throwing an approriate exception (since v0.100.0).
-* Opening an encrypted Realm could potentially report that a valid file was
-  corrupted if the system was low on free memory.
-  (since 3.14.0, [Core #3267](https://github.com/realm/realm-core/issues/3267))
-* Calling `Realm.asyncOpen()` on multiple Realms at once would sometimes crash
-  due to a `FileNotFound` exception being thrown on a background worker thread.
-  (since 3.16.0, [ObjectStore #806](https://github.com/realm/realm-object-store/pull/806)).
-
-### Compatibility
-
-* File format: Generates Realms with format v9 (Reads and upgrades all previous formats)
-* Realm Object Server: 3.21.0 or later.
-* Carthage release for Swift is built with Xcode 10.2.1.
-
-3.16.2 Release notes (2019-06-14)
-=============================================================
-
-### Enhancements
-
-* Add support for Xcode 11 Beta 1. Xcode betas are only supported when building
-  from source, and not when using a prebuilt framework.
-  ([PR #6164](https://github.com/realm/realm-cocoa/pull/6164)).
-
-### Fixed
-
-* Using asyncOpen on query-based Realms which didn't already exist on the local
-  device would fail with error 214.
-  ([#6178](https://github.com/realm/realm-cocoa/issues/6178), since 3.16.0).
-* asyncOpen on query-based Realms did not wait for the server-created
-  permission objects to be downloaded, resulting in crashes if modifications to
-  the permissions were made before creating a subscription for the first time (since 3.0.0).
-* EINTR was not handled correctly in the notification worker, which may have
-  resulted in inconsistent and rare assertion failures in
-  `ExternalCommitHelper::listen()` when building with assertions enabled.
-  (PR: [#804](https://github.com/realm/realm-object-store/pull/804), since 0.91.0).
-
-### Compatibility
-
-* File format: Generates Realms with format v9 (Reads and upgrades all previous formats)
-* Realm Object Server: 3.21.0 or later.
-* Carthage release for Swift is built with Xcode 10.2.1.
-
-3.16.1 Release notes (2019-05-31)
-=============================================================
-
-### Fixed
-
-* The static type passed at compile time to `realm.create()` was checked for a
-  primary key rather than the actual type passed at runtime, resulting in
-  exceptions like "''RealmSwiftObject' does not have a primary key and can not
-  be updated'" being thrown even if the object type being created has a primary
-  key. (since 3.16.0, [#6159](https://github.com/realm/realm-cocoa/issues/6159)).
-
-### Compatibility
-
-* File format: Generates Realms with format v9 (Reads and upgrades all previous formats)
-* Realm Object Server: 3.21.0 or later.
-* Carthage release for Swift is built with Xcode 10.2.1.
-
-3.16.0 Release notes (2019-05-29)
-=============================================================
-
-### Enhancements
-
-* Add an option to only set the properties which have values different from the
-  existing ones when updating an existing object with
-  `Realm.create()`/`-[RLMObject createOrUpdateInRealm:withValue:]`. This makes
-  notifications report only the properties which have actually changed, and
-  improves Object Server performance by reducing the number of operations to
-  merge. (Issue: [#5970](https://github.com/realm/realm-cocoa/issues/5970),
-  PR: [#6149](https://github.com/realm/realm-cocoa/pull/6149)).
-* Using `-[RLMRealm asyncOpenWithConfiguration:callbackQueue:]`/`Realm.asyncOpen()` to open a
-  synchronized Realm which does not exist on the local device now uses an
-  optimized transfer method to download the initial data for the Realm, greatly
-  speeding up the first start time for applications which use full
-  synchronization. This is currently not applicable to query-based
-  synchronization. (PR: [#6106](https://github.com/realm/realm-cocoa/pull/6106)).
-
-### Compatibility
-
-* File format: Generates Realms with format v9 (Reads and upgrades all previous formats)
-* Realm Object Server: 3.21.0 or later.
-* Carthage release for Swift is built with Xcode 10.2.1.
-
-3.15.0 Release notes (2019-05-06)
-=============================================================
-
-The minimum version of Realm Object Server has been increased to 3.21.0 and
-attempting to connect to older versions will produce protocol mismatch errors.
-Realm Cloud has already been upgraded to this version, and users using that do
-not need to worry about this.
-
-### Enhancements
-
-* Add `createdAt`, `updatedAt`, `expiresAt` and `timeToLive` properties to
-  `RLMSyncSubscription`/`SyncSubscription`. These properties will be `nil` for
-  subscriptions created with older versions of Realm, but will be automatically
-  populated for newly-created subscriptions.
-* Add support for transient subscriptions by setting the `timeToLive` when
-  creating the subscription. The next time a subscription is created or updated
-  after that time has elapsed the subscription will be automatically removed.
-* Add support for updating existing subscriptions with a new query or limit.
-  This is done by passing `update: true` (in swift) or setting
-  `options.overwriteExisting = YES` (in obj-c) when creating the subscription,
-  which will make it update the existing subscription with the same name rather
-  than failing if one already exists with that name.
-* Add an option to include the objects from
-  `RLMLinkingObjects`/`LinkingObjects` properties in sync subscriptions,
-  similarly to how `RLMArray`/`List` automatically pull in the contained
-  objects.
-* Improve query performance for chains of OR conditions (or an IN condition) on
-  an unindexed integer or string property.
-  ([Core PR #2888](https://github.com/realm/realm-core/pull/2888) and
-  [Core PR #3250](https://github.com/realm/realm-core/pull/3250)).
-* Improve query performance for equality conditions on indexed integer properties.
-  ([Core PR #3272](https://github.com/realm/realm-core/pull/3272)).
-* Adjust the file allocation algorithm to reduce fragmentation caused by large
-  numbers of small blocks.
-* Improve file allocator logic to reduce fragmentation and improve commit
-  performance after many writes. ([Core PR #3278](https://github.com/realm/realm-core/pull/3278)).
-
-### Fixed
-
-* Making a query that compares two integer properties could cause a
-  segmentation fault on x86 (i.e. macOS only).
-  ([Core PR #3253](https://github.com/realm/realm-core/pull/3256)).
-* The `downloadable_bytes` parameter passed to sync progress callbacks reported
-  a value which correlated to the amount of data left to download, but not
-  actually the number of bytes which would be downloaded.
-
-### Compatibility
-
-* File format: Generates Realms with format v9 (Reads and upgrades all previous formats)
-* Realm Object Server: 3.21.0 or later.
-* Carthage release for Swift is built with Xcode 10.2.1.
-
-3.14.2 Release notes (2019-04-25)
-=============================================================
-
-### Enhancements
-
-* Updating `RLMSyncManager.customRequestHeaders` will immediately update all
-  currently active sync session with the new headers rather than requiring
-  manually closing the Realm and reopening it.
-
-### Compatibility
-
-* File format: Generates Realms with format v9 (Reads and upgrades all previous formats)
-* Realm Object Server: 3.11.0 or later.
-* Carthage release for Swift is built with Xcode 10.2.1.
-
-3.14.1 Release notes (2019-04-04)
-=============================================================
-
-### Fixed
-
-* Fix "Cannot find interface declaration for 'RealmSwiftObject', superclass of
-  'MyRealmObjectClass'" errors when building for a simulator with Xcode 10.2
-  with "Install Objective-C Compatibility Header" enabled.
-
-### Compatibility
-
-* File format: Generates Realms with format v9 (Reads and upgrades all previous formats)
-* Realm Object Server: 3.11.0 or later.
-* Carthage release for Swift is built with Xcode 10.2.
-
-3.14.0 Release notes (2019-03-27)
-=============================================================
-
-### Enhancements
-
-* Reduce memory usage when committing write transactions.
-* Improve performance of compacting encrypted Realm files.
-  ([PR #3221](https://github.com/realm/realm-core/pull/3221)).
-* Add a Xcode 10.2 build to the release package.
-
-### Fixed
-
-* Fix a memory leak whenever Realm makes a HTTP(s) request to the Realm Object
-  Server (Issue [#6058](https://github.com/realm/realm-cocoa/issues/6058), since 3.8.0).
-* Fix an assertion failure when creating an object in a synchronized Realm
-  after creating an object with a null int primary key in the same write
-  transaction.
-  ([PR #3227](https://github.com/realm/realm-core/pull/3227)).
-* Fix some new warnings when building with Xcode 10.2 beta.
-* Properly clean up sync sessions when the last Realm object using the session
-  is deallocated while the session is explicitly suspended (since 3.9.0).
-
-### Compatibility
-
-* File format: Generates Realms with format v9 (Reads and upgrades all previous formats)
-* Realm Object Server: 3.11.0 or later.
-* Carthage release for Swift is built with Xcode 10.2.
-
-### Internal
-
-* Throw an exception rather than crashing with an assertion failure in more
-  cases when opening invalid Realm files.
-* Upgrade to REALM_CORE_VERSION=5.14.0
-* Upgrade to REALM_SYNC_VERSION=3.15.1
-
-3.13.1 Release notes (2019-01-03)
-=============================================================
-
-### Fixed
-
-* Fix a crash when iterating over `Realm.subscriptions()` using for-in.
-  (Since 3.13.0, PR [#6050](https://github.com/realm/realm-cocoa/pull/6050)).
-
-### Compatibility
-
-* File format: Generates Realms with format v9 (Reads and upgrades all previous formats)
-* Realm Object Server: 3.11.0 or later.
-
-3.13.0 Release notes (2018-12-14)
-=============================================================
-
-### Enhancements
-
-* Add `Realm.subscriptions()`/`-[RLMRealm subscriptions]` and
-  `Realm.subscription(named:)`/`-[RLMRealm subscriptionWithName:]` to enable
-  looking up existing query-based sync subscriptions.
-  (PR: https://github.com/realm/realm-cocoa/pull/6029).
-
-### Compatibility
-
-* File format: Generates Realms with format v9 (Reads and upgrades all previous formats)
-* Realm Object Server: 3.11.0 or later.
-
-3.12.0 Release notes (2018-11-26)
-=============================================================
-
-### Enhancements
-
-* Add a User-Agent header to HTTP requests made to the Realm Object Server. By
-  default, this contains information about the Realm library version and your
-  app's bundle ID. The application identifier can be customized by setting
-  `RLMSyncManager.sharedManager.userAgent`/`SyncManager.shared.userAgent` prior
-  to opening a synchronized Realm.
-  (PR: https://github.com/realm/realm-cocoa/pull/6007).
-* Add Xcode 10.1 binary to the prebuilt package.
-
-### Fixed
-
-* None.
-
-### Compatibility
-
-* File format: Generates Realms with format v9 (Reads and upgrades all previous formats)
-* Realm Object Server: 3.11.0 or later.
-
-### Internal
-
-* None.
-
-
-3.11.2 Release notes (2018-11-15)
-=============================================================
-
-### Enhancements
-
-* Improve the performance of the merge algorithm used for integrating remote
-  changes from the server. In particular, changesets involving many objects
-  which all link to a single object should be greatly improved.
-
-### Fixed
-
-* Fix a memory leak when removing notification blocks from collections.
-  PR: [#702](https://github.com/realm/realm-object-store/pull/702), since 1.1.0.
-* Fix re-sorting or distincting an already-sorted Results using values from
-  linked objects. Previously the unsorted order was used to read the values
-  from the linked objects.
-  PR [#3102](https://github.com/realm/realm-core/pull/3102), since 3.1.0.
-* Fix a set of bugs which could lead to bad changeset assertions when using
-  sync. The assertions would look something like the following:
-  `[realm-core-5.10.0] Assertion failed: ndx < size() with (ndx, size()) =  [742, 742]`.
-
-### Compatibility
-
-* File format: Generates Realms with format v9 (Reads and upgrades all previous formats)
-* Realm Object Server: 3.11.0 or later.
-
-### Internal
-
-* None.
-
-
-3.11.1 Release notes (2018-10-19)
-=============================================================
-
-### Enhancements
-
-* None.
-
-### Fixed
-
-* Fix `SyncUser.requestEmailConfirmation` not triggering the email confirmation
-  flow on ROS. (PR [#5953](https://github.com/realm/realm-cocoa/pull/5953), since 3.5.0)
-* Add some missing validation in the getters and setters of properties on
-  managed Realm objects, which would sometimes result in an application
-  crashing with a segfault rather than the appropriate exception being thrown
-  when trying to write to an object which has been deleted.
-  (PR [#5952](https://github.com/realm/realm-cocoa/pull/5952), since 2.8.0)
-
-### Compatibility
-
-* File format: Generates Realms with format v9 (Reads and upgrades all previous formats)
-* Realm Object Server: 3.11.0 or later.
-
-### Internal
-
-* None.
-
-
-3.11.0 Release notes (2018-10-04)
-=============================================================
-
-### Enhancements
-* Reduce memory usage when integrating synchronized changes sent by ROS.
-* Devices will now report download progress for read-only Realms, allowing the
-  server to compact Realms more aggressively and reducing the amount of
-  server-side storage space required.
-
-### Fixed
-* Fix a crash when adding an object with a non-`@objc` `String?` property which
-  has not been explicitly ignored to a Realm on watchOS 5 (and possibly other
-  platforms when building with Xcode 10).
-  (Issue: [5929](https://github.com/realm/realm-cocoa/issues/5929)).
-* Fix some merge algorithm bugs which could result in `BadChangesetError`
-  being thrown when integrating changes sent by the server.
-
-### Compatibility
-* File format: Generates Realms with format v9 (Reads and upgrades all previous formats)
-* **NOTE!!!
-  You will need to upgrade your Realm Object Server to at least version 3.11.0
-  or use [Realm Cloud](https://cloud.realm.io).
-  If you try to connect to a ROS v3.10.x or previous, you will see an error
-  like `Wrong protocol version in Sync HTTP request, client protocol version = 25,
-  server protocol version = 24`.**
-
-### Internal
-* Update to Sync 3.12.2.
-
-
-3.10.0 Release notes (2018-09-19)
-=============================================================
-
-Prebuilt binaries are now built for Xcode 9.2, 9.3, 9.4 and 10.0.
-
-Older versions of Xcode are still supported when building from source, but you
-should be migrating to at least Xcode 9.2 as soon as possible.
-
-### Enhancements
-
-* Add support for Watch Series 4 by adding an arm64_32 slice to the library.
-
-3.9.0 Release notes (2018-09-10)
-=============================================================
-
-### Enhancements
-
-* Expose RLMSyncUser.refreshToken publicly so that it can be used for custom
-  HTTP requests to Realm Object Server.
-* Add RLMSyncSession.connectionState, which reports whether the session is
-  currently connected to the Realm Object Server or if it is offline.
-* Add `-suspend` and `-resume` methods to `RLMSyncSession` to enable manually
-  pausing data synchronization.
-* Add support for limiting the number of objects matched by a query-based sync
-  subscription. This requires a server running ROS 3.10.1 or newer.
-
-### Bugfixes
-
-* Fix crash when getting the description of a `MigrationObject` which has
-  `List` properties.
-* Fix crash when calling `dynamicList()` on a `MigrationObject`.
-
-3.8.0 Release notes (2018-09-05)
-=============================================================
-
-### Enhancements
-
-* Remove some old and no longer applicable migration logic which created an
-  unencrypted file in the sync metadata directory containing a list of ROS URLs
-  connected to.
-* Add support for pinning SSL certificates used for https and realms
-  connections by setting `RLMSyncManager.sharedManager.pinnedCertificatePaths`
-  in obj-c and `SyncManager.shared.pinnedCertificatePaths` in Swift.
-
-### Bugfixes
-
-* Fix warnings when building Realm as a static framework with CocoaPods.
-
-3.7.6 Release notes (2018-08-08)
-=============================================================
-
-### Enhancements
-
-* Speed up the actual compaction when using compact-on-launch.
-* Reduce memory usage when locally merging changes from sync.
-* When first connecting to a server, wait to begin uploading changes until
-  after all changes have been downloaded to reduce the server-side load for
-  query-based sync.
-
-3.7.5 Release notes (2018-07-23)
-=============================================================
-
-### Enhancements
-
-* Improve performance of applying remote changesets from sync.
-* Improve performance of creating objects with string primary keys.
-* Improve performance of large write transactions.
-* Adjust file space allocation strategy to reduce fragmentation, producing
-  smaller Realm files and typically better performance.
-* Close network connections immediately when a sync session is destroyed.
-* Report more information in `InvalidDatabase` exceptions.
-
-### Bugfixes
-
-* Fix permission denied errors for RLMPlatform.h when building with CocoaPods
-  and Xcode 10 beta 3.
-* Fix a use-after-free when canceling a write transaction which could result in
-  incorrect "before" values in KVO observations (typically `nil` when a non-nil
-  value is expected).
-* Fix several bugs in the merge algorithm that could lead to memory corruption
-  and crashes with errors like "bad changeset" and "unreachable code".
-
-3.7.4 Release notes (2018-06-19)
-=============================================================
-
-### Bugfixes
-
-* Fix a bug which could potentially flood Realm Object Server with PING
-  messages after a client device comes back online.
-
-3.7.3 Release notes (2018-06-18)
-=============================================================
-
-### Enhancements
-
-* Avoid performing potentially large amounts of pointless background work for
-  LinkingObjects instances which are accessed and then not immediate deallocated.
-
-### Bugfixes
-
-* Fix crashes which could result from extremely fragmented Realm files.
-* Fix a bug that could result in a crash with the message "bad changeset error"
-  when merging changesets from the server.
-
-3.7.2 Release notes (2018-06-13)
-=============================================================
-
-### Enhancements
-
-* Add some additional consistency checks that will hopefully produce better
-  errors when the "prev_ref + prev_size <= ref" assertion failure occurs.
-
-### Bugfixes
-
-* Fix a problem in the changeset indexing algorithm that would sometimes
-  cause "bad permission object" and "bad changeset" errors.
-* Fix a large number of linking warnings about symbol visibility by aligning
-  compiler flags used.
-* Fix large increase in size of files produced by `Realm.writeCopy()` introduced in 3.6.0.
-
-3.7.1 Release notes (2018-06-07)
-=============================================================
-
-* Add support for compiling Realm Swift with Xcode 10 beta 1.
-
-3.7.0 Release notes (2018-06-06)
-=============================================================
-
-The feature known as Partial Sync has been renamed to Query-based
-Synchronization. This has impacted a number of API's. See below for the
-details.
-
-### Deprecations
-
-* `+[RLMSyncConfiguration initWithUser] has been deprecated in favor of `-[RLMSyncUser configurationWithURL:url].
-* `+[RLMSyncConfiguration automaticConfiguration] has been deprecated in favor of `-[RLMSyncUser configuration].
-* `+[RLMSyncConfiguration automaticConfigurationForUser] has been deprecated in favor of `-[RLMSyncUser configuration].
-* `-[RLMSyncConfiguration isPartial] has been deprecated in favor of `-[RLMSyncConfiguration fullSynchronization]`.
-
-### Enhancements
-
-* Add `-[RLMRealm syncSession]` and  `Realm.syncSession` to obtain the session used for a synchronized Realm.
-* Add `-[RLMSyncUser configuration]`. Query-based sync is the default sync mode for this configuration.
-* Add `-[RLMSyncUser configurationWithURL:url]`. Query-based sync is the default sync mode for this configuration.
-
-3.6.0 Release notes (2018-05-29)
-=============================================================
-
-### Enhancements
-
-* Improve performance of sync metadata operations and resolving thread-safe
-  references.
-* `shouldCompactOnLaunch` is now supported for compacting the local data of
-  synchronized Realms.
-
-### Bugfixes
-
-* Fix a potential deadlock when a sync session progress callback held the last
-  strong reference to the sync session.
-* Fix some cases where comparisons to `nil` in queries were not properly
-  serialized when subscribing to a query.
-* Don't delete objects added during a migration after a call to `-[RLMMigration
-  deleteDataForClassName:]`.
-* Fix incorrect results and/or crashes when multiple `-[RLMMigration
-  enumerateObjects:block:]` blocks deleted objects of the same type.
-* Fix some edge-cases where `-[RLMMigration enumerateObjects:block:]`
-  enumerated the incorrect objects following deletions.
-* Restore the pre-3.5.0 behavior for Swift optional properties missing an ivar
-  rather than crashing.
-
-3.5.0 Release notes (2018-04-25)
-=============================================================
-
-### Enhancements
-
-* Add wrapper functions for email confirmation and password reset to `SyncUser`.
-
-### Bugfixes
-
-* Fix incorrect results when using optional chaining to access a RealmOptional
-  property in Release builds, or otherwise interacting with a RealmOptional
-  object after the owning Object has been deallocated.
-
-3.4.0 Release notes (2018-04-19)
-=============================================================
-
-The prebuilt binary for Carthage is now built for Swift 4.1.
-
-### Enhancements
-
-* Expose `RLMSyncManager.authorizationHeaderName`/`SyncManager.authorizationHeaderName`
-  as a way to override the transport header for Realm Object Server authorization.
-* Expose `RLMSyncManager.customRequestHeaders`/`SyncManager.customRequestHeaders`
-  which allows custom HTTP headers to be appended on requests to the Realm Object Server.
-* Expose `RLMSSyncConfiguration.urlPrefix`/`SyncConfiguration.urlPrefix` as a mechanism
-  to replace the default path prefix in Realm Sync WebSocket requests.
-
-3.3.2 Release notes (2018-04-03)
-=============================================================
-
-Add a prebuilt binary for Xcode 9.3.
-
-3.3.1 Release notes (2018-03-28)
-=============================================================
-
-Realm Object Server v3.0.0 or newer is required when using synchronized Realms.
-
-### Enhancements
-
-* Expose `RLMObject.object(forPrimaryKey:)` as a factory method for Swift so
-  that it is callable with recent versions of Swift.
-
-### Bugfixes
-
-* Exclude the RLMObject-derived Permissions classes from the types repored by
-  `Realm.Configuration.defaultConfiguration.objectTypes` to avoid a failed
-  cast.
-* Cancel pending `Realm.asyncOpen()` calls when authentication fails with a
-  non-transient error such as missing the Realm path in the URL.
-* Fix "fcntl() inside prealloc()" errors on APFS.
-
-3.3.0 Release notes (2018-03-19)
-=============================================================
-
-Realm Object Server v3.0.0 or newer is required when using synchronized Realms.
-
-### Enhancements
-
-* Add `Realm.permissions`, `Realm.permissions(forType:)`, and `Realm.permissions(forClassNamed:)` as convenience
-  methods for accessing the permissions of the Realm or a type.
-
-### Bugfixes
-
-* Fix `+[RLMClassPermission objectInRealm:forClass:]` to work for classes that are part of the permissions API,
-  such as `RLMPermissionRole`.
-* Fix runtime errors when applications define an `Object` subclass with the
-  same name as one of the Permissions object types.
-
-3.2.0 Release notes (2018-03-15)
-=============================================================
-
-Realm Object Server v3.0.0 or newer is required when using synchronized Realms.
-
-### Enhancements
-
-* Added an improved API for adding subscriptions in partially-synchronized Realms. `Results.subscribe()` can be
-  used to subscribe to any result set, and the returned `SyncSubscription` object can be used to observe the state
-  of the subscription and ultimately to remove the subscription. See the documentation for more information
-  (<https://docs.realm.io/platform/v/3.x/using-synced-realms/syncing-data>).
-* Added a fine-grained permissions system for use with partially-synchronized Realms. This allows permissions to be
-  defined at the level of individual objects or classes. See the documentation for more information
-  (<https://docs.realm.io/platform/v/3.x/using-synced-realms/access-control>).
-* Added `SyncConfiguration.automatic()` and `SyncConfiguration.automatic(user:)`.
-  These methods return a `Realm.Configuration` appropriate for syncing with the default
-  synced Realm for the current (or specified) user. These should be considered the preferred methods
-  for accessing synced Realms going forwards.
-* Added `+[RLMSyncSession sessionForRealm:]` to retrieve the sync session corresponding to a `RLMRealm`.
-
-### Bugfixes
-
-* Fix incorrect initalization of `RLMSyncManager` that made it impossible to
-  set `errorHandler`.
-* Fix compiler warnings when building with Xcode 9.3.
-* Fix some warnings when running with UBsan.
-
-3.2.0-rc.1 Release notes (2018-03-14)
-=============================================================
-
-Realm Object Server v3.0.0-rc.1 or newer is required when using synchronized Realms.
-
-### Enhancements
-
-* Added `SyncConfiguration.automatic()` and `SyncConfiguration.automatic(user:)`.
-  These methods return a `Realm.Configuration` appropriate for syncing with the default
-  synced Realm for the current (or specified). These should be considered the preferred methods
-  for accessing synced Realms going forwards.
-* A role is now automatically created for each user with that user as its only member.
-  This simplifies the common use case of restricting access to specific objects to a single user.
-  This role can be accessed at `PermissionUser.role`.
-* Improved error reporting when the server rejects a schema change due to a lack of permissions.
-
-### Bugfixes
-
-* Fix incorrect initalization of `RLMSyncManager` that made it impossible to
-  set `errorHandler`.
-* Fix compiler warnings when building with Xcode 9.3.
-
-3.2.0-beta.3 Release notes (2018-03-01)
-=============================================================
-
-Realm Object Server v3.0.0-alpha.9 or newer is required when using synchronized Realms.
-
-### Bugfixes
-
-* Fix a crash that would occur when using partial sync with Realm Object Server v3.0.0-alpha.9.
-
-3.2.0-beta.2 Release notes (2018-02-28)
-=============================================================
-
-Realm Object Server v3.0.0-alpha.8 or newer is required when using synchronized Realms.
-
-### Enhancements
-
-* Added `findOrCreate(forRoleNamed:)` and `findOrCreate(forRole:)` to `List<Permission>`
-  to simplify the process of adding permissions for a role.
-* Added `+permissionForRoleNamed:inArray:`, `+permissionForRoleNamed:onRealm:`,
-  `+permissionForRoleNamed:onClass:realm:`, `+permissionForRoleNamed:onClassNamed:realm:`,
-  and `+permissionForRoleNamed:onObject:` to `RLMSyncPermission` to simplify the process
-  of adding permissions for a role.
-* Added `+[RLMSyncSession sessionForRealm:]` to retrieve the sync session corresponding to a `RLMRealm`.
-
-### Bugfixes
-
-* `PermissionRole.users` and `PermissionUser.roles` are now public as intended.
-* Fixed the handling of `setPermissions` in `-[RLMRealm privilegesForRealm]` and related methods.
-
-3.2.0-beta.1 Release notes (2018-02-19)
-=============================================================
-
-### Enhancements
-
-* Added an improved API for adding subscriptions in partially-synchronized Realms. `Results.subscribe()` can be
-  used to subscribe to any result set, and the returned `SyncSubscription` object can be used to observe the state
-  of the subscription and ultimately to remove the subscription.
-* Added a fine-grained permissions system for use with partially-synchronized Realms. This allows permissions to be
-  defined at the level of individual objects or classes. See `Permission` and related types for more information.
-
-### Bugfixes
-
-* Fix some warnings when running with UBsan.
-
-3.1.1 Release notes (2018-02-03)
-=============================================================
-
-Prebuilt Swift frameworks for Carthage are now built with Xcode 9.2.
-
-### Bugfixes
-
-* Fix a memory leak when opening Realms with an explicit `objectTypes` array
-  from Swift.
-
-3.1.0 Release notes (2018-01-16)
-=============================================================
-
-* Prebuilt frameworks are now included for Swift 3.2.3 and 4.0.3.
-* Prebuilt frameworks are no longer included for Swift 3.0.x.
-* Building from source with Xcode versions prior to Xcode 8.3 is no longer supported.
-
-### Enhancements
-
-* Add `Results.distinct(by:)` / `-[RLMResults distinctResultsUsingKeyPaths:]`, which return a `Results`
-  containing only objects with unique values at the given key paths.
-* Improve performance of change checking for notifications in certain cases.
-* Realm Object Server errors not explicitly recognized by the client are now reported to the application
-  regardless.
-* Add support for JSON Web Token as a sync credential source.
-* Add support for Nickname and Anonymous Auth as a sync credential source.
-* Improve allocator performance when writing to a highly fragmented file. This
-  should significantly improve performance when inserting large numbers of
-  objects which have indexed properties.
-* Improve write performance for complex object graphs involving many classes
-  linking to each other.
-
-### Bugfixes
-
-* Add a missing check for a run loop in the permission API methods which
-  require one.
-* Fix some cases where non-fatal sync errors were being treated as fatal errors.
-
-3.0.2 Release notes (2017-11-08)
-=============================================================
-
-Prebuilt frameworks are now included for Swift 3.2.2 and 4.0.2.
-
-### Bugfixes
-
-* Fix a crash when a linking objects property is retrieved from a model object instance via
-  Swift subscripting.
-* Fix incorrect behavior if a call to `posix_fallocate` is interrupted.
-
-3.0.1 Release notes (2017-10-26)
-=============================================================
-
-### Bugfixes
-
-* Explicitly exclude KVO-generated object subclasses from the schema.
-* Fix regression where the type of a Realm model class is not properly determined, causing crashes
-  when a type value derived at runtime by `type(of:)` is passed into certain APIs.
-* Fix a crash when an `Object` subclass has implicitly ignored `let`
-  properties.
-* Fix several cases where adding a notification block from within a
-  notification callback could produce incorrect results.
-
-3.0.0 Release notes (2017-10-16)
-=============================================================
-
-### Breaking Changes
-* iOS 7 is no longer supported.
-* Synchronized Realms require a server running Realm Object Server v2.0 or higher.
-* Computed properties on Realm object types are detected and no
-  longer added to the automatically generated schema.
-* The Objective-C and Swift `create(_:, value: update:)` APIs now
-  correctly nil out nullable properties when updating an existing
-  object when the `value` argument specifies nil or `NSNull` for
-  the property value.
-* `-[RLMRealm addOrUpdateObjects:]` and `-[RLMRealm deleteObjects:]` now
-  require their argument to conform to `NSFastEnumeration`, to match similar
-  APIs that also take collections.
-* The way interactive sync errors (client reset and permission denied)
-  are delivered to the user has been changed. Instead of a block which can
-  be invoked to immediately delete the offending Realm file, an opaque
-  token object of type `RLMSyncErrorActionToken` will be returned in the
-  error object's `userInfo` dictionary. This error object can be passed
-  into the new `+[RLMSyncSession immediatelyHandleError:]` API to delete
-  the files.
-* The return types of the `SyncError.clientResetInfo()` and
-  `SyncError.deleteRealmUserInfo()` APIs have been changed. They now return
-  `RLMSyncErrorActionToken`s or `SyncError.ActionToken`s instead of closures.
-* The class methods `Object.className()`, `Object.objectUtilClass()`, and
-  the property `Object.isInvalidated` can no longer be overriden.
-* The callback which runs when a sync user login succeeds or fails
-  now runs on the main queue by default, or can be explicitly specified
-  by a new `callbackQueue` parameter on the `{RLM}SyncUser.logIn(...)` API.
-* Fix empty strings, binary data, and null on the right side of `BEGINSWITH`,
-  `ENDSWITH` and `CONTAINS` operators in predicates to match Foundation's
-  semantics of never matching any strings or data.
-* Swift `Object` comparison and hashing behavior now works the same way as
-  that of `RLMObject` (objects are now only considered equatable if their
-  model class defines a primary key).
-* Fix the way the hash property works on `Object` when the object model has
-  no primary key.
-* Fix an issue where if a Swift model class defined non-generic managed
-  properties after generic Realm properties (like `List<T>`), the schema
-  would be constructed incorrectly. Fixes an issue where creating such
-  models from an array could fail.
-* Loosen `RLMArray` and `RLMResults`'s generic constraint from `RLMObject` to
-  `NSObject`. This may result in having to add some casts to disambiguate
-  types.
-* Remove `RLMSyncPermissionResults`. `RLMSyncPermission`s are now vended out
-  using a `RLMResults`. This results collection supports all normal collection
-  operations except for setting values using key-value coding (since
-  `RLMSyncPermission`s are immutable) and the property aggregation operations.
-* `RLMSyncUserInfo` has been significantly enhanced. It now contains metadata
-  about a user stored on the Realm Object Server, as well as a list of all user account
-  data associated with that user.
-* Starting with Swift 4, `List` now conforms to `MutableCollection` instead of
-  `RangeReplaceableCollection`. For Swift 4, the empty collection initializer has been
-  removed, and default implementations of range replaceable collection methods that
-  make sense for `List` have been added.
-* `List.removeLast()` now throws an exception if the list is empty, to more closely match
-  the behavior of the standard library's `Collection.removeLast()` implementation.
-* `RealmCollection`'s associated type `Element` has been renamed `ElementType`.
-* The following APIs have been renamed:
-
-| Old API                                                     | New API                                                        |
-|:------------------------------------------------------------|:---------------------------------------------------------------|
-| `NotificationToken.stop()`                                  | `NotificationToken.invalidate()`                               |
-| `-[RLMNotificationToken stop]`                              | `-[RLMNotificationToken invalidate]`                           |
-| `RealmCollection.addNotificationBlock(_:)`                  | `RealmCollection.observe(_:)`                                  |
-| `RLMSyncProgress`                                           | `RLMSyncProgressMode`                                          |
-| `List.remove(objectAtIndex:)`                               | `List.remove(at:)`                                             |
-| `List.swap(_:_:)`                                           | `List.swapAt(_:_:)`                                            |
-| `SyncPermissionValue`                                       | `SyncPermission`                                               |
-| `RLMSyncPermissionValue`                                    | `RLMSyncPermission`                                            |
-| `-[RLMSyncPermission initWithRealmPath:userID:accessLevel]` | `-[RLMSyncPermission initWithRealmPath:identity:accessLevel:]` |
-| `RLMSyncPermission.userId`                                  | `RLMSyncPermission.identity`                                   |
-| `-[RLMRealm addOrUpdateObjectsInArray:]`                    | `-[RLMRealm addOrUpdateObjects:]`                              |
-
-* The following APIs have been removed:
-
-| Removed API                                                  | Replacement                                                                               |
-|:-------------------------------------------------------------|:------------------------------------------------------------------------------------------|
-| `Object.className`                                           | None, was erroneously present.                                                            |
-| `RLMPropertyTypeArray`                                       | `RLMProperty.array`                                                                       |
-| `PropertyType.array`                                         | `Property.array`                                                                          |
-| `-[RLMArray sortedResultsUsingProperty:ascending:]`          | `-[RLMArray sortedResultsUsingKeyPath:ascending:]`                                        |
-| `-[RLMCollection sortedResultsUsingProperty:ascending:]`     | `-[RLMCollection sortedResultsUsingKeyPath:ascending:]`                                   |
-| `-[RLMResults sortedResultsUsingProperty:ascending:]`        | `-[RLMResults sortedResultsUsingKeyPath:ascending:]`                                      |
-| `+[RLMSortDescriptor sortDescriptorWithProperty:ascending:]` | `+[RLMSortDescriptor sortDescriptorWithKeyPath:ascending:]`                               |
-| `RLMSortDescriptor.property`                                 | `RLMSortDescriptor.keyPath`                                                               |
-| `AnyRealmCollection.sorted(byProperty:ascending:)`           | `AnyRealmCollection.sorted(byKeyPath:ascending:)`                                         |
-| `List.sorted(byProperty:ascending:)`                         | `List.sorted(byKeyPath:ascending:)`                                                       |
-| `LinkingObjects.sorted(byProperty:ascending:)`               | `LinkingObjects.sorted(byKeyPath:ascending:)`                                             |
-| `Results.sorted(byProperty:ascending:)`                      | `Results.sorted(byKeyPath:ascending:)`                                                    |
-| `SortDescriptor.init(property:ascending:)`                   | `SortDescriptor.init(keyPath:ascending:)`                                                 |
-| `SortDescriptor.property`                                    | `SortDescriptor.keyPath`                                                                  |
-| `+[RLMRealm migrateRealm:configuration:]`                    | `+[RLMRealm performMigrationForConfiguration:error:]`                                     |
-| `RLMSyncManager.disableSSLValidation`                        | `RLMSyncConfiguration.enableSSLValidation`                                                |
-| `SyncManager.disableSSLValidation`                           | `SyncConfiguration.enableSSLValidation`                                                   |
-| `RLMSyncErrorBadResponse`                                    | `RLMSyncAuthErrorBadResponse`                                                             |
-| `RLMSyncPermissionResults`                                   | `RLMResults`                                                                              |
-| `SyncPermissionResults`                                      | `Results`                                                                                 |
-| `RLMSyncPermissionChange`                                    | `-[RLMSyncUser applyPermission:callback]` / `-[RLMSyncUser deletePermission:callback:]`   |
-| `-[RLMSyncUser permissionRealmWithError:]`                   | `-[RLMSyncUser retrievePermissionsWithCallback:]`                                         |
-| `RLMSyncPermissionOffer`                                     | `-[RLMSyncUser createOfferForRealmAtURL:accessLevel:expiration:callback:]`                |
-| `RLMSyncPermissionOfferResponse`                             | `-[RLMSyncUser acceptOfferForToken:callback:]`                                            |
-| `-[NSError rlmSync_clientResetBlock]`                        | `-[NSError rlmSync_errorActionToken]` / `-[NSError rlmSync_clientResetBackedUpRealmPath]` |
-| `-[NSError rlmSync_deleteRealmBlock]`                        | `-[NSError rlmSync_errorActionToken]`                                                     |
-
-### Enhancements
-* `List` can now contain values of types `Bool`, `Int`, `Int8`, `Int16`,
-  `Int32`, `Int64`, `Float`, `Double`, `String`, `Data`, and `Date` (and
-  optional versions of all of these) in addition to `Object` subclasses.
-  Querying `List`s containing values other than `Object` subclasses is not yet
-  implemented.
-* `RLMArray` can now be constrained with the protocols `RLMBool`, `RLMInt`,
-  `RLMFloat`, `RLMDouble`, `RLMString`, `RLMData`, and `RLMDate` in addition to
-  protocols defined with `RLM_ARRAY_TYPE`. By default `RLMArray`s of
-  non-`RLMObject` types can contain null. Indicating that the property is
-  required (by overriding `+requiredProperties:`) will instead make the values
-  within the array required. Querying `RLMArray`s containing values other than
-  `RLMObject` subclasses is not yet implemented.
-* Add a new error code to denote 'permission denied' errors when working
-  with synchronized Realms, as well as an accompanying block that can be
-  called to inform the binding that the offending Realm's files should be
-  deleted immediately. This allows recovering from 'permission denied'
-  errors in a more robust manner. See the documentation for
-  `RLMSyncErrorPermissionDeniedError` for more information.
-* Add Swift `Object.isSameObject(as:_)` API to perform the same function as
-  the existing Objective-C API `-[RLMObject isEqualToObject:]`.
-* Opening a synced Realm whose local copy was created with an older version of
-  Realm Mobile Platfrom when a migration is not possible to the current version
-  will result in an `RLMErrorIncompatibleSyncedFile` / `incompatibleSyncedFile`
-  error. When such an error occurs, the original file is moved to a backup
-  location, and future attempts to open the synchronized Realm will result in a new
-  file being created. If you wish to migrate any data from the backup Realm you can
-  open it using the backup Realm configuration available on the error object.
-* Add a preview of partial synchronization. Partial synchronization allows a
-  synchronized Realm to be opened in such a way that only objects requested by
-  the user are synchronized to the device. You can use it by setting the
-  `isPartial` property on a `SyncConfiguration`, opening the Realm, and then
-  calling `Realm.subscribe(to:where:callback:)` with the type of object you're
-  interested in, a string containing a query determining which objects you want
-  to subscribe to, and a callback which will report the results. You may add as
-  many subscriptions to a synced Realm as necessary.
-
-### Bugfixes
-* Realm no longer throws an "unsupported instruction" exception in some cases
-  when opening a synced Realm asynchronously.
-* Realm Swift APIs that filter or look up the index of an object based on a
-  format string now properly handle optional arguments in their variadic argument
-  list.
-* `-[RLMResults<RLMSyncPermission *> indexOfObject:]` now properly accounts for access
-  level.
-* Fix a race condition that could lead to a crash accessing to the freed configuration object
-  if a default configuration was set from a different thread.
-* Fixed an issue that crash when enumerating after clearing data during migration.
-* Fix a bug where a synced Realm couldn't be reopened even after a successful client reset
-  in some cases.
-* Fix a bug where the sync subsystem waited too long in certain cases to reconnect to the server.
-* Fix a bug where encrypted sync-related metadata was incorrectly deleted from upgrading users,
-  resulting in all users being logged out.
-* Fix a bug where permission-related data continued to be synced to a client even after the user
-  that data belonged to logged out.
-* Fix an issue where collection notifications might be delivered inconsistently if a notification
-  callback was added within another callback for the same collection.
-
-3.0.0-rc.2 Release notes (2017-10-14)
-=============================================================
-
-### Enhancements
-* Reinstate `RLMSyncPermissionSortPropertyUserID` to allow users to sort permissions
-  to their own Realms they've granted to others.
-
-### Bugfixes
-* `-[RLMResults<RLMSyncPermission *> indexOfObject:]` now properly accounts for access
-  level.
-* Fix a race condition that could lead to a crash accessing to the freed configuration object
-  if a default configuration was set from a different thread.
-* Fixed an issue that crash when enumerating after clearing data during migration.
-* Fix a bug where a synced Realm couldn't be reopened even after a successful client reset
-  in some cases.
-* Fix a bug where the sync subsystem waited too long in certain cases to reconnect to the server.
-* Fix a bug where encrypted sync-related metadata was incorrectly deleted from upgrading users,
-  resulting in all users being logged out.
-* Fix a bug where permission-related data continued to be synced to a client even after the user
-  that data belonged to logged out.
-* Fix an issue where collection notifications might be delivered inconsistently if a notification
-  callback was added within another callback for the same collection.
-
-3.0.0-rc.1 Release notes (2017-10-03)
-=============================================================
-
-### Breaking Changes
-* Remove `RLMSyncPermissionSortPropertyUserID` to reflect changes in how the
-  Realm Object Server reports permissions for a user.
-* Remove `RLMSyncPermissionOffer` and `RLMSyncPermissionOfferResponse` classes
-  and associated helper methods and functions. Use the
-  `-[RLMSyncUser createOfferForRealmAtURL:accessLevel:expiration:callback:]`
-  and `-[RLMSyncUser acceptOfferForToken:callback:]` methods instead.
-
-### Bugfixes
-
-* The keychain item name used by Realm to manage the encryption keys for
-  sync-related metadata is now set to a per-app name based on the bundle
-  identifier. Keys that were previously stored within the single, shared Realm
-  keychain item will be transparently migrated to the per-application keychain
-  item.
-* Fix downloading of the Realm core binaries when Xcode's command-line tools are
-  set as the active developer directory for command-line interactions.
-* Fix a crash that could occur when resolving a ThreadSafeReference to a `List`
-  whose parent object had since been deleted.
-
-3.0.0-beta.4 Release notes (2017-09-22)
-=============================================================
-
-### Breaking Changes
-
-* Rename `List.remove(objectAtIndex:)` to `List.remove(at:)` to match the name
-  used by 'RangeReplaceableCollection'.
-* Rename `List.swap()` to `List.swapAt()` to match the name used by 'Array'.
-* Loosen `RLMArray` and `RLMResults`'s generic constraint from `RLMObject` to
-  `NSObject`. This may result in having to add some casts to disambiguate
-  types.
-* Remove `RLMPropertyTypeArray` in favor of a separate bool `array` property on
-  `RLMProperty`/`Property`.
-* Remove `RLMSyncPermissionResults`. `RLMSyncPermission`s are now vended out
-  using a `RLMResults`. This results collection supports all normal collection
-  operations except for setting values using KVO (since `RLMSyncPermission`s are
-  immutable) and the property aggregation operations.
-* `RealmCollection`'s associated type `Element` has been renamed `ElementType`.
-* Realm Swift collection types (`List`, `Results`, `AnyRealmCollection`, and
-  `LinkingObjects` have had their generic type parameter changed from `T` to
-  `Element`).
-* `RealmOptional`'s generic type parameter has been changed from `T` to `Value`.
-* `RLMSyncUserInfo` has been significantly enhanced. It now contains metadata
-  about a user stored on the Realm Object Server, as well as a list of all user account
-  data associated with that user.
-* Starting with Swift 4, `List` now conforms to `MutableCollection` instead of
-  `RangeReplaceableCollection`. For Swift 4, the empty collection initializer has been
-  removed, and default implementations of range replaceable collection methods that
-  make sense for `List` have been added.
-* `List.removeLast()` now throws an exception if the list is empty, to more closely match
-  the behavior of the standard library's `Collection.removeLast()` implementation.
-
-### Enhancements
-
-* `List` can now contain values of types `Bool`, `Int`, `Int8`, `Int16`,
-  `Int32`, `Int64`, `Float`, `Double`, `String`, `Data`, and `Date` (and
-  optional versions of all of these) in addition to `Object` subclasses.
-  Querying `List`s containing values other than `Object` subclasses is not yet
-  implemented.
-* `RLMArray` can now be constrained with the protocols `RLMBool`, `RLMInt`,
-  `RLMFloat`, `RLMDouble`, `RLMString`, `RLMData`, and `RLMDate` in addition to
-  protocols defined with `RLM_ARRAY_TYPE`. By default `RLMArray`s of
-  non-`RLMObject` types can contain null. Indicating that the property is
-  required (by overriding `+requiredProperties:`) will instead make the values
-  within the array required. Querying `RLMArray`s containing values other than
-  `RLMObject` subclasses is not yet implemented.
-* Opening a synced Realm whose local copy was created with an older version of
-  Realm Mobile Platfrom when a migration is not possible to the current version
-  will result in an `RLMErrorIncompatibleSyncedFile` / `incompatibleSyncedFile`
-  error. When such an error occurs, the original file is moved to a backup
-  location, and future attempts to open the synchronized Realm will result in a new
-  file being created. If you wish to migrate any data from the backup Realm you can
-  open it using the backup Realm configuration available on the error object.
-* Add preview support for partial synchronization. Partial synchronization is
-  allows a synchronized Realm to be opened in such a way that only objects
-  requested by the user are synchronized to the device. You can use it by setting
-  the `isPartial` property on a `SyncConfiguration`, opening the Realm, and then
-  calling `Realm.subscribe(to:where:callback:)` with the type of object you're
-  interested in, a string containing a query determining which objects you want
-  to subscribe to, and a callback which will report the results. You may add as
-  many subscriptions to a synced Realm as necessary.
-
-### Bugfixes
-
-* Realm Swift APIs that filter or look up the index of an object based on a
-  format string now properly handle optional arguments in their variadic argument
-  list.
-
-3.0.0-beta.3 Release notes (2017-08-23)
-=============================================================
-
-### Breaking Changes
-
-* iOS 7 is no longer supported.
-* Computed properties on Realm object types are detected and no
-  longer added to the automatically generated schema.
-* `-[RLMRealm addOrUpdateObjectsInArray:]` has been renamed to
-  `-[RLMRealm addOrUpdateObjects:]` for consistency with similar methods
-  that add or delete objects.
-* `-[RLMRealm addOrUpdateObjects:]` and `-[RLMRealm deleteObjects:]` now
-  require their argument to conform to `NSFastEnumeration`, to match similar
-  APIs that also take collections.
-* Remove deprecated `{RLM}SyncPermission` and `{RLM}SyncPermissionChange`
-  classes.
-* `{RLM}SyncPermissionValue` has been renamed to just `{RLM}SyncPermission`.
-  Its `userId` property has been renamed `identity`, and its
-  `-initWithRealmPath:userID:accessLevel:` initializer has been renamed
-  `-initWithRealmPath:identity:accessLevel:`.
-* Remove deprecated `-[RLMSyncUser permissionRealmWithError:]` and
-  `SyncUser.permissionRealm()` APIs. Use the new permissions system.
-* Remove deprecated error `RLMSyncErrorBadResponse`. Use
-  `RLMSyncAuthErrorBadResponse` instead.
-* The way interactive sync errors (client reset and permission denied)
-  are delivered to the user has been changed. Instead of a block which can
-  be invoked to immediately delete the offending Realm file, an opaque
-  token object of type `RLMSyncErrorActionToken` will be returned in the
-  error object's `userInfo` dictionary. This error object can be passed
-  into the new `+[RLMSyncSession immediatelyHandleError:]` API to delete
-  the files.
-* Remove `-[NSError rlmSync_clientResetBlock]` and
-  `-[NSError rlmSync_deleteRealmBlock]` APIs.
-* The return types of the `SyncError.clientResetInfo()` and
-  `SyncError.deleteRealmUserInfo()` APIs have been changed. They now return
-  `RLMSyncErrorActionToken`s or `SyncError.ActionToken`s instead of closures.
-* The (erroneously added) instance property `Object.className` has been
-  removed.
-* The class methods `Object.className()`, `Object.objectUtilClass()`, and
-  the property `Object.isInvalidated` can no longer be overriden.
-* The callback which runs when a sync user login succeeds or fails
-  now runs on the main queue by default, or can be explicitly specified
-  by a new `callbackQueue` parameter on the `{RLM}SyncUser.logIn(...)` API.
-* Rename `{RLM}NotificationToken.stop()` to `invalidate()` and
-  `{RealmCollection,SyncPermissionResults}.addNotificationBlock(_:)` to
-  `observe(_:)` to mirror Foundation's new KVO APIs.
-* The `RLMSyncProgress` enum has been renamed `RLMSyncProgressMode`.
-* Remove deprecated `{RLM}SyncManager.disableSSLValidation` property. Disable
-  SSL validation on a per-Realm basis by setting the `enableSSLValidation`
-  property on `{RLM}SyncConfiguration` instead.
-* Fix empty strings, binary data, and null on the right side of `BEGINSWITH`,
-  `ENDSWITH` and `CONTAINS` operators in predicates to match Foundation's
-  semantics of never matching any strings or data.
-* Swift `Object` comparison and hashing behavior now works the same way as
-  that of `RLMObject` (objects are now only considered equatable if their
-  model class defines a primary key).
-* Fix the way the hash property works on `Object` when the object model has
-  no primary key.
-* Fix an issue where if a Swift model class defined non-generic managed
-  properties after generic Realm properties (like `List<T>`), the schema
-  would be constructed incorrectly. Fixes an issue where creating such
-  models from an array could fail.
-
-### Enhancements
-
-* Add Swift `Object.isSameObject(as:_)` API to perform the same function as
-  the existing Objective-C API `-[RLMObject isEqualToObject:]`.
-* Expose additional authentication-related errors that might be reported by
-  a Realm Object Server.
-* An error handler can now be registered on `{RLM}SyncUser`s in order to
-  report authentication-related errors that affect the user.
-
-### Bugfixes
-
-* Sync users are now automatically logged out upon receiving certain types
-  of errors that indicate they are no longer logged into the server. For
-  example, users who are authenticated using third-party credentials will find
-  themselves logged out of the Realm Object Server if the third-party identity
-  service indicates that their credential is no longer valid.
-* Address high CPU usage and hangs in certain cases when processing collection
-  notifications in highly-connected object graphs.
-
-3.0.0-beta.2 Release notes (2017-07-26)
-=============================================================
-
-### Breaking Changes
-
-* Remove the following deprecated Objective-C APIs:
-  `-[RLMArray sortedResultsUsingProperty:ascending:]`,
-  `-[RLMCollection sortedResultsUsingProperty:ascending:]`,
-  `-[RLMResults sortedResultsUsingProperty:ascending:]`,
-  `+[RLMSortDescriptor sortDescriptorWithProperty:ascending:]`,
-  `RLMSortDescriptor.property`.
-  These APIs have been superseded by equivalent APIs that take
-  or return key paths instead of property names.
-* Remove the following deprecated Objective-C API:
-  `+[RLMRealm migrateRealm:configuration:]`.
-  Please use `+[RLMRealm performMigrationForConfiguration:error:]` instead.
-* Remove the following deprecated Swift APIs:
-  `AnyRealmCollection.sorted(byProperty:, ascending:)`,
-  `LinkingObjects.sorted(byProperty:, ascending:)`,
-  `List.sorted(byProperty:, ascending:)`,
-  `Results.sorted(byProperty:, ascending:)`,
-  `SortDescriptor.init(property:, ascending:)`,
-  `SortDescriptor.property`.
-  These APIs have been superseded by equivalent APIs that take
-  or return key paths instead of property names.
-* The Objective-C and Swift `create(_:, value: update:)` APIs now
-  correctly nil out nullable properties when updating an existing
-  object when the `value` argument specifies nil or `NSNull` for
-  the property value.
-
-### Enhancements
-
-* It is now possible to create and log in multiple Realm Object Server users
-  with the same identity if they originate from different servers. Note that
-  if the URLs are different aliases for the same authentication server each
-  user will still be treated as separate (e.g. they will have their own copy
-  of each synchronized Realm opened using them). It is highly encouraged that
-  users defined using the access token credential type be logged in with an
-  authentication server URL specified; this parameter will become mandatory
-  in a future version of the SDK.
-* Add `-[RLMSyncUser retrieveInfoForUser:identityProvider:completion:]`
-  API allowing administrator users to retrieve information about a user based
-  on their provider identity (for example, a username). Requires any edition
-  of the Realm Object Server 1.8.2 or later.
-
-### Bugfixes
-
-* Realm no longer throws an "unsupported instruction" exception in some cases
-  when opening a synced Realm asynchronously.
-
-3.0.0-beta Release notes (2017-07-14)
-=============================================================
-
-### Breaking Changes
-
-* Synchronized Realms require a server running Realm Object Server v2.0 or higher.
-
-### Enhancements
-
-* Add a new error code to denote 'permission denied' errors when working
-  with synchronized Realms, as well as an accompanying block that can be
-  called to inform the binding that the offending Realm's files should be
-  deleted immediately. This allows recovering from 'permission denied'
-  errors in a more robust manner. See the documentation for
-  `RLMSyncErrorPermissionDeniedError` for more information.
-* Add `-[RLMSyncPermissionValue initWithRealmPath:username:accessLevel:]`
-  API allowing permissions to be applied to a user based on their username
-  (usually, an email address). Requires any edition of the Realm Object
-  Server 1.6.0 or later.
-* Improve performance of creating Swift objects which contain at least one List
-  property.
-
-### Bugfixes
-
-* `List.description` now reports the correct types for nested lists.
-* Fix unmanaged object initialization when a nested property type returned
-  `false` from `Object.shouldIncludeInDefaultSchema()`.
-* Don't clear RLMArrays on self-assignment.
-
-2.10.2 Release notes (2017-09-27)
-=============================================================
-
-### Bugfixes
-
-* The keychain item name used by Realm to manage the encryption keys for
-  sync-related metadata is now set to a per-app name based on the bundle
-  identifier. Keys that were previously stored within the single, shared Realm
-  keychain item will be transparently migrated to the per-application keychain
-  item.
-* Fix downloading of the Realm core binaries when Xcode's command-line tools are
-  set as the active developer directory for command-line interactions.
-* Fix a crash that could occur when resolving a ThreadSafeReference to a `List`
-  whose parent object had since been deleted.
-
-2.10.1 Release notes (2017-09-14)
-=============================================================
-
-Swift binaries are now produced for Swift 3.0, 3.0.1, 3.0.2, 3.1, 3.2 and 4.0.
-
-### Enhancements
-
-* Auxiliary files are excluded from backup by default.
-
-### Bugfixes
-
-* Fix more cases where assigning an RLMArray property to itself would clear the
-  RLMArray.
-
-2.10.0 Release notes (2017-08-21)
-=============================================================
-
-### API Breaking Changes
-
-* None.
-
-### Enhancements
-
-* Expose additional authentication-related errors that might be reported by
-  a Realm Object Server.
-* An error handler can now be registered on `{RLM}SyncUser`s in order to
-  report authentication-related errors that affect the user.
-
-### Bugfixes
-
-* Sorting Realm collection types no longer throws an exception on iOS 7.
-* Sync users are now automatically logged out upon receiving certain types
-  of errors that indicate they are no longer logged into the server. For
-  example, users who are authenticated using third-party credentials will find
-  themselves logged out of the Realm Object Server if the third-party identity
-  service indicates that their credential is no longer valid.
-* Address high CPU usage and hangs in certain cases when processing collection
-  notifications in highly-connected object graphs.
-
-2.9.1 Release notes (2017-08-01)
-=============================================================
-
-### API Breaking Changes
-
-* None.
-
-### Enhancements
-
-* None.
-
-### Bugfixes
-
-* The `shouldCompactOnLaunch` block is no longer invoked if the Realm at that
-  path is already open on other threads.
-* Fix an assertion failure in collection notifications when changes are made to
-  the schema via sync while the notification block is active.
-
-2.9.0 Release notes (2017-07-26)
-=============================================================
-
-### API Breaking Changes
-
-* None.
-
-### Enhancements
-
-* Add a new error code to denote 'permission denied' errors when working
-  with synchronized Realms, as well as an accompanying block that can be
-  called to inform the binding that the offending Realm's files should be
-  deleted immediately. This allows recovering from 'permission denied'
-  errors in a more robust manner. See the documentation for
-  `RLMSyncErrorPermissionDeniedError` for more information.
-* Add `-[RLMSyncPermissionValue initWithRealmPath:username:accessLevel:]`
-  API allowing permissions to be applied to a user based on their username
-  (usually, an email address). Requires any edition of the Realm Object
-  Server 1.6.0 or later.
-* Improve performance of creating Swift objects which contain at least one List
-  property.
-* It is now possible to create and log in multiple Realm Object Server users
-  with the same identity if they originate from different servers. Note that
-  if the URLs are different aliases for the same authentication server each
-  user will still be treated as separate (e.g. they will have their own copy
-  of each synchronized Realm opened using them). It is highly encouraged that
-  users defined using the access token credential type be logged in with an
-  authentication server URL specified; this parameter will become mandatory
-  in a future version of the SDK.
-* Add `-[RLMSyncUser retrieveInfoForUser:identityProvider:completion:]`
-  API allowing administrator users to retrieve information about a user based
-  on their provider identity (for example, a username). Requires any edition
-  of the Realm Object Server 1.8.2 or later.
-
-### Bugfixes
-
-* `List.description` now reports the correct types for nested lists.
-* Fix unmanaged object initialization when a nested property type returned
-  `false` from `Object.shouldIncludeInDefaultSchema()`.
-* Don't clear RLMArrays on self-assignment.
-
-2.8.3 Release notes (2017-06-20)
-=============================================================
-
-### Bugfixes
-
-* Properly update RealmOptional properties when adding an object with `add(update: true)`.
-* Add some missing quotes in error messages.
-* Fix a performance regression when creating objects with primary keys.
-
-2.8.2 Release notes (2017-06-16)
-=============================================================
-
-### Bugfixes
-
-* Fix an issue where synchronized Realms would eventually disconnect from the
-  remote server if the user object used to define their sync configuration
-  was destroyed.
-* Restore support for changing primary keys in migrations (broken in 2.8.0).
-* Revert handling of adding objects with nil properties to a Realm to the
-  pre-2.8.0 behavior.
-
-2.8.1 Release notes (2017-06-12)
-=============================================================
-
-Add support for building with Xcode 9 Beta 1.
-
-### Bugfixes
-
-* Fix setting a float property to NaN.
-* Fix a crash when using compact on launch in combination with collection
-  notifications.
-
-2.8.0 Release notes (2017-06-02)
-=============================================================
-
-### API Breaking Changes
-
-* None.
-
-### Enhancements
-
-* Enable encryption on watchOS.
-* Add `-[RLMSyncUser changePassword:forUserID:completion:]` API to change an
-  arbitrary user's password if the current user has administrative privileges
-  and using Realm's 'password' authentication provider.
-  Requires any edition of the Realm Object Server 1.6.0 or later.
-
-### Bugfixes
-
-* Suppress `-Wdocumentation` warnings in Realm C++ headers when using CocoaPods
-  with Xcode 8.3.2.
-* Throw an appropriate error rather than crashing when an RLMArray is assigned
-  to an RLMArray property of a different type.
-* Fix crash in large (>4GB) encrypted Realm files.
-* Improve accuracy of sync progress notifications.
-* Fix an issue where synchronized Realms did not connect to the remote server
-  in certain situations, such as when an application was offline when the Realms
-  were opened but later regained network connectivity.
-
-2.7.0 Release notes (2017-05-03)
-=============================================================
-
-### API Breaking Changes
-
-* None.
-
-### Enhancements
-
-* Use reachability API to minimize the reconnection delay if the network
-  connection was lost.
-* Add `-[RLMSyncUser changePassword:completion:]` API to change the current
-  user's password if using Realm's 'password' authentication provider.
-  Requires any edition of the Realm Object Server 1.4.0 or later.
-* `{RLM}SyncConfiguration` now has an `enableSSLValidation` property
-  (and default parameter in the Swift initializer) to allow SSL validation
-  to be specified on a per-server basis.
-* Transactions between a synced Realm and a Realm Object Server can now
-  exceed 16 MB in size.
-* Add new APIs for changing and retrieving permissions for synchronized Realms.
-  These APIs are intended to replace the existing Realm Object-based permissions
-  system. Requires any edition of the Realm Object Server 1.1.0 or later.
-
-### Bugfixes
-
-* Support Realm model classes defined in Swift with overridden Objective-C
-  names (e.g. `@objc(Foo) class SwiftFoo: Object {}`).
-* Fix `-[RLMMigration enumerateObjects:block:]` returning incorrect `oldObject`
-  objects when enumerating a class name after previously deleting a `newObject`.
-* Fix an issue where `Realm.asyncOpen(...)` would fail to work when opening a
-  synchronized Realm for which the user only had read permissions.
-* Using KVC to set a `List` property to `nil` now clears it to match the
-  behavior of `RLMArray` properties.
-* Fix crash from `!m_awaiting_pong` assertion failure when using synced Realms.
-* Fix poor performance or hangs when performing case-insensitive queries on
-  indexed string properties that contain many characters that don't differ
-  between upper and lower case (e.g., numbers, punctuation).
-
-2.6.2 Release notes (2017-04-21)
-=============================================================
-
-### API Breaking Changes
-
-* None.
-
-### Enhancements
-
-* None.
-
-### Bugfixes
-
-* Fix an issue where calling `Realm.asyncOpen(...)` with a synchronized Realm
-  configuration would fail with an "Operation canceled" error.
-* Fix initial collection notification sometimes not being delivered for synced
-  Realms.
-* Fix circular links sometimes resulting in objects not being marked as
-  modified in change notifications.
-
-2.6.1 Release notes (2017-04-18)
-=============================================================
-
-### API Breaking Changes
-
-* None.
-
-### Enhancements
-
-* None.
-
-### Bugfixes
-
-* Fix an issue where calling `Realm.asyncOpen(...)` with a synchronized Realm
-  configuration would crash in error cases rather than report the error.
-  This is a small source breaking change if you were relying on the error
-  being reported to be a `Realm.Error`.
-
-2.6.0 Release notes (2017-04-18)
-=============================================================
-
-### API Breaking Changes
-
-* None.
-
-### Enhancements
-
-* Add a `{RLM}SyncUser.isAdmin` property indicating whether a user is a Realm
-  Object Server administrator.
-* Add an API to asynchronously open a Realm and deliver it to a block on a
-  given queue. This performs all work needed to get the Realm to
-  a usable state (such as running potentially time-consuming migrations) on a
-  background thread before dispatching to the given queue. In addition,
-  synchronized Realms wait for all remote content available at the time the
-  operation began to be downloaded and available locally.
-* Add `shouldCompactOnLaunch` block property when configuring a Realm to
-  determine if it should be compacted before being returned.
-* Speed up case-insensitive queries on indexed string properties.
-* Add RLMResults's collection aggregate methods to RLMArray.
-* Add support for calling the aggregate methods on unmanaged Lists.
-
-### Bugfixes
-
-* Fix a deadlock when multiple processes open a Realm at the same time.
-* Fix `value(forKey:)`/`value(forKeyPath:)` returning incorrect values for `List` properties.
-
-2.5.1 Release notes (2017-04-05)
-=============================================================
-
-### API Breaking Changes
-
-* None.
-
-### Enhancements
-
-* None.
-
-### Bugfixes
-
-* Fix CocoaPods installation with static libraries and multiple platforms.
-* Fix uncaught "Bad version number" exceptions on the notification worker thread
-  followed by deadlocks when Realms refresh.
-
-2.5.0 Release notes (2017-03-28)
-=============================================================
-
-Files written by Realm this version cannot be read by earlier versions of Realm.
-Old files can still be opened and files open in read-only mode will not be
-modified.
-
-If using synchronized Realms, the Realm Object Server must be running version
-1.3.0 or later.
-
-Swift binaries are now produced for Swift 3.0, 3.0.1, 3.0.2 and 3.1.
-
-### API Breaking Changes
-
-* None.
-
-### Enhancements
-
-* Add support for multi-level object equality comparisons against `NULL`.
-* Add support for the `[d]` modifier on string comparison operators to perform
-  diacritic-insensitive comparisons.
-* Explicitly mark `[[RLMRealm alloc] init]` as unavailable.
-* Include the name of the problematic class in the error message when an
-  invalid property type is marked as the primary key.
-
-### Bugfixes
-
-* Fix incorrect column type assertions which could occur after schemas were
-  merged by sync.
-* Eliminate an empty write transaction when opening a synced Realm.
-* Support encrypting synchronized Realms by respecting the `encryptionKey` value
-  of the Realm's configuration.
-* Fix crash when setting an `{NS}Data` property close to 16MB.
-* Fix for reading `{NS}Data` properties incorrectly returning `nil`.
-* Reduce file size growth in cases where Realm versions were pinned while
-  starting write transactions.
-* Fix an assertion failure when writing to large `RLMArray`/`List` properties.
-* Fix uncaught `BadTransactLog` exceptions when pulling invalid changesets from
-  synchronized Realms.
-* Fix an assertion failure when an observed `RLMArray`/`List` is deleted after
-  being modified.
-
-2.4.4 Release notes (2017-03-13)
-=============================================================
-
-### API Breaking Changes
-
-* None.
-
-### Enhancements
-
-* Add `(RLM)SyncPermission` class to allow reviewing access permissions for
-  Realms. Requires any edition of the Realm Object Server 1.1.0 or later.
-* Further reduce the number of files opened per thread-specific Realm on macOS,
-  iOS and watchOS.
-
-### Bugfixes
-
-* Fix a crash that could occur if new Realm instances were created while the
-  application was exiting.
-* Fix a bug that could lead to bad version number errors when delivering
-  change notifications.
-* Fix a potential use-after-free bug when checking validity of results.
-* Fix an issue where a sync session might not close properly if it receives
-  an error while being torn down.
-* Fix some issues where a sync session might not reconnect to the server properly
-  or get into an inconsistent state if revived after invalidation.
-* Fix an issue where notifications might not fire when the children of an
-  observed object are changed.
-* Fix an issue where progress notifications on sync sessions might incorrectly
-  report out-of-date values.
-* Fix an issue where multiple threads accessing encrypted data could result in
-  corrupted data or crashes.
-* Fix an issue where certain `LIKE` queries could hang.
-* Fix an issue where `-[RLMRealm writeCopyToURL:encryptionKey:error]` could create
-  a corrupt Realm file.
-* Fix an issue where incrementing a synced Realm's schema version without actually
-  changing the schema could cause a crash.
-
-2.4.3 Release notes (2017-02-20)
-=============================================================
-
-### API Breaking Changes
-
-* None.
-
-### Enhancements
-
-* Avoid copying copy-on-write data structures, which can grow the file, when the
-  write does not actually change existing values.
-* Improve performance of deleting all objects in an RLMResults.
-* Reduce the number of files opened per thread-specific Realm on macOS.
-* Improve startup performance with large numbers of `RLMObject`/`Object`
-  subclasses.
-
-### Bugfixes
-
-* Fix synchronized Realms not downloading remote changes when an access token
-  expires and there are no local changes to upload.
-* Fix an issue where values set on a Realm object using `setValue(value:, forKey:)`
-  that were not themselves Realm objects were not properly converted into Realm
-  objects or checked for validity.
-* Fix an issue where `-[RLMSyncUser sessionForURL:]` could erroneously return a
-  non-nil value when passed in an invalid URL.
-* `SyncSession.Progress.fractionTransferred` now returns 1 if there are no
-  transferrable bytes.
-* Fix sync progress notifications registered on background threads by always
-  dispatching on a dedicated background queue.
-* Fix compilation issues with Xcode 8.3 beta 2.
-* Fix incorrect sync progress notification values for Realms originally created
-  using a version of Realm prior to 2.3.0.
-* Fix LLDB integration to be able to display summaries of `RLMResults` once more.
-* Reject Swift properties with names which cause them to fall in to ARC method
-  families rather than crashing when they are accessed.
-* Fix sorting by key path when the declared property order doesn't match the order
-  of properties in the Realm file, which can happen when properties are added in
-  different schema versions.
-
-2.4.2 Release notes (2017-01-30)
-=============================================================
-
-### Bugfixes
-
-* Fix an issue where RLMRealm instances could end up in the autorelease pool
-  for other threads.
-
-2.4.1 Release notes (2017-01-27)
-=============================================================
-
-### Bugfixes
-
-* Fix an issue where authentication tokens were not properly refreshed
-  automatically before expiring.
-
-2.4.0 Release notes (2017-01-26)
-=============================================================
-
-This release drops support for compiling with Swift 2.x.
-Swift 3.0.0 is now the minimum Swift version supported.
-
-### API Breaking Changes
-
-* None.
-
-### Enhancements
-
-* Add change notifications for individual objects with an API similar to that
-  of collection notifications.
-
-### Bugfixes
-
-* Fix Realm Objective-C compilation errors with Xcode 8.3 beta 1.
-* Fix several error handling issues when renewing expired authentication
-  tokens for synchronized Realms.
-* Fix a race condition leading to bad_version exceptions being thrown in
-  Realm's background worker thread.
-
-2.3.0 Release notes (2017-01-19)
-=============================================================
-
-### Sync Breaking Changes
-
-* Make `PermissionChange`'s `id` property a primary key.
-
-### API Breaking Changes
-
-* None.
-
-### Enhancements
-
-* Add `SyncPermissionOffer` and `SyncPermissionOfferResponse` classes to allow
-  creating and accepting permission change events to synchronized Realms between
-  different users.
-* Support monitoring sync transfer progress by registering notification blocks
-  on `SyncSession`. Specify the transfer direction (`.upload`/`.download`) and
-  mode (`.reportIndefinitely`/`.forCurrentlyOutstandingWork`) to monitor.
-
-### Bugfixes
-
-* Fix a call to `commitWrite(withoutNotifying:)` committing a transaction that
-  would not have triggered a notification incorrectly skipping the next
-  notification.
-* Fix incorrect results and crashes when conflicting object insertions are
-  merged by the synchronization mechanism when there is a collection
-  notification registered for that object type.
-
-2.2.0 Release notes (2017-01-12)
-=============================================================
-
-### Sync Breaking Changes (In Beta)
-
-* Sync-related error reporting behavior has been changed. Errors not related
-  to a particular user or session are only reported if they are classed as
-  'fatal' by the underlying sync engine.
-* Added `RLMSyncErrorClientResetError` to `RLMSyncError` enum.
-
-### API Breaking Changes
-
-* The following Objective-C APIs have been deprecated in favor of newer or preferred versions:
-
-| Deprecated API                                              | New API                                                     |
-|:------------------------------------------------------------|:------------------------------------------------------------|
-| `-[RLMArray sortedResultsUsingProperty:]`                   | `-[RLMArray sortedResultsUsingKeyPath:]`                    |
-| `-[RLMCollection sortedResultsUsingProperty:]`              | `-[RLMCollection sortedResultsUsingKeyPath:]`               |
-| `-[RLMResults sortedResultsUsingProperty:]`                 | `-[RLMResults sortedResultsUsingKeyPath:]`                  |
-| `+[RLMSortDescriptor sortDescriptorWithProperty:ascending]` | `+[RLMSortDescriptor sortDescriptorWithKeyPath:ascending:]` |
-| `RLMSortDescriptor.property`                                | `RLMSortDescriptor.keyPath`                                 |
-
-* The following Swift APIs have been deprecated in favor of newer or preferred versions:
-
-| Deprecated API                                        | New API                                          |
-|:------------------------------------------------------|:-------------------------------------------------|
-| `LinkingObjects.sorted(byProperty:ascending:)`        | `LinkingObjects.sorted(byKeyPath:ascending:)`    |
-| `List.sorted(byProperty:ascending:)`                  | `List.sorted(byKeyPath:ascending:)`              |
-| `RealmCollection.sorted(byProperty:ascending:)`       | `RealmCollection.sorted(byKeyPath:ascending:)`   |
-| `Results.sorted(byProperty:ascending:)`               | `Results.sorted(byKeyPath:ascending:)`           |
-| `SortDescriptor(property:ascending:)`                 | `SortDescriptor(keyPath:ascending:)`             |
-| `SortDescriptor.property`                             | `SortDescriptor.keyPath`                         |
-
-### Enhancements
-
-* Introduce APIs for safely passing objects between threads. Create a
-  thread-safe reference to a thread-confined object by passing it to the
-  `+[RLMThreadSafeReference referenceWithThreadConfined:]`/`ThreadSafeReference(to:)`
-  constructor, which you can then safely pass to another thread to resolve in
-  the new Realm with `-[RLMRealm resolveThreadSafeReference:]`/`Realm.resolve(_:)`.
-* Realm collections can now be sorted by properties over to-one relationships.
-* Optimized `CONTAINS` queries to use Boyer-Moore algorithm
-  (around 10x speedup on large datasets).
-
-### Bugfixes
-
-* Setting `deleteRealmIfMigrationNeeded` now also deletes the Realm if a file
-  format migration is required, such as when moving from a file last accessed
-  with Realm 0.x to 1.x, or 1.x to 2.x.
-* Fix queries containing nested `SUBQUERY` expressions.
-* Fix spurious incorrect thread exceptions when a thread id happens to be
-  reused while an RLMRealm instance from the old thread still exists.
-* Fixed various bugs in aggregate methods (max, min, avg, sum).
-
-2.1.2 Release notes (2016--12-19)
-=============================================================
-
-This release adds binary versions of Swift 3.0.2 frameworks built with Xcode 8.2.
-
-### Sync Breaking Changes (In Beta)
-
-* Rename occurences of "iCloud" with "CloudKit" in APIs and comments to match
-  naming in the Realm Object Server.
-
-### API Breaking Changes
-
-* None.
-
-### Enhancements
-
-* Add support for 'LIKE' queries (wildcard matching).
-
-### Bugfixes
-
-* Fix authenticating with CloudKit.
-* Fix linker warning about "Direct access to global weak symbol".
-
-2.1.1 Release notes (2016-12-02)
-=============================================================
-
-### Enhancements
-
-* Add `RealmSwift.ObjectiveCSupport.convert(object:)` methods to help write
-  code that interoperates between Realm Objective-C and Realm Swift APIs.
-* Throw exceptions when opening a Realm with an incorrect configuration, like:
-    * `readOnly` set with a sync configuration.
-    * `readOnly` set with a migration block.
-    * migration block set with a sync configuration.
-* Greatly improve performance of write transactions which make a large number of
-  changes to indexed properties, including the automatic migration when opening
-  files written by Realm 1.x.
-
-### Bugfixes
-
-* Reset sync metadata Realm in case of decryption error.
-* Fix issue preventing using synchronized Realms in Xcode Playgrounds.
-* Fix assertion failure when migrating a model property from object type to
-  `RLMLinkingObjects` type.
-* Fix a `LogicError: Bad version number` exception when using `RLMResults` with
-  no notification blocks and explicitly called `-[RLMRealm refresh]` from that
-  thread.
-* Logged-out users are no longer returned from `+[RLMSyncUser currentUser]` or
-  `+[RLMSyncUser allUsers]`.
-* Fix several issues which could occur when the 1001st object of a given type
-  was created or added to an RLMArray/List, including crashes when rerunning
-  existing queries and possibly data corruption.
-* Fix a potential crash when the application exits due to a race condition in
-  the destruction of global static variables.
-* Fix race conditions when waiting for sync uploads or downloads to complete
-  which could result in crashes or the callback being called too early.
-
-2.1.0 Release notes (2016-11-18)
-=============================================================
-
-### Sync Breaking Changes (In Beta)
-
-* None.
-
-### API breaking changes
-
-* None.
-
-### Enhancements
-
-* Add the ability to skip calling specific notification blocks when committing
-  a write transaction.
-
-### Bugfixes
-
-* Deliver collection notifications when beginning a write transaction which
-  advances the read version of a Realm (previously only Realm-level
-  notifications were sent).
-* Fix some scenarios which would lead to inconsistent states when using
-  collection notifications.
-* Fix several race conditions in the notification functionality.
-* Don't send Realm change notifications when canceling a write transaction.
-
-2.0.4 Release notes (2016-11-14)
-=============================================================
-
-### Sync Breaking Changes (In Beta)
-
-* Remove `RLMAuthenticationActions` and replace
-  `+[RLMSyncCredential credentialWithUsername:password:actions:]` with
-  `+[RLMSyncCredential credentialsWithUsername:password:register:]`.
-* Rename `+[RLMSyncUser authenticateWithCredential:]` to
-  `+[RLMSyncUser logInWithCredentials:]`.
-* Rename "credential"-related types and methods to
-  `RLMSyncCredentials`/`SyncCredentials` and consistently refer to credentials
-  in the plural form.
-* Change `+[RLMSyncUser all]` to return a dictionary of identifiers to users and
-  rename to:
-  * `+[RLMSyncUser allUsers]` in Objective-C.
-  * `SyncUser.allUsers()` in Swift 2.
-  * `SyncUser.all` in Swift 3.
-* Rename `SyncManager.sharedManager()` to `SyncManager.shared` in Swift 3.
-* Change `Realm.Configuration.syncConfiguration` to take a `SyncConfiguration`
-  struct rather than a named tuple.
-* `+[RLMSyncUser logInWithCredentials:]` now invokes its callback block on a
-  background queue.
-
-### API breaking changes
-
-* None.
-
-### Enhancements
-
-* Add `+[RLMSyncUser currentUser]`.
-* Add the ability to change read, write and management permissions for
-  synchronized Realms using the management Realm obtained via the
-  `-[RLMSyncUser managementRealmWithError:]` API and the
-  `RLMSyncPermissionChange` class.
-
-### Bugfixes
-
-* None.
-
-2.0.3 Release notes (2016-10-27)
-=============================================================
-
-This release adds binary versions of Swift 3.0.1 frameworks built with Xcode 8.1
-GM seed.
-
-### API breaking changes
-
-* None.
-
-### Enhancements
-
-* None.
-
-### Bugfixes
-
-* Fix a `BadVersion` exception caused by a race condition when delivering
-  collection change notifications.
-* Fix an assertion failure when additional model classes are added and
-  `deleteRealmIfMigrationNeeded` is enabled.
-* Fix a `BadTransactLog` exception when deleting an `RLMResults` in a synced
-  Realm.
-* Fix an assertion failure when a write transaction is in progress at the point
-  of process termination.
-* Fix a crash that could occur when working with a `RLMLinkingObject` property
-  of an unmanaged object.
-
-2.0.2 Release notes (2016-10-05)
-=============================================================
-
-This release is not protocol-compatible with previous version of the Realm
-Mobile Platform.
-
-### API breaking changes
-
-* Rename Realm Swift's `User` to `SyncUser` to make clear that it relates to the
-  Realm Mobile Platform, and to avoid potential conflicts with other `User` types.
-
-### Bugfixes
-
-* Fix Realm headers to be compatible with pre-C++11 dialects of Objective-C++.
-* Fix incorrect merging of RLMArray/List changes when objects with the same
-  primary key are created on multiple devices.
-* Fix bad transaction log errors after deleting objects on a different device.
-* Fix a BadVersion error when a background worker finishes running while older
-  results from that worker are being delivered to a different thread.
-
-2.0.1 Release notes (2016-09-29)
-=============================================================
-
-### Bugfixes
-
-* Fix an assertion failure when opening a Realm file written by a 1.x version
-  of Realm which has an indexed nullable int or bool property.
-
-2.0.0 Release notes (2016-09-27)
-=============================================================
-
-This release introduces support for the Realm Mobile Platform!
-See <https://realm.io/news/introducing-realm-mobile-platform/> for an overview
-of these great new features.
-
-### API breaking changes
-
-* By popular demand, `RealmSwift.Error` has been moved from the top-level
-  namespace into a `Realm` extension and is now `Realm.Error`, so that it no
-  longer conflicts with `Swift.Error`.
-* Files written by Realm 2.0 cannot be read by 1.x or earlier versions. Old
-  files can still be opened.
-
-### Enhancements
-
-* The .log, .log_a and .log_b files no longer exist and the state tracked in
-  them has been moved to the main Realm file. This reduces the number of open
-  files needed by Realm, improves performance of both opening and writing to
-  Realms, and eliminates a small window where committing write transactions
-  would prevent other processes from opening the file.
-
-### Bugfixes
-
-* Fix an assertion failure when sorting by zero properties.
-* Fix a mid-commit crash in one process also crashing all other processes with
-  the same Realm open.
-* Properly initialize new nullable float and double properties added to
-  existing objects to null rather than 0.
-* Fix a stack overflow when objects with indexed string properties had very
-  long common prefixes.
-* Fix a race condition which could lead to crashes when using async queries or
-  collection notifications.
-* Fix a bug which could lead to incorrect state when an object which links to
-  itself is deleted from the Realm.
-
-1.1.0 Release notes (2016-09-16)
-=============================================================
-
-This release brings official support for Xcode 8, Swift 2.3 and Swift 3.0.
-Prebuilt frameworks are now built with Xcode 7.3.1 and Xcode 8.0.
-
-### API breaking changes
-
-* Deprecate `migrateRealm:` in favor of new `performMigrationForConfiguration:error:` method
-  that follows Cocoa's NSError conventions.
-* Fix issue where `RLMResults` used `id `instead of its generic type as the return
-  type of subscript.
-
-### Enhancements
-
-* Improve error message when using NSNumber incorrectly in Swift models.
-* Further reduce the download size of the prebuilt static libraries.
-* Improve sort performance, especially on non-nullable columns.
-* Allow partial initialization of object by `initWithValue:`, deferring
-  required property checks until object is added to Realm.
-
-### Bugfixes
-
-* Fix incorrect truncation of the constant value for queries of the form
-  `column < value` for `float` and `double` columns.
-* Fix crash when an aggregate is accessed as an `Int8`, `Int16`, `Int32`, or `Int64`.
-* Fix a race condition that could lead to a crash if an RLMArray or List was
-  deallocated on a different thread than it was created on.
-* Fix a crash when the last reference to an observed object is released from
-  within the observation.
-* Fix a crash when `initWithValue:` is used to create a nested object for a class
-  with an uninitialized schema.
-* Enforce uniqueness for `RealmOptional` primary keys when using the `value` setter.
-
-1.0.2 Release notes (2016-07-13)
-=============================================================
-
-### API breaking changes
-
-* Attempting to add an object with no properties to a Realm now throws rather than silently
-  doing nothing.
-
-### Enhancements
-
-* Swift: A `write` block may now `throw`, reverting any changes already made in
-  the transaction.
-* Reduce address space used when committing write transactions.
-* Significantly reduce the download size of prebuilt binaries and slightly
-  reduce the final size contribution of Realm to applications.
-* Improve performance of accessing RLMArray properties and creating objects
-  with List properties.
-
-### Bugfixes
-
-* Fix a crash when reading the shared schema from an observed Swift object.
-* Fix crashes or incorrect results when passing an array of values to
-  `createOrUpdate` after reordering the class's properties.
-* Ensure that the initial call of a Results notification block is always passed
-  .Initial even if there is a write transaction between when the notification
-  is added and when the first notification is delivered.
-* Fix a crash when deleting all objects in a Realm while fast-enumerating query
-  results from that Realm.
-* Handle EINTR from flock() rather than crashing.
-* Fix incorrect behavior following a call to `[RLMRealm compact]`.
-* Fix live updating and notifications for Results created from a predicate involving
-  an inverse relationship to be triggered when an object at the other end of the relationship
-  is modified.
-
-1.0.1 Release notes (2016-06-12)
-=============================================================
-
-### API breaking changes
-
-* None.
-
-### Enhancements
-
-* Significantly improve performance of opening Realm files, and slightly
-  improve performance of committing write transactions.
-
-### Bugfixes
-
-* Swift: Fix an error thrown when trying to create or update `Object` instances via
-  `add(:_update:)` with a primary key property of type `RealmOptional`.
-* Xcode playground in Swift release zip now runs successfully.
-* The `key` parameter of `Realm.objectForPrimaryKey(_:key:)`/ `Realm.dynamicObjectForPrimaryKey(_:key:)`
- is now marked as optional.
-* Fix a potential memory leak when closing Realms after a Realm file has been
-  opened on multiple threads which are running in active run loops.
-* Fix notifications breaking on tvOS after a very large number of write
-  transactions have been committed.
-* Fix a "Destruction of mutex in use" assertion failure after an error while
-  opening a file.
-* Realm now throws an exception if an `Object` subclass is defined with a managed Swift `lazy` property.
-  Objects with ignored `lazy` properties should now work correctly.
-* Update the LLDB script to work with recent changes to the implementation of `RLMResults`.
-* Fix an assertion failure when a Realm file is deleted while it is still open,
-  and then a new Realm is opened at the same path. Note that this is still not
-  a supported scenario, and may break in other ways.
-
-1.0.0 Release notes (2016-05-25)
-=============================================================
-
-No changes since 0.103.2.
-
-0.103.2 Release notes (2016-05-24)
-=============================================================
-
-### API breaking changes
-
-* None.
-
-### Enhancements
-
-* Improve the error messages when an I/O error occurs in `writeCopyToURL`.
-
-### Bugfixes
-
-* Fix an assertion failure which could occur when opening a Realm after opening
-  that Realm failed previously in some specific ways in the same run of the
-  application.
-* Reading optional integers, floats, and doubles from within a migration block
-  now correctly returns `nil` rather than 0 when the stored value is `nil`.
-
-0.103.1 Release notes (2016-05-19)
-=============================================================
-
-### API breaking changes
-
-* None.
-
-### Enhancements
-
-* None.
-
-### Bugfixes
-
-* Fix a bug that sometimes resulted in a single object's NSData properties
-  changing from `nil` to a zero-length non-`nil` NSData when a different object
-  of the same type was deleted.
-
-0.103.0 Release notes (2016-05-18)
-=============================================================
-
-### API breaking changes
-
-* All functionality deprecated in previous releases has been removed entirely.
-* Support for Xcode 6.x & Swift prior to 2.2 has been completely removed.
-* `RLMResults`/`Results` now become empty when a `RLMArray`/`List` or object
-  they depend on is deleted, rather than throwing an exception when accessed.
-* Migrations are no longer run when `deleteRealmIfMigrationNeeded` is set,
-  recreating the file instead.
-
-### Enhancements
-
-* Added `invalidated` properties to `RLMResults`/`Results`, `RLMLinkingObjects`/`LinkingObjects`,
-  `RealmCollectionType` and `AnyRealmCollection`. These properties report whether the Realm
-  the object is associated with has been invalidated.
-* Some `NSError`s created by Realm now have more descriptive user info payloads.
-
-### Bugfixes
-
-* None.
-
-0.102.1 Release notes (2016-05-13)
-=============================================================
-
-### API breaking changes
-
-* None.
-
-### Enhancements
-
-* Return `RLMErrorSchemaMismatch` error rather than the more generic `RLMErrorFail`
-  when a migration is required.
-* Improve the performance of allocating instances of `Object` subclasses
-  that have `LinkingObjects` properties.
-
-### Bugfixes
-
-* `RLMLinkingObjects` properties declared in Swift subclasses of `RLMObject`
-  now work correctly.
-* Fix an assertion failure when deleting all objects of a type, inserting more
-  objects, and then deleting some of the newly inserted objects within a single
-  write transaction when there is an active notification block for a different
-  object type which links to the objects being deleted.
-* Fix crashes and/or incorrect results when querying over multiple levels of
-  `LinkingObjects` properties.
-* Fix opening read-only Realms on multiple threads at once.
-* Fix a `BadTransactLog` exception when storing dates before the unix epoch (1970-01-01).
-
-0.102.0 Release notes (2016-05-09)
-=============================================================
-
-### API breaking changes
-
-* None.
-
-### Enhancements
-
-* Add a method to rename properties during migrations:
-  * Swift: `Migration.renamePropertyForClass(_:oldName:newName:)`
-  * Objective-C: `-[RLMMigration renamePropertyForClass:oldName:newName:]`
-* Add `deleteRealmIfMigrationNeeded` to
-  `RLMRealmConfiguration`/`Realm.Configuration`. When this is set to `true`,
-  the Realm file will be automatically deleted and recreated when there is a
-  schema mismatch rather than migrated to the new schema.
-
-### Bugfixes
-
-* Fix `BETWEEN` queries that traverse `RLMArray`/`List` properties to ensure that
-  a single related object satisfies the `BETWEEN` criteria, rather than allowing
-  different objects in the array to satisfy the lower and upper bounds.
-* Fix a race condition when a Realm is opened on one thread while it is in the
-  middle of being closed on another thread which could result in crashes.
-* Fix a bug which could result in changes made on one thread being applied
-  incorrectly on other threads when those threads are refreshed.
-* Fix crash when migrating to the new date format introduced in 0.101.0.
-* Fix crash when querying inverse relationships when objects are deleted.
-
-0.101.0 Release notes (2016-05-04)
-=============================================================
-
-### API breaking changes
-
-* Files written by this version of Realm cannot be read by older versions of
-  Realm. Existing files will automatically be upgraded when they are opened.
-
-### Enhancements
-
-* Greatly improve performance of collection change calculation for complex
-  object graphs, especially for ones with cycles.
-* NSDate properties now support nanoseconds precision.
-* Opening a single Realm file on multiple threads now shares a single memory
-  mapping of the file for all threads, significantly reducing the memory
-  required to work with large files.
-* Crashing while in the middle of a write transaction no longer blocks other
-  processes from performing write transactions on the same file.
-* Improve the performance of refreshing a Realm (including via autorefresh)
-  when there are live Results/RLMResults objects for that Realm.
-
-### Bugfixes
-
-* Fix an assertion failure of "!more_before || index >= std::prev(it)->second)"
-  in `IndexSet::do_add()`.
-* Fix a crash when an `RLMArray` or `List` object is destroyed from the wrong
-  thread.
-
-0.100.0 Release notes (2016-04-29)
-=============================================================
-
-### API breaking changes
-
-* `-[RLMObject linkingObjectsOfClass:forProperty]` and `Object.linkingObjects(_:forProperty:)`
-  are deprecated in favor of properties of type `RLMLinkingObjects` / `LinkingObjects`.
-
-### Enhancements
-
-* The automatically-maintained inverse direction of relationships can now be exposed as
-  properties of type `RLMLinkingObjects` / `LinkingObjects`. These properties automatically
-  update to reflect the objects that link to the target object, can be used in queries, and
-  can be filtered like other Realm collection types.
-* Queries that compare objects for equality now support multi-level key paths.
-
-### Bugfixes
-
-* Fix an assertion failure when a second write transaction is committed after a
-  write transaction deleted the object containing an RLMArray/List which had an
-  active notification block.
-* Queries that compare `RLMArray` / `List` properties using != now give the correct results.
-
-0.99.1 Release notes (2016-04-26)
-=============================================================
-
-### API breaking changes
-
-* None.
-
-### Enhancements
-
-* None.
-
-### Bugfixes
-
-* Fix a scenario that could lead to the assertion failure
-  "m_advancer_sg->get_version_of_current_transaction() ==
-  new_notifiers.front()->version()".
-
-0.99.0 Release notes (2016-04-22)
-=============================================================
-
-### API breaking changes
-
-* Deprecate properties of type `id`/`AnyObject`. This type was rarely used,
-  rarely useful and unsupported in every other Realm binding.
-* The block for `-[RLMArray addNotificationBlock:]` and
-  `-[RLMResults addNotificationBlock:]` now takes another parameter.
-* The following Objective-C APIs have been deprecated in favor of newer or preferred versions:
-
-| Deprecated API                                         | New API                                               |
-|:-------------------------------------------------------|:------------------------------------------------------|
-| `-[RLMRealm removeNotification:]`                      | `-[RLMNotificationToken stop]`                        |
-| `RLMRealmConfiguration.path`                           | `RLMRealmConfiguration.fileURL`                       |
-| `RLMRealm.path`                                        | `RLMRealmConfiguration.fileURL`                       |
-| `RLMRealm.readOnly`                                    | `RLMRealmConfiguration.readOnly`                      |
-| `+[RLMRealm realmWithPath:]`                           | `+[RLMRealm realmWithURL:]`                           |
-| `+[RLMRealm writeCopyToPath:error:]`                   | `+[RLMRealm writeCopyToURL:encryptionKey:error:]`     |
-| `+[RLMRealm writeCopyToPath:encryptionKey:error:]`     | `+[RLMRealm writeCopyToURL:encryptionKey:error:]`     |
-| `+[RLMRealm schemaVersionAtPath:error:]`               | `+[RLMRealm schemaVersionAtURL:encryptionKey:error:]` |
-| `+[RLMRealm schemaVersionAtPath:encryptionKey:error:]` | `+[RLMRealm schemaVersionAtURL:encryptionKey:error:]` |
-
-* The following Swift APIs have been deprecated in favor of newer or preferred versions:
-
-| Deprecated API                                | New API                                  |
-|:----------------------------------------------|:-----------------------------------------|
-| `Realm.removeNotification(_:)`                | `NotificationToken.stop()`               |
-| `Realm.Configuration.path`                    | `Realm.Configuration.fileURL`            |
-| `Realm.path`                                  | `Realm.Configuration.fileURL`            |
-| `Realm.readOnly`                              | `Realm.Configuration.readOnly`           |
-| `Realm.writeCopyToPath(_:encryptionKey:)`     | `Realm.writeCopyToURL(_:encryptionKey:)` |
-| `schemaVersionAtPath(_:encryptionKey:error:)` | `schemaVersionAtURL(_:encryptionKey:)`   |
-
-### Enhancements
-
-* Add information about what rows were added, removed, or modified to the
-  notifications sent to the Realm collections.
-* Improve error when illegally appending to an `RLMArray` / `List` property from a default value
-  or the standalone initializer (`init()`) before the schema is ready.
-
-### Bugfixes
-
-* Fix a use-after-free when an associated object's dealloc method is used to
-  remove observers from an RLMObject.
-* Fix a small memory leak each time a Realm file is opened.
-* Return a recoverable `RLMErrorAddressSpaceExhausted` error rather than
-  crash when there is insufficient available address space on Realm
-  initialization or write commit.
-
-0.98.8 Release notes (2016-04-15)
-=============================================================
-
-### API breaking changes
-
-* None.
-
-### Enhancements
-
-* None.
-
-### Bugfixes
-
-* Fixed a bug that caused some encrypted files created using
-  `-[RLMRealm writeCopyToPath:encryptionKey:error:]` to fail to open.
-
-0.98.7 Release notes (2016-04-13)
-=============================================================
-
-### API breaking changes
-
-* None.
-
-### Enhancements
-
-* None.
-
-### Bugfixes
-
-* Mark further initializers in Objective-C as NS_DESIGNATED_INITIALIZER to prevent that these aren't
-  correctly defined in Swift Object subclasses, which don't qualify for auto-inheriting the required initializers.
-* `-[RLMResults indexOfObjectWithPredicate:]` now returns correct results
-  for `RLMResults` instances that were created by filtering an `RLMArray`.
-* Adjust how RLMObjects are destroyed in order to support using an associated
-  object on an RLMObject to remove KVO observers from that RLMObject.
-* `-[RLMResults indexOfObjectWithPredicate:]` now returns the index of the first matching object for a
-  sorted `RLMResults`, matching its documented behavior.
-* Fix a crash when canceling a transaction that set a relationship.
-* Fix a crash when a query referenced a deleted object.
-
-0.98.6 Release notes (2016-03-25)
-=============================================================
-
-Prebuilt frameworks are now built with Xcode 7.3.
-
-### API breaking changes
-
-* None.
-
-### Enhancements
-
-* None.
-
-### Bugfixes
-
-* Fix running unit tests on iOS simulators and devices with Xcode 7.3.
-
-0.98.5 Release notes (2016-03-14)
-=============================================================
-
-### API breaking changes
-
-* None.
-
-### Enhancements
-
-* None.
-
-### Bugfixes
-
-* Fix a crash when opening a Realm on 32-bit iOS devices.
-
-0.98.4 Release notes (2016-03-10)
-=============================================================
-
-### API breaking changes
-
-* None.
-
-### Enhancements
-
-* None.
-
-### Bugfixes
-
-* Properly report changes made by adding an object to a Realm with
-  addOrUpdate:/createOrUpdate: to KVO observers for existing objects with that
-  primary key.
-* Fix crashes and assorted issues when a migration which added object link
-  properties is rolled back due to an error in the migration block.
-* Fix assertion failures when deleting objects within a migration block of a
-  type which had an object link property added in that migration.
-* Fix an assertion failure in `Query::apply_patch` when updating certain kinds
-  of queries after a write transaction is committed.
-
-0.98.3 Release notes (2016-02-26)
-=============================================================
-
-### Enhancements
-
-* Initializing the shared schema is 3x faster.
-
-### Bugfixes
-
-* Using Realm Objective-C from Swift while having Realm Swift linked no longer causes that the
-  declared `ignoredProperties` are not taken into account.
-* Fix assertion failures when rolling back a migration which added Object link
-  properties to a class.
-* Fix potential errors when cancelling a write transaction which modified
-  multiple `RLMArray`/`List` properties.
-* Report the correct value for inWriteTransaction after attempting to commit a
-  write transaction fails.
-* Support CocoaPods 1.0 beginning from prerelease 1.0.0.beta.4 while retaining
-  backwards compatibility with 0.39.
-
-0.98.2 Release notes (2016-02-18)
-=============================================================
-
-### API breaking changes
-
-* None.
-
-### Enhancements
-
-* Aggregate operations (`ANY`, `NONE`, `@count`, `SUBQUERY`, etc.) are now supported for key paths
-  that begin with an object relationship so long as there is a `RLMArray`/`List` property at some
-  point in a key path.
-* Predicates of the form `%@ IN arrayProperty` are now supported.
-
-### Bugfixes
-
-* Use of KVC collection operators on Swift collection types no longer throws an exception.
-* Fix reporting of inWriteTransaction in notifications triggered by
-  `beginWriteTransaction`.
-* The contents of `List` and `Optional` properties are now correctly preserved when copying
-  a Swift object from one Realm to another, and performing other operations that result in a
-  Swift object graph being recursively traversed from Objective-C.
-* Fix a deadlock when queries are performed within a Realm notification block.
-* The `ANY` / `SOME` / `NONE` qualifiers are now required in comparisons involving a key path that
-  traverse a `RLMArray`/`List` property. Previously they were only required if the first key in the
-  key path was an `RLMArray`/`List` property.
-* Fix several scenarios where the default schema would be initialized
-  incorrectly if the first Realm opened used a restricted class subset (via
-  `objectClasses`/`objectTypes`).
-
-0.98.1 Release notes (2016-02-10)
-=============================================================
-
-### Bugfixes
-
-* Fix crashes when deleting an object containing an `RLMArray`/`List` which had
-  previously been queried.
-* Fix a crash when deleting an object containing an `RLMArray`/`List` with
-  active notification blocks.
-* Fix duplicate file warnings when building via CocoaPods.
-* Fix crash or incorrect results when calling `indexOfObject:` on an
-  `RLMResults` derived from an `RLMArray`.
-
-0.98.0 Release notes (2016-02-04)
-=============================================================
-
-### API breaking changes
-
-* `+[RLMRealm realmWithPath:]`/`Realm.init(path:)` now inherits from the default
-  configuration.
-* Swift 1.2 is no longer supported.
-
-### Enhancements
-
-* Add `addNotificationBlock` to `RLMResults`, `Results`, `RLMArray`, and
-  `List`, which calls the given block whenever the collection changes.
-* Do a lot of the work for keeping `RLMResults`/`Results` up-to-date after
-  write transactions on a background thread to help avoid blocking the main
-  thread.
-* `NSPredicate`'s `SUBQUERY` operator is now supported. It has the following limitations:
-  * `@count` is the only operator that may be applied to the `SUBQUERY` expression.
-  * The `SUBQUERY(…).@count` expression must be compared with a constant.
-  * Correlated subqueries are not yet supported.
-
-### Bugfixes
-
-* None.
-
-0.97.1 Release notes (2016-01-29)
-=============================================================
-
-### API breaking changes
-
-* None.
-
-### Enhancements
-
-* Swift: Added `Error` enum allowing to catch errors e.g. thrown on initializing
-  `RLMRealm`/`Realm` instances.
-* Fail with `RLMErrorFileNotFound` instead of the more generic `RLMErrorFileAccess`,
-  if no file was found when a realm was opened as read-only or if the directory part
-  of the specified path was not found when a copy should be written.
-* Greatly improve performance when deleting objects with one or more indexed
-  properties.
-* Indexing `BOOL`/`Bool` and `NSDate` properties are now supported.
-* Swift: Add support for indexing optional properties.
-
-### Bugfixes
-
-* Fix incorrect results or crashes when using `-[RLMResults setValue:forKey:]`
-  on an RLMResults which was filtered on the key being set.
-* Fix crashes when an RLMRealm is deallocated from the wrong thread.
-* Fix incorrect results from aggregate methods on `Results`/`RLMResults` after
-  objects which were previously in the results are deleted.
-* Fix a crash when adding a new property to an existing class with over a
-  million objects in the Realm.
-* Fix errors when opening encrypted Realm files created with writeCopyToPath.
-* Fix crashes or incorrect results for queries that use relationship equality
-  in cases where the `RLMResults` is kept alive and instances of the target class
-  of the relationship are deleted.
-
-0.97.0 Release notes (2015-12-17)
-=============================================================
-
-### API breaking changes
-
-* All functionality deprecated in previous releases has been removed entirely.
-* Add generic type annotations to NSArrays and NSDictionaries in public APIs.
-* Adding a Realm notification block on a thread not currently running from
-  within a run loop throws an exception rather than silently never calling the
-  notification block.
-
-### Enhancements
-
-* Support for tvOS.
-* Support for building Realm Swift from source when using Carthage.
-* The block parameter of `-[RLMRealm transactionWithBlock:]`/`Realm.write(_:)` is
-  now marked as `__attribute__((noescape))`/`@noescape`.
-* Many forms of queries with key paths on both sides of the comparison operator
-  are now supported.
-* Add support for KVC collection operators in `RLMResults` and `RLMArray`.
-* Fail instead of deadlocking in `+[RLMRealm sharedSchema]`, if a Swift property is initialized
-  to a computed value, which attempts to open a Realm on its own.
-
-### Bugfixes
-
-* Fix poor performance when calling `-[RLMRealm deleteObjects:]` on an
-  `RLMResults` which filtered the objects when there are other classes linking
-  to the type of the deleted objects.
-* An exception is now thrown when defining `Object` properties of an unsupported
-  type.
-
-0.96.3 Release notes (2015-12-04)
-=============================================================
-
-### Enhancements
-
-* Queries are no longer limited to 16 levels of grouping.
-* Rework the implementation of encrypted Realms to no longer interfere with
-  debuggers.
-
-### Bugfixes
-
-* Fix crash when trying to retrieve object instances via `dynamicObjects`.
-* Throw an exception when querying on a link providing objects, which are from a different Realm.
-* Return empty results when querying on a link providing an unattached object.
-* Fix crashes or incorrect results when calling `-[RLMRealm refresh]` during
-  fast enumeration.
-* Add `Int8` support for `RealmOptional`, `MinMaxType` and `AddableType`.
-* Set the default value for newly added non-optional NSData properties to a
-  zero-byte NSData rather than nil.
-* Fix a potential crash when deleting all objects of a class.
-* Fix performance problems when creating large numbers of objects with
-  `RLMArray`/`List` properties.
-* Fix memory leak when using Object(value:) for subclasses with
-  `List` or `RealmOptional` properties.
-* Fix a crash when computing the average of an optional integer property.
-* Fix incorrect search results for some queries on integer properties.
-* Add error-checking for nil realm parameters in many methods such as
-  `+[RLMObject allObjectsInRealm:]`.
-* Fix a race condition between commits and opening Realm files on new threads
-  that could lead to a crash.
-* Fix several crashes when opening Realm files.
-* `-[RLMObject createInRealm:withValue:]`, `-[RLMObject createOrUpdateInRealm:withValue:]`, and
-  their variants for the default Realm now always match the contents of an `NSArray` against properties
-  in the same order as they are defined in the model.
-
-0.96.2 Release notes (2015-10-26)
-=============================================================
-
-Prebuilt frameworks are now built with Xcode 7.1.
-
-### Bugfixes
-
-* Fix ignoring optional properties in Swift.
-* Fix CocoaPods installation on case-sensitive file systems.
-
-0.96.1 Release notes (2015-10-20)
-=============================================================
-
-### Bugfixes
-
-* Support assigning `Results` to `List` properties via KVC.
-* Honor the schema version set in the configuration in `+[RLMRealm migrateRealm:]`.
-* Fix crash when using optional Int16/Int32/Int64 properties in Swift.
-
-0.96.0 Release notes (2015-10-14)
-=============================================================
-
-* No functional changes since beta2.
-
-0.96.0-beta2 Release notes (2015-10-08)
-=============================================================
-
-### Bugfixes
-
-* Add RLMOptionalBase.h to the podspec.
-
-0.96.0-beta Release notes (2015-10-07)
-=============================================================
-
-### API breaking changes
-
-* CocoaPods v0.38 or greater is now required to install Realm and RealmSwift
-  as pods.
-
-### Enhancements
-
-* Functionality common to both `List` and `Results` is now declared in a
-  `RealmCollectionType` protocol that both types conform to.
-* `Results.realm` now returns an `Optional<Realm>` in order to conform to
-  `RealmCollectionType`, but will always return `.Some()` since a `Results`
-  cannot exist independently from a `Realm`.
-* Aggregate operations are now available on `List`: `min`, `max`, `sum`,
-  `average`.
-* Committing write transactions (via `commitWrite` / `commitWriteTransaction` and
-  `write` / `transactionWithBlock`) now optionally allow for handling errors when
-  the disk is out of space.
-* Added `isEmpty` property on `RLMRealm`/`Realm` to indicate if it contains any
-  objects.
-* The `@count`, `@min`, `@max`, `@sum` and `@avg` collection operators are now
-  supported in queries.
-
-### Bugfixes
-
-* Fix assertion failure when inserting NSData between 8MB and 16MB in size.
-* Fix assertion failure when rolling back a migration which removed an object
-  link or `RLMArray`/`List` property.
-* Add the path of the file being opened to file open errors.
-* Fix a crash that could be triggered by rapidly opening and closing a Realm
-  many times on multiple threads at once.
-* Fix several places where exception messages included the name of the wrong
-  function which failed.
-
-0.95.3 Release notes (2015-10-05)
-=============================================================
-
-### Bugfixes
-
-* Compile iOS Simulator framework architectures with `-fembed-bitcode-marker`.
-* Fix crashes when the first Realm opened uses a class subset and later Realms
-  opened do not.
-* Fix inconsistent errors when `Object(value: ...)` is used to initialize the
-  default value of a property of an `Object` subclass.
-* Throw an exception when a class subset has objects with array or object
-  properties of a type that are not part of the class subset.
-
-0.95.2 Release notes (2015-09-24)
-=============================================================
-
-* Enable bitcode for iOS and watchOS frameworks.
-* Build libraries with Xcode 7 final rather than the GM.
-
-0.95.1 Release notes (2015-09-23)
-=============================================================
-
-### Enhancements
-
-* Add missing KVO handling for moving and exchanging objects in `RLMArray` and
-  `List`.
-
-### Bugfixes
-
-* Setting the primary key property on persisted `RLMObject`s / `Object`s
-  via subscripting or key-value coding will cause an exception to be thrown.
-* Fix crash due to race condition in `RLMRealmConfiguration` where the default
-  configuration was in the process of being copied in one thread, while
-  released in another.
-* Fix crash when a migration which removed an object or array property is
-  rolled back due to an error.
-
-0.95.0 Release notes (2015-08-25)
-=============================================================
-
-### API breaking changes
-
-* The following APIs have been deprecated in favor of the new `RLMRealmConfiguration` class in Realm Objective-C:
-
-| Deprecated API                                                    | New API                                                                          |
-|:------------------------------------------------------------------|:---------------------------------------------------------------------------------|
-| `+[RLMRealm realmWithPath:readOnly:error:]`                       | `+[RLMRealm realmWithConfiguration:error:]`                                      |
-| `+[RLMRealm realmWithPath:encryptionKey:readOnly:error:]`         | `+[RLMRealm realmWithConfiguration:error:]`                                      |
-| `+[RLMRealm setEncryptionKey:forRealmsAtPath:]`                   | `-[RLMRealmConfiguration setEncryptionKey:]`                                     |
-| `+[RLMRealm inMemoryRealmWithIdentifier:]`                        | `+[RLMRealm realmWithConfiguration:error:]`                                      |
-| `+[RLMRealm defaultRealmPath]`                                    | `+[RLMRealmConfiguration defaultConfiguration]`                                  |
-| `+[RLMRealm setDefaultRealmPath:]`                                | `+[RLMRealmConfiguration setDefaultConfiguration:]`                              |
-| `+[RLMRealm setDefaultRealmSchemaVersion:withMigrationBlock]`     | `RLMRealmConfiguration.schemaVersion` and `RLMRealmConfiguration.migrationBlock` |
-| `+[RLMRealm setSchemaVersion:forRealmAtPath:withMigrationBlock:]` | `RLMRealmConfiguration.schemaVersion` and `RLMRealmConfiguration.migrationBlock` |
-| `+[RLMRealm migrateRealmAtPath:]`                                 | `+[RLMRealm migrateRealm:]`                                                      |
-| `+[RLMRealm migrateRealmAtPath:encryptionKey:]`                   | `+[RLMRealm migrateRealm:]`                                                      |
-
-* The following APIs have been deprecated in favor of the new `Realm.Configuration` struct in Realm Swift for Swift 1.2:
-
-| Deprecated API                                                | New API                                                                      |
-|:--------------------------------------------------------------|:-----------------------------------------------------------------------------|
-| `Realm.defaultPath`                                           | `Realm.Configuration.defaultConfiguration`                                   |
-| `Realm(path:readOnly:encryptionKey:error:)`                   | `Realm(configuration:error:)`                                                |
-| `Realm(inMemoryIdentifier:)`                                  | `Realm(configuration:error:)`                                                |
-| `Realm.setEncryptionKey(:forPath:)`                           | `Realm(configuration:error:)`                                                |
-| `setDefaultRealmSchemaVersion(schemaVersion:migrationBlock:)` | `Realm.Configuration.schemaVersion` and `Realm.Configuration.migrationBlock` |
-| `setSchemaVersion(schemaVersion:realmPath:migrationBlock:)`   | `Realm.Configuration.schemaVersion` and `Realm.Configuration.migrationBlock` |
-| `migrateRealm(path:encryptionKey:)`                           | `migrateRealm(configuration:)`                                               |
-
-* The following APIs have been deprecated in favor of the new `Realm.Configuration` struct in Realm Swift for Swift 2.0:
-
-| Deprecated API                                                | New API                                                                      |
-|:--------------------------------------------------------------|:-----------------------------------------------------------------------------|
-| `Realm.defaultPath`                                           | `Realm.Configuration.defaultConfiguration`                                   |
-| `Realm(path:readOnly:encryptionKey:) throws`                  | `Realm(configuration:) throws`                                               |
-| `Realm(inMemoryIdentifier:)`                                  | `Realm(configuration:) throws`                                               |
-| `Realm.setEncryptionKey(:forPath:)`                           | `Realm(configuration:) throws`                                               |
-| `setDefaultRealmSchemaVersion(schemaVersion:migrationBlock:)` | `Realm.Configuration.schemaVersion` and `Realm.Configuration.migrationBlock` |
-| `setSchemaVersion(schemaVersion:realmPath:migrationBlock:)`   | `Realm.Configuration.schemaVersion` and `Realm.Configuration.migrationBlock` |
-| `migrateRealm(path:encryptionKey:)`                           | `migrateRealm(configuration:)`                                               |
-
-* `List.extend` in Realm Swift for Swift 2.0 has been replaced with `List.appendContentsOf`,
-  mirroring changes to `RangeReplaceableCollectionType`.
-
-* Object properties on `Object` subclasses in Realm Swift must be marked as optional,
-  otherwise a runtime exception will be thrown.
-
-### Enhancements
-
-* Persisted properties of `RLMObject`/`Object` subclasses are now Key-Value
-  Observing compliant.
-* The different options used to create Realm instances have been consolidated
-  into a single `RLMRealmConfiguration`/`Realm.Configuration` object.
-* Enumerating Realm collections (`RLMArray`, `RLMResults`, `List<>`,
-  `Results<>`) now enumerates over a copy of the collection, making it no
-  longer an error to modify a collection during enumeration (either directly,
-  or indirectly by modifying objects to make them no longer match a query).
-* Improve performance of object insertion in Swift to bring it roughly in line
-  with Objective-C.
-* Allow specifying a specific list of `RLMObject` / `Object` subclasses to include
-  in a given Realm via `RLMRealmConfiguration.objectClasses` / `Realm.Configuration.objectTypes`.
-
-### Bugfixes
-
-* Subscripting on `RLMObject` is now marked as nullable.
-
-0.94.1 Release notes (2015-08-10)
-=============================================================
-
-### API breaking changes
-
-* Building for watchOS requires Xcode 7 beta 5.
-
-### Enhancements
-
-* `Object.className` is now marked as `final`.
-
-### Bugfixes
-
-* Fix crash when adding a property to a model without updating the schema
-  version.
-* Fix unnecessary redownloading of the core library when building from source.
-* Fix crash when sorting by an integer or floating-point property on iOS 7.
-
-0.94.0 Release notes (2015-07-29)
-=============================================================
-
-### API breaking changes
-
-* None.
-
-### Enhancements
-
-* Reduce the amount of memory used by RLMRealm notification listener threads.
-* Avoid evaluating results eagerly when filtering and sorting.
-* Add nullability annotations to the Objective-C API to provide enhanced compiler
-  warnings and bridging to Swift.
-* Make `RLMResult`s and `RLMArray`s support Objective-C generics.
-* Add support for building watchOS and bitcode-compatible apps.
-* Make the exceptions thrown in getters and setters more informative.
-* Add `-[RLMArray exchangeObjectAtIndex:withObjectAtIndex]` and `List.swap(_:_:)`
-  to allow exchanging the location of two objects in the given `RLMArray` / `List`.
-* Added anonymous analytics on simulator/debugger runs.
-* Add `-[RLMArray moveObjectAtIndex:toIndex:]` and `List.move(from:to:)` to
-  allow moving objects in the given `RLMArray` / `List`.
-
-### Bugfixes
-
-* Processes crashing due to an uncaught exception inside a write transaction will
-  no longer cause other processes using the same Realm to hang indefinitely.
-* Fix incorrect results when querying for < or <= on ints that
-  require 64 bits to represent with a CPU that supports SSE 4.2.
-* An exception will no longer be thrown when attempting to reset the schema
-  version or encryption key on an open Realm to the current value.
-* Date properties on 32 bit devices will retain 64 bit second precision.
-* Wrap calls to the block passed to `enumerate` in an autoreleasepool to reduce
-  memory growth when migrating a large amount of objects.
-* In-memory realms no longer write to the Documents directory on iOS or
-  Application Support on OS X.
-
-0.93.2 Release notes (2015-06-12)
-=============================================================
-
-### Bugfixes
-
-* Fixed an issue where the packaged OS X Realm.framework was built with
-  `GCC_GENERATE_TEST_COVERAGE_FILES` and `GCC_INSTRUMENT_PROGRAM_FLOW_ARCS`
-  enabled.
-* Fix a memory leak when constructing standalone Swift objects with NSDate
-  properties.
-* Throw an exception rather than asserting when an invalidated object is added
-  to an RLMArray.
-* Fix a case where data loss would occur if a device was hard-powered-off
-  shortly after a write transaction was committed which had to expand the Realm
-  file.
-
-0.93.1 Release notes (2015-05-29)
-=============================================================
-
-### Bugfixes
-
-* Objects are no longer copied into standalone objects during object creation. This fixes an issue where
-  nested objects with a primary key are sometimes duplicated rather than updated.
-* Comparison predicates with a constant on the left of the operator and key path on the right now give
-  correct results. An exception is now thrown for predicates that do not yet support this ordering.
-* Fix some crashes in `index_string.cpp` with int primary keys or indexed int properties.
-
-0.93.0 Release notes (2015-05-27)
-=============================================================
-
-### API breaking changes
-
-* Schema versions are now represented as `uint64_t` (Objective-C) and `UInt64` (Swift) so that they have
-  the same representation on all architectures.
-
-### Enhancements
-
-* Swift: `Results` now conforms to `CVarArgType` so it can
-  now be passed as an argument to `Results.filter(_:...)`
-  and `List.filter(_:...)`.
-* Swift: Made `SortDescriptor` conform to the `Equatable` and
-  `StringLiteralConvertible` protocols.
-* Int primary keys are once again automatically indexed.
-* Improve error reporting when attempting to mark a property of a type that
-  cannot be indexed as indexed.
-
-### Bugfixes
-
-* Swift: `RealmSwift.framework` no longer embeds `Realm.framework`,
-  which now allows apps using it to pass iTunes Connect validation.
-
-0.92.4 Release notes (2015-05-22)
-=============================================================
-
-### API breaking changes
-
-* None.
-
-### Enhancements
-
-* Swift: Made `Object.init()` a required initializer.
-* `RLMObject`, `RLMResults`, `Object` and `Results` can now be safely
-  deallocated (but still not used) from any thread.
-* Improve performance of `-[RLMArray indexOfObjectWhere:]` and `-[RLMArray
-  indexOfObjectWithPredicate:]`, and implement them for standalone RLMArrays.
-* Improved performance of most simple queries.
-
-### Bugfixes
-
-* The interprocess notification mechanism no longer uses dispatch worker threads, preventing it from
-  starving other GCD clients of the opportunity to execute blocks when dozens of Realms are open at once.
-
-0.92.3 Release notes (2015-05-13)
-=============================================================
-
-### API breaking changes
-
-* Swift: `Results.average(_:)` now returns an optional, which is `nil` if and only if the results
-  set is empty.
-
-### Enhancements
-
-* Swift: Added `List.invalidated`, which returns if the given `List` is no longer
-  safe to be accessed, and is analogous to `-[RLMArray isInvalidated]`.
-* Assertion messages are automatically logged to Crashlytics if it's loaded
-  into the current process to make it easier to diagnose crashes.
-
-### Bugfixes
-
-* Swift: Enumerating through a standalone `List` whose objects themselves
-  have list properties won't crash.
-* Swift: Using a subclass of `RealmSwift.Object` in an aggregate operator of a predicate
-  no longer throws a spurious type error.
-* Fix incorrect results for when using OR in a query on a `RLMArray`/`List<>`.
-* Fix incorrect values from `[RLMResults count]`/`Results.count` when using
-  `!=` on an int property with no other query conditions.
-* Lower the maximum doubling threshold for Realm file sizes from 128MB to 16MB
-  to reduce the amount of wasted space.
-
-0.92.2 Release notes (2015-05-08)
-=============================================================
-
-### API breaking changes
-
-* None.
-
-### Enhancements
-
-* Exceptions raised when incorrect object types are used with predicates now contain more detailed information.
-* Added `-[RLMMigration deleteDataForClassName:]` and `Migration.deleteData(_:)`
-  to enable cleaning up after removing object subclasses
-
-### Bugfixes
-
-* Prevent debugging of an application using an encrypted Realm to work around
-  frequent LLDB hangs. Until the underlying issue is addressed you may set
-  REALM_DISABLE_ENCRYPTION=YES in your application's environment variables to
-  have requests to open an encrypted Realm treated as a request for an
-  unencrypted Realm.
-* Linked objects are properly updated in `createOrUpdateInRealm:withValue:`.
-* List properties on Objects are now properly initialized during fast enumeration.
-
-0.92.1 Release notes (2015-05-06)
-=============================================================
-
-### API breaking changes
-
-* None.
-
-### Enhancements
-
-* `-[RLMRealm inWriteTransaction]` is now public.
-* Realm Swift is now available on CoocaPods.
-
-### Bugfixes
-
-* Force code re-signing after stripping architectures in `strip-frameworks.sh`.
-
-0.92.0 Release notes (2015-05-05)
-=============================================================
-
-### API breaking changes
-
-* Migration blocks are no longer called when a Realm file is first created.
-* The following APIs have been deprecated in favor of newer method names:
-
-| Deprecated API                                         | New API                                               |
-|:-------------------------------------------------------|:------------------------------------------------------|
-| `-[RLMMigration createObject:withObject:]`             | `-[RLMMigration createObject:withValue:]`             |
-| `-[RLMObject initWithObject:]`                         | `-[RLMObject initWithValue:]`                         |
-| `+[RLMObject createInDefaultRealmWithObject:]`         | `+[RLMObject createInDefaultRealmWithValue:]`         |
-| `+[RLMObject createInRealm:withObject:]`               | `+[RLMObject createInRealm:withValue:]`               |
-| `+[RLMObject createOrUpdateInDefaultRealmWithObject:]` | `+[RLMObject createOrUpdateInDefaultRealmWithValue:]` |
-| `+[RLMObject createOrUpdateInRealm:withObject:]`       | `+[RLMObject createOrUpdateInRealm:withValue:]`       |
-
-### Enhancements
-
-* `Int8` properties defined in Swift are now treated as integers, rather than
-  booleans.
-* NSPredicates created using `+predicateWithValue:` are now supported.
-
-### Bugfixes
-
-* Compound AND predicates with no subpredicates now correctly match all objects.
-
-0.91.5 Release notes (2015-04-28)
-=============================================================
-
-### Bugfixes
-
-* Fix issues with removing search indexes and re-enable it.
-
-0.91.4 Release notes (2015-04-27)
-=============================================================
-
-### Bugfixes
-
-* Temporarily disable removing indexes from existing columns due to bugs.
-
-0.91.3 Release notes (2015-04-17)
-=============================================================
-
-### Bugfixes
-
-* Fix `Extra argument 'objectClassName' in call` errors when building via
-  CocoaPods.
-
-0.91.2 Release notes (2015-04-16)
-=============================================================
-
-* Migration blocks are no longer called when a Realm file is first created.
-
-### Enhancements
-
-* `RLMCollection` supports collection KVC operations.
-* Sorting `RLMResults` is 2-5x faster (typically closer to 2x).
-* Refreshing `RLMRealm` after a write transaction which inserts or modifies
-  strings or `NSData` is committed on another thread is significantly faster.
-* Indexes are now added and removed from existing properties when a Realm file
-  is opened, rather than only when properties are first added.
-
-### Bugfixes
-
-* `+[RLMSchema dynamicSchemaForRealm:]` now respects search indexes.
-* `+[RLMProperty isEqualToProperty:]` now checks for equal `indexed` properties.
-
-0.91.1 Release notes (2015-03-12)
-=============================================================
-
-### Enhancements
-
-* The browser will automatically refresh when the Realm has been modified
-  from another process.
-* Allow using Realm in an embedded framework by setting
-  `APPLICATION_EXTENSION_API_ONLY` to YES.
-
-### Bugfixes
-
-* Fix a crash in CFRunLoopSourceInvalidate.
-
-0.91.0 Release notes (2015-03-10)
-=============================================================
-
-### API breaking changes
-
-* `attributesForProperty:` has been removed from `RLMObject`. You now specify indexed
-  properties by implementing the `indexedProperties` method.
-* An exception will be thrown when calling `setEncryptionKey:forRealmsAtPath:`,
-  `setSchemaVersion:forRealmAtPath:withMigrationBlock:`, and `migrateRealmAtPath:`
-  when a Realm at the given path is already open.
-* Object and array properties of type `RLMObject` will no longer be allowed.
-
-### Enhancements
-
-* Add support for sharing Realm files between processes.
-* The browser will no longer show objects that have no persisted properties.
-* `RLMSchema`, `RLMObjectSchema`, and `RLMProperty` now have more useful descriptions.
-* Opening an encrypted Realm while a debugger is attached to the process no
-  longer throws an exception.
-* `RLMArray` now exposes an `isInvalidated` property to indicate if it can no
-  longer be accessed.
-
-### Bugfixes
-
-* An exception will now be thrown when calling `-beginWriteTransaction` from within a notification
-  triggered by calling `-beginWriteTransaction` elsewhere.
-* When calling `delete:` we now verify that the object being deleted is persisted in the target Realm.
-* Fix crash when calling `createOrUpdate:inRealm` with nested linked objects.
-* Use the key from `+[RLMRealm setEncryptionKey:forRealmsAtPath:]` in
-  `-writeCopyToPath:error:` and `+migrateRealmAtPath:`.
-* Comparing an RLMObject to a non-RLMObject using `-[RLMObject isEqual:]` or
-  `-isEqualToObject:` now returns NO instead of crashing.
-* Improved error message when an `RLMObject` subclass is defined nested within
-  another Swift declaration.
-* Fix crash when the process is terminated by the OS on iOS while encrypted realms are open.
-* Fix crash after large commits to encrypted realms.
-
-0.90.6 Release notes (2015-02-20)
-=============================================================
-
-### Enhancements
-
-* Improve compatiblity of encrypted Realms with third-party crash reporters.
-
-### Bugfixes
-
-* Fix incorrect results when using aggregate functions on sorted RLMResults.
-* Fix data corruption when using writeCopyToPath:encryptionKey:.
-* Maybe fix some assertion failures.
-
-0.90.5 Release notes (2015-02-04)
-=============================================================
-
-### Bugfixes
-
-* Fix for crashes when encryption is enabled on 64-bit iOS devices.
-
-0.90.4 Release notes (2015-01-29)
-=============================================================
-
-### Bugfixes
-
-* Fix bug that resulted in columns being dropped and recreated during migrations.
-
-0.90.3 Release notes (2015-01-27)
-=============================================================
-
-### Enhancements
-
-* Calling `createInDefaultRealmWithObject:`, `createInRealm:withObject:`,
-  `createOrUpdateInDefaultRealmWithObject:` or `createOrUpdateInRealm:withObject:`
-  is a no-op if the argument is an RLMObject of the same type as the receiver
-  and is already backed by the target realm.
-
-### Bugfixes
-
-* Fix incorrect column type assertions when the first Realm file opened is a
-  read-only file that is missing tables.
-* Throw an exception when adding an invalidated or deleted object as a link.
-* Throw an exception when calling `createOrUpdateInRealm:withObject:` when the
-  receiver has no primary key defined.
-
-0.90.1 Release notes (2015-01-22)
-=============================================================
-
-### Bugfixes
-
-* Fix for RLMObject being treated as a model object class and showing up in the browser.
-* Fix compilation from the podspec.
-* Fix for crash when calling `objectsWhere:` with grouping in the query on `allObjects`.
-
-0.90.0 Release notes (2015-01-21)
-=============================================================
-
-### API breaking changes
-
-* Rename `-[RLMRealm encryptedRealmWithPath:key:readOnly:error:]` to
-  `-[RLMRealm realmWithPath:encryptionKey:readOnly:error:]`.
-* `-[RLMRealm setSchemaVersion:withMigrationBlock]` is no longer global and must be called
-  for each individual Realm path used. You can now call `-[RLMRealm setDefaultRealmSchemaVersion:withMigrationBlock]`
-  for the default Realm and `-[RLMRealm setSchemaVersion:forRealmAtPath:withMigrationBlock:]` for all others;
-
-### Enhancements
-
-* Add `-[RLMRealm writeCopyToPath:encryptionKey:error:]`.
-* Add support for comparing string columns to other string columns in queries.
-
-### Bugfixes
-
-* Roll back changes made when an exception is thrown during a migration.
-* Throw an exception if the number of items in a RLMResults or RLMArray changes
-  while it's being fast-enumerated.
-* Also encrypt the temporary files used when encryption is enabled for a Realm.
-* Fixed crash in JSONImport example on OS X with non-en_US locale.
-* Fixed infinite loop when opening a Realm file in the Browser at the same time
-  as it is open in a 32-bit simulator.
-* Fixed a crash when adding primary keys to older realm files with no primary
-  keys on any objects.
-* Fixed a crash when removing a primary key in a migration.
-* Fixed a crash when multiple write transactions with no changes followed by a
-  write transaction with changes were committed without the main thread
-  RLMRealm getting a chance to refresh.
-* Fixed incomplete results when querying for non-null relationships.
-* Improve the error message when a Realm file is opened in multiple processes
-  at once.
-
-0.89.2 Release notes (2015-01-02)
-=============================================================
-
-### API breaking changes
-
-* None.
-
-### Enhancements
-
-* None.
-
-### Bugfixes
-
-* Fix an assertion failure when invalidating a Realm which is in a write
-  transaction, has already been invalidated, or has never been used.
-* Fix an assertion failure when sorting an empty RLMArray property.
-* Fix a bug resulting in the browser never becoming visible on 10.9.
-* Write UTF-8 when generating class files from a realm file in the Browser.
-
-0.89.1 Release notes (2014-12-22)
-=============================================================
-
-### API breaking changes
-
-* None.
-
-### Enhancements
-
-* Improve the error message when a Realm can't be opened due to lacking write
-  permissions.
-
-### Bugfixes
-
-* Fix an assertion failure when inserting rows after calling `deleteAllObjects`
-  on a Realm.
-* Separate dynamic frameworks are now built for the simulator and devices to
-  work around App Store submission errors due to the simulator version not
-  being automatically stripped from dynamic libraries.
-
-0.89.0 Release notes (2014-12-18)
-=============================================================
-
-### API breaking changes
-
-* None.
-
-### Enhancements
-
-* Add support for encrypting Realm files on disk.
-* Support using KVC-compliant objects without getters or with custom getter
-  names to initialize RLMObjects with `createObjectInRealm` and friends.
-
-### Bugfixes
-
-* Merge native Swift default property values with defaultPropertyValues().
-* Don't leave the database schema partially updated when opening a realm fails
-  due to a migration being needed.
-* Fixed issue where objects with custom getter names couldn't be used to
-  initialize other objects.
-* Fix a major performance regression on queries on string properties.
-* Fix a memory leak when circularly linked objects are added to a Realm.
-
-0.88.0 Release notes (2014-12-02)
-=============================================================
-
-### API breaking changes
-
-* Deallocating an RLMRealm instance in a write transaction lacking an explicit
-  commit/cancel will now be automatically cancelled instead of committed.
-* `-[RLMObject isDeletedFromRealm]` has been renamed to `-[RLMObject isInvalidated]`.
-
-### Enhancements
-
-* Add `-[RLMRealm writeCopyToPath:]` to write a compacted copy of the Realm
-  another file.
-* Add support for case insensitive, BEGINSWITH, ENDSWITH and CONTAINS string
-  queries on array properties.
-* Make fast enumeration of `RLMArray` and `RLMResults` ~30% faster and
-  `objectAtIndex:` ~55% faster.
-* Added a lldb visualizer script for displaying the contents of persisted
-  RLMObjects when debugging.
-* Added method `-setDefaultRealmPath:` to change the default Realm path.
-* Add `-[RLMRealm invalidate]` to release data locked by the current thread.
-
-### Bugfixes
-
-* Fix for crash when running many simultaneous write transactions on background threads.
-* Fix for crashes caused by opening Realms at multiple paths simultaneously which have had
-  properties re-ordered during migration.
-* Don't run the query twice when `firstObject` or `lastObject` are called on an
-  `RLMResults` which has not had its results accessed already.
-* Fix for bug where schema version is 0 for new Realm created at the latest version.
-* Fix for error message where no migration block is specified when required.
-
-0.87.4 Release notes (2014-11-07)
-=============================================================
-
-### API breaking changes
-
-* None.
-
-### Enhancements
-
-* None.
-
-### Bugfixes
-
-* Fix browser location in release zip.
-
-0.87.3 Release notes (2014-11-06)
-=============================================================
-
-### API breaking changes
-
-* None.
-
-### Enhancements
-
-* Added method `-linkingObjectsOfClass:forProperty:` to RLMObject to expose inverse
-  relationships/backlinks.
-
-### Bugfixes
-
-* Fix for crash due to missing search index when migrating an object with a string primary key
-  in a database created using an older versions (0.86.3 and earlier).
-* Throw an exception when passing an array containing a
-  non-RLMObject to -[RLMRealm addObjects:].
-* Fix for crash when deleting an object from multiple threads.
-
-0.87.0 Release notes (2014-10-21)
-=============================================================
-
-### API breaking changes
-
-* RLMArray has been split into two classes, `RLMArray` and `RLMResults`. RLMArray is
-  used for object properties as in previous releases. Moving forward all methods used to
-  enumerate, query, and sort objects return an instance of a new class `RLMResults`. This
-  change was made to support diverging apis and the future addition of change notifications
-  for queries.
-* The api for migrations has changed. You now call `setSchemaVersion:withMigrationBlock:` to
-  register a global migration block and associated version. This block is applied to Realms as
-  needed when opened for Realms at a previous version. The block can be applied manually if
-  desired by calling `migrateRealmAtPath:`.
-* `arraySortedByProperty:ascending:` was renamed to `sortedResultsUsingProperty:ascending`
-* `addObjectsFromArray:` on both `RLMRealm` and `RLMArray` has been renamed to `addObjects:`
-  and now accepts any container class which implements `NSFastEnumeration`
-* Building with Swift support now requires Xcode 6.1
-
-### Enhancements
-
-* Add support for sorting `RLMArray`s by multiple columns with `sortedResultsUsingDescriptors:`
-* Added method `deleteAllObjects` on `RLMRealm` to clear a Realm.
-* Added method `createObject:withObject:` on `RLMMigration` which allows object creation during migrations.
-* Added method `deleteObject:` on `RLMMigration` which allows object deletion during migrations.
-* Updating to core library version 0.85.0.
-* Implement `objectsWhere:` and `objectsWithPredicate:` for array properties.
-* Add `cancelWriteTransaction` to revert all changes made in a write transaction and end the transaction.
-* Make creating `RLMRealm` instances on background threads when an instance
-  exists on another thread take a fifth of the time.
-* Support for partial updates when calling `createOrUpdateWithObject:` and `addOrUpdateObject:`
-* Re-enable Swift support on OS X
-
-### Bugfixes
-
-* Fix exceptions when trying to set `RLMObject` properties after rearranging
-  the properties in a `RLMObject` subclass.
-* Fix crash on IN query with several thousand items.
-* Fix crash when querying indexed `NSString` properties.
-* Fixed an issue which prevented in-memory Realms from being used accross multiple threads.
-* Preserve the sort order when querying a sorted `RLMResults`.
-* Fixed an issue with migrations where if a Realm file is deleted after a Realm is initialized,
-  the newly created Realm can be initialized with an incorrect schema version.
-* Fix crash in `RLMSuperSet` when assigning to a `RLMArray` property on a standalone object.
-* Add an error message when the protocol for an `RLMArray` property is not a
-  valid object type.
-* Add an error message when an `RLMObject` subclass is defined nested within
-  another Swift class.
-
-0.86.3 Release notes (2014-10-09)
-=============================================================
-
-### Enhancements
-
-* Add support for != in queries on object relationships.
-
-### Bugfixes
-
-* Re-adding an object to its Realm no longer throws an exception and is now a no-op
-  (as it was previously).
-* Fix another bug which would sometimes result in subclassing RLMObject
-  subclasses not working.
-
-0.86.2 Release notes (2014-10-06)
-=============================================================
-
-### Bugfixes
-
-* Fixed issues with packaging "Realm Browser.app" for release.
-
-0.86.1 Release notes (2014-10-03)
-=============================================================
-
-### Bugfixes
-
-* Fix a bug which would sometimes result in subclassing RLMObject subclasses
-  not working.
-
-0.86.0 Release notes (2014-10-03)
-=============================================================
-
-### API breaking changes
-
-* Xcode 6 is now supported from the main Xcode project `Realm.xcodeproj`.
-  Xcode 5 is no longer supported.
-
-### Enhancements
-
-* Support subclassing RLMObject models. Although you can now persist subclasses,
-  polymorphic behavior is not supported (i.e. setting a property to an
-  instance of its subclass).
-* Add support for sorting RLMArray properties.
-* Speed up inserting objects with `addObject:` by ~20%.
-* `readonly` properties are automatically ignored rather than having to be
-  added to `ignoredProperties`.
-* Updating to core library version 0.83.1.
-* Return "[deleted object]" rather than throwing an exception when
-  `-description` is called on a deleted RLMObject.
-* Significantly improve performance of very large queries.
-* Allow passing any enumerable to IN clauses rather than just NSArray.
-* Add `objectForPrimaryKey:` and `objectInRealm:forPrimaryKey:` convenience
-  methods to fetch an object by primary key.
-
-### Bugfixes
-
-* Fix error about not being able to persist property 'hash' with incompatible
-  type when building for devices with Xcode 6.
-* Fix spurious notifications of new versions of Realm.
-* Fix for updating nested objects where some types do not have primary keys.
-* Fix for inserting objects from JSON with NSNull values when default values
-  should be used.
-* Trying to add a persisted RLMObject to a different Realm now throws an
-  exception rather than creating an uninitialized object.
-* Fix validation errors when using IN on array properties.
-* Fix errors when an IN clause has zero items.
-* Fix for chained queries ignoring all but the last query's conditions.
-
-0.85.0 Release notes (2014-09-15)
-=============================================================
-
-### API breaking changes
-
-* Notifications for a refresh being needed (when autorefresh is off) now send
-  the notification type RLMRealmRefreshRequiredNotification rather than
-  RLMRealmDidChangeNotification.
-
-### Enhancements
-
-* Updating to core library version 0.83.0.
-* Support for primary key properties (for int and string columns). Declaring a property
-  to be the primary key ensures uniqueness for that property for all objects of a given type.
-  At the moment indexes on primary keys are not yet supported but this will be added in a future
-  release.
-* Added methods to update or insert (upsert) for objects with primary keys defined.
-* `[RLMObject initWithObject:]` and `[RLMObject createInRealmWithObject:]` now support
-  any object type with kvc properties.
-* The Swift support has been reworked to work around Swift not being supported
-  in Frameworks on iOS 7.
-* Improve performance when getting the count of items matching a query but not
-  reading any of the objects in the results.
-* Add a return value to `-[RLMRealm refresh]` that indicates whether or not
-  there was anything to refresh.
-* Add the class name to the error message when an RLMObject is missing a value
-  for a property without a default.
-* Add support for opening Realms in read-only mode.
-* Add an automatic check for updates when using Realm in a simulator (the
-  checker code is not compiled into device builds). This can be disabled by
-  setting the REALM_DISABLE_UPDATE_CHECKER environment variable to any value.
-* Add support for Int16 and Int64 properties in Swift classes.
-
-### Bugfixes
-
-* Realm change notifications when beginning a write transaction are now sent
-  after updating rather than before, to match refresh.
-* `-isEqual:` now uses the default `NSObject` implementation unless a primary key
-  is specified for an RLMObject. When a primary key is specified, `-isEqual:` calls
-  `-isEqualToObject:` and a corresponding implementation for `-hash` is also implemented.
-
-0.84.0 Release notes (2014-08-28)
-=============================================================
-
-### API breaking changes
-
-* The timer used to trigger notifications has been removed. Notifications are now
-  only triggered by commits made in other threads, and can not currently be triggered
-  by changes made by other processes. Interprocess notifications will be re-added in
-  a future commit with an improved design.
-
-### Enhancements
-
-* Updating to core library version 0.82.2.
-* Add property `deletedFromRealm` to RLMObject to indicate objects which have been deleted.
-* Add support for the IN operator in predicates.
-* Add support for the BETWEEN operator in link queries.
-* Add support for multi-level link queries in predicates (e.g. `foo.bar.baz = 5`).
-* Switch to building the SDK from source when using CocoaPods and add a
-  Realm.Headers subspec for use in targets that should not link a copy of Realm
-  (such as test targets).
-* Allow unregistering from change notifications in the change notification
-  handler block.
-* Significant performance improvements when holding onto large numbers of RLMObjects.
-* Realm-Xcode6.xcodeproj now only builds using Xcode6-Beta6.
-* Improved performance during RLMArray iteration, especially when mutating
-  contained objects.
-
-### Bugfixes
-
-* Fix crashes and assorted bugs when sorting or querying a RLMArray returned
-  from a query.
-* Notifications are no longer sent when initializing new RLMRealm instances on background
-  threads.
-* Handle object cycles in -[RLMObject description] and -[RLMArray description].
-* Lowered the deployment target for the Xcode 6 projects and Swift examples to
-  iOS 7.0, as they didn't actually require 8.0.
-* Support setting model properties starting with the letter 'z'
-* Fixed crashes that could result from switching between Debug and Relase
-  builds of Realm.
-
-0.83.0 Release notes (2014-08-13)
-=============================================================
-
-### API breaking changes
-
-* Realm-Xcode6.xcodeproj now only builds using Xcode6-Beta5.
-* Properties to be persisted in Swift classes must be explicitly declared as `dynamic`.
-* Subclasses of RLMObject subclasses now throw an exception on startup, rather
-  than when added to a Realm.
-
-### Enhancements
-
-* Add support for querying for nil object properties.
-* Improve error message when specifying invalid literals when creating or
-  initializing RLMObjects.
-* Throw an exception when an RLMObject is used from the incorrect thread rather
-  than crashing in confusing ways.
-* Speed up RLMRealm instantiation and array property iteration.
-* Allow array and objection relation properties to be missing or null when
-  creating a RLMObject from a NSDictionary.
-
-### Bugfixes
-
-* Fixed a memory leak when querying for objects.
-* Fixed initializing array properties on standalone Swift RLMObject subclasses.
-* Fix for queries on 64bit integers.
-
-0.82.0 Release notes (2014-08-05)
-=============================================================
-
-### API breaking changes
-
-* Realm-Xcode6.xcodeproj now only builds using Xcode6-Beta4.
-
-### Enhancements
-
-* Updating to core library version 0.80.5.
-* Now support disabling the `autorefresh` property on RLMRealm instances.
-* Building Realm-Xcode6 for iOS now builds a universal framework for Simulator & Device.
-* Using NSNumber properties (unsupported) now throws a more informative exception.
-* Added `[RLMRealm defaultRealmPath]`
-* Proper implementation for [RLMArray indexOfObjectWhere:]
-* The default Realm path on OS X is now ~/Library/Application Support/[bundle
-  identifier]/default.realm rather than ~/Documents
-* We now check that the correct framework (ios or osx) is used at compile time.
-
-### Bugfixes
-
-* Fixed rapid growth of the realm file size.
-* Fixed a bug which could cause a crash during RLMArray destruction after a query.
-* Fixed bug related to querying on float properties: `floatProperty = 1.7` now works.
-* Fixed potential bug related to the handling of array properties (RLMArray).
-* Fixed bug where array properties accessed the wrong property.
-* Fixed bug that prevented objects with custom getters to be added to a Realm.
-* Fixed a bug where initializing a standalone object with an array literal would
-  trigger an exception.
-* Clarified exception messages when using unsupported NSPredicate operators.
-* Clarified exception messages when using unsupported property types on RLMObject subclasses.
-* Fixed a memory leak when breaking out of a for-in loop on RLMArray.
-* Fixed a memory leak when removing objects from a RLMArray property.
-* Fixed a memory leak when querying for objects.
-
-
-0.81.0 Release notes (2014-07-22)
-=============================================================
-
-### API breaking changes
-
-* None.
-
-### Enhancements
-
-* Updating to core library version 0.80.3.
-* Added support for basic querying of RLMObject and RLMArray properties (one-to-one and one-to-many relationships).
-  e.g. `[Person objectsWhere:@"dog.name == 'Alfonso'"]` or `[Person objectsWhere:@"ANY dogs.name == 'Alfonso'"]`
-  Supports all normal operators for numeric and date types. Does not support NSData properties or `BEGINSWITH`, `ENDSWITH`, `CONTAINS`
-  and other options for string properties.
-* Added support for querying for object equality in RLMObject and RLMArray properties (one-to-one and one-to-many relationships).
-  e.g. `[Person objectsWhere:@"dog == %@", myDog]` `[Person objectsWhere:@"ANY dogs == %@", myDog]` `[Person objectsWhere:@"ANY friends.dog == %@", dog]`
-  Only supports comparing objects for equality (i.e. ==)
-* Added a helper method to RLMRealm to perform a block inside a transaction.
-* OSX framework now supported in CocoaPods.
-
-### Bugfixes
-
-* Fixed Unicode support in property names and string contents (Chinese, Russian, etc.). Closing #612 and #604.
-* Fixed bugs related to migration when properties are removed.
-* Fixed keyed subscripting for standalone RLMObjects.
-* Fixed bug related to double clicking on a .realm file to launch the Realm Browser (thanks to Dean Moore).
-
-
-0.80.0 Release notes (2014-07-15)
-=============================================================
-
-### API breaking changes
-
-* Rename migration methods to -migrateDefaultRealmWithBlock: and -migrateRealmAtPath:withBlock:
-* Moved Realm specific query methods from RLMRealm to class methods on RLMObject (-allObjects: to +allObjectsInRealm: ect.)
-
-### Enhancements
-
-* Added +createInDefaultRealmWithObject: method to RLMObject.
-* Added support for array and object literals when calling -createWithObject: and -initWithObject: variants.
-* Added method -deleteObjects: to batch delete objects from a Realm
-* Support for defining RLMObject models entirely in Swift (experimental, see known issues).
-* RLMArrays in Swift support Sequence-style enumeration (for obj in array).
-* Implemented -indexOfObject: for RLMArray
-
-### Known Issues for Swift-defined models
-
-* Properties other than String, NSData and NSDate require a default value in the model. This can be an empty (but typed) array for array properties.
-* The previous caveat also implies that not all models defined in Objective-C can be used for object properties. Only Objective-C models with only implicit (i.e. primitives) or explicit default values can be used. However, any Objective-C model object can be used in a Swift array property.
-* Array property accessors don't work until its parent object has been added to a realm.
-* Realm-Bridging-Header.h is temporarily exposed as a public header. This is temporary and will be private again once rdar://17633863 is fixed.
-* Does not leverage Swift generics and still uses RLM-prefix everywhere. This is coming in #549.
-
-
-0.22.0 Release notes
-=============================================================
-
-### API breaking changes
-
-* Rename schemaForObject: to schemaForClassName: on RLMSchema
-* Removed -objects:where: and -objects:orderedBy:where: from RLMRealm
-* Removed -indexOfObjectWhere:, -objectsWhere: and -objectsOrderedBy:where: from RLMArray
-* Removed +objectsWhere: and +objectsOrderedBy:where: from RLMObject
-
-### Enhancements
-
-* New Xcode 6 project for experimental swift support.
-* New Realm Editor app for reading and editing Realm db files.
-* Added support for migrations.
-* Added support for RLMArray properties on objects.
-* Added support for creating in-memory default Realm.
-* Added -objectsWithClassName:predicateFormat: and -objectsWithClassName:predicate: to RLMRealm
-* Added -indexOfObjectWithPredicateFormat:, -indexOfObjectWithPredicate:, -objectsWithPredicateFormat:, -objectsWithPredi
-* Added +objectsWithPredicateFormat: and +objectsWithPredicate: to RLMObject
-* Now allows predicates comparing two object properties of the same type.
-
-
-0.20.0 Release notes (2014-05-28)
-=============================================================
-
-Completely rewritten to be much more object oriented.
-
-### API breaking changes
-
-* Everything
-
-### Enhancements
-
-* None.
-
-### Bugfixes
-
-* None.
-
-
-0.11.0 Release notes (not released)
-=============================================================
-
-The Objective-C API has been updated and your code will break!
-
-### API breaking changes
-
-* `RLMTable` objects can only be created with an `RLMRealm` object.
-* Renamed `RLMContext` to `RLMTransactionManager`
-* Renamed `RLMContextDidChangeNotification` to `RLMRealmDidChangeNotification`
-* Renamed `contextWithDefaultPersistence` to `managerForDefaultRealm`
-* Renamed `contextPersistedAtPath:` to `managerForRealmWithPath:`
-* Renamed `realmWithDefaultPersistence` to `defaultRealm`
-* Renamed `realmWithDefaultPersistenceAndInitBlock` to `defaultRealmWithInitBlock`
-* Renamed `find:` to `firstWhere:`
-* Renamed `where:` to `allWhere:`
-* Renamed `where:orderBy:` to `allWhere:orderBy:`
-
-### Enhancements
-
-* Added `countWhere:` on `RLMTable`
-* Added `sumOfColumn:where:` on `RLMTable`
-* Added `averageOfColumn:where:` on `RLMTable`
-* Added `minOfProperty:where:` on `RLMTable`
-* Added `maxOfProperty:where:` on `RLMTable`
-* Added `toJSONString` on `RLMRealm`, `RLMTable` and `RLMView`
-* Added support for `NOT` operator in predicates
-* Added support for default values
-* Added validation support in `createInRealm:withObject:`
-
-### Bugfixes
-
-* None.
-
-
-0.10.0 Release notes (2014-04-23)
-=============================================================
-
-TightDB is now Realm! The Objective-C API has been updated
-and your code will break!
-
-### API breaking changes
-
-* All references to TightDB have been changed to Realm.
-* All prefixes changed from `TDB` to `RLM`.
-* `TDBTransaction` and `TDBSmartContext` have merged into `RLMRealm`.
-* Write transactions now take an optional rollback parameter (rather than needing to return a boolean).
-* `addColumnWithName:` and variant methods now return the index of the newly created column if successful, `NSNotFound` otherwise.
-
-### Enhancements
-
-* `createTableWithName:columns:` has been added to `RLMRealm`.
-* Added keyed subscripting for RLMTable's first column if column is of type RLMPropertyTypeString.
-* `setRow:atIndex:` has been added to `RLMTable`.
-* `RLMRealm` constructors now have variants that take an writable initialization block
-* New object interface - tables created/retrieved using `tableWithName:objectClass:` return custom objects
-
-### Bugfixes
-
-* None.
-
-
-0.6.0 Release notes (2014-04-11)
-=============================================================
-
-### API breaking changes
-
-* `contextWithPersistenceToFile:error:` renamed to `contextPersistedAtPath:error:` in `TDBContext`
-* `readWithBlock:` renamed to `readUsingBlock:` in `TDBContext`
-* `writeWithBlock:error:` renamed to `writeUsingBlock:error:` in `TDBContext`
-* `readTable:withBlock:` renamed to `readTable:usingBlock:` in `TDBContext`
-* `writeTable:withBlock:error:` renamed to `writeTable:usingBlock:error:` in `TDBContext`
-* `findFirstRow` renamed to `indexOfFirstMatchingRow` on `TDBQuery`.
-* `findFirstRowFromIndex:` renamed to `indexOfFirstMatchingRowFromIndex:` on `TDBQuery`.
-* Return `NSNotFound` instead of -1 when appropriate.
-* Renamed `castClass` to `castToTytpedTableClass` on `TDBTable`.
-* `removeAllRows`, `removeRowAtIndex`, `removeLastRow`, `addRow` and `insertRow` methods
-  on table now return void instead of BOOL.
-
-### Enhancements
-* A `TDBTable` can now be queried using `where:` and `where:orderBy:` taking
-  `NSPredicate` and `NSSortDescriptor` as arguments.
-* Added `find:` method on `TDBTable` to find first row matching predicate.
-* `contextWithDefaultPersistence` class method added to `TDBContext`. Will create a context persisted
-  to a file in app/documents folder.
-* `renameColumnWithIndex:to:` has been added to `TDBTable`.
-* `distinctValuesInColumnWithIndex` has been added to `TDBTable`.
-* `dateIsBetween::`, `doubleIsBetween::`, `floatIsBetween::` and `intIsBetween::`
-  have been added to `TDBQuery`.
-* Column names in Typed Tables can begin with non-capital letters too. The generated `addX`
-  selector can look odd. For example, a table with one column with name `age`,
-  appending a new row will look like `[table addage:7]`.
-* Mixed typed values are better validated when rows are added, inserted,
-  or modified as object literals.
-* `addRow`, `insertRow`, and row updates can be done using objects
-   derived from `NSObject`.
-* `where` has been added to `TDBView`and `TDBViewProtocol`.
-* Adding support for "smart" contexts (`TDBSmartContext`).
-
-### Bugfixes
-
-* Modifications of a `TDBView` and `TDBQuery` now throw an exception in a readtransaction.
-
-
-0.5.0 Release notes (2014-04-02)
-=============================================================
-
-The Objective-C API has been updated and your code will break!
-Of notable changes a fast interface has been added.
-This interface includes specific methods to get and set values into Tightdb.
-To use these methods import `<Tightdb/TightdbFast.h>`.
-
-### API breaking changes
-
-* `getTableWithName:` renamed to `tableWithName:` in `TDBTransaction`.
-* `addColumnWithName:andType:` renamed to `addColumnWithName:type:` in `TDBTable`.
-* `columnTypeOfColumn:` renamed to `columnTypeOfColumnWithIndex` in `TDBTable`.
-* `columnNameOfColumn:` renamed to `nameOfColumnWithIndex:` in `TDBTable`.
-* `addColumnWithName:andType:` renamed to `addColumnWithName:type:` in `TDBDescriptor`.
-* Fast getters and setters moved from `TDBRow.h` to `TDBRowFast.h`.
-
-### Enhancements
-
-* Added `minDateInColumnWithIndex` and `maxDateInColumnWithIndex` to `TDBQuery`.
-* Transactions can now be started directly on named tables.
-* You can create dynamic tables with initial schema.
-* `TDBTable` and `TDBView` now have a shared protocol so they can easier be used interchangeably.
-
-### Bugfixes
-
-* Fixed bug in 64 bit iOS when inserting BOOL as NSNumber.
-
-
-0.4.0 Release notes (2014-03-26)
-=============================================================
-
-### API breaking changes
-
-* Typed interface Cursor has now been renamed to Row.
-* TDBGroup has been renamed to TDBTransaction.
-* Header files are renamed so names match class names.
-* Underscore (_) removed from generated typed table classes.
-* TDBBinary has been removed; use NSData instead.
-* Underscope (_) removed from generated typed table classes.
-* Constructor for TDBContext has been renamed to contextWithPersistenceToFile:
-* Table findFirstRow and min/max/sum/avg operations has been hidden.
-* Table.appendRow has been renamed to addRow.
-* getOrCreateTable on Transaction has been removed.
-* set*:inColumnWithIndex:atRowIndex: methods have been prefixed with TDB
-* *:inColumnWithIndex:atRowIndex: methods have been prefixed with TDB
-* addEmptyRow on table has been removed. Use [table addRow:nil] instead.
-* TDBMixed removed. Use id and NSObject instead.
-* insertEmptyRow has been removed from table. Use insertRow:nil atIndex:index instead.
-
-#### Enhancements
-
-* Added firstRow, lastRow selectors on view.
-* firstRow and lastRow on table now return nil if table is empty.
-* getTableWithName selector added on group.
-* getting and creating table methods on group no longer take error argument.
-* [TDBQuery parent] and [TDBQuery subtable:] selectors now return self.
-* createTable method added on Transaction. Throws exception if table with same name already exists.
-* Experimental support for pinning transactions on Context.
-* TDBView now has support for object subscripting.
-
-### Bugfixes
-
-* None.
-
-
-0.3.0 Release notes (2014-03-14)
-=============================================================
-
-The Objective-C API has been updated and your code will break!
-
-### API breaking changes
-
-* Most selectors have been renamed in the binding!
-* Prepend TDB-prefix on all classes and types.
-
-### Enhancements
-
-* Return types and parameters changed from size_t to NSUInteger.
-* Adding setObject to TightdbTable (t[2] = @[@1, @"Hello"] is possible).
-* Adding insertRow to TightdbTable.
-* Extending appendRow to accept NSDictionary.
-
-### Bugfixes
-
-* None.
-
-
-0.2.0 Release notes (2014-03-07)
-=============================================================
-
-The Objective-C API has been updated and your code will break!
-
-### API breaking changes
-
-* addRow renamed to addEmptyRow
-
-### Enhancements
-
-* Adding a simple class for version numbering.
-* Adding get-version and set-version targets to build.sh.
-* tableview now supports sort on column with column type bool, date and int
-* tableview has method for checking the column type of a specified column
-* tableview has method for getting the number of columns
-* Adding methods getVersion, getCoreVersion and isAtLeast.
-* Adding appendRow to TightdbTable.
-* Adding object subscripting.
-* Adding method removeColumn on table.
-
-### Bugfixes
-
-* None.

+ 0 - 64
Carthage/Checkouts/realm-cocoa/CONTRIBUTING.md

@@ -1,64 +0,0 @@
-# Contributing
-
-## Filing Issues
-
-Whether you find a bug, typo or an API call that could be clarified, please [file an issue](https://github.com/realm/realm-cocoa/issues) on our GitHub repository.
-
-When filing an issue, please provide as much of the following information as possible in order to help others fix it:
-
-1. **Goals**
-2. **Expected results**
-3. **Actual results**
-4. **Steps to reproduce**
-5. **Code sample that highlights the issue** (full Xcode projects that we can compile ourselves are ideal)
-6. **Version of Realm / Xcode / macOS**
-7. **Version of involved dependency manager (CocoaPods / Carthage)**
-
-If you'd like to send us sensitive sample code to help troubleshoot your issue, you can email <help@realm.io> directly.
-
-### Speeding things up :runner:
-
-You may just copy this little script below and run it directly in your project directory in **Terminal.app**. It will take of compiling a list of relevant data as described in points 6. and 7. in the list above. It copies the list directly to your pasteboard for your convenience, so you can attach it easily when filing a new issue without having to worry about formatting and we may help you faster because we don't have to ask for particular details of your local setup first.
-
-```shell
-echo "\`\`\`
-$(sw_vers)
-
-$(xcode-select -p)
-$(xcodebuild -version)
-
-$(which pod && pod --version)
-$(test -e Podfile.lock && cat Podfile.lock | sed -nE 's/^  - (Realm(Swift)? [^:]*):?/\1/p' || echo "(not in use here)")
-
-$(which bash && bash -version | head -n1)
-
-$(which carthage && carthage version)
-$(test -e Cartfile.resolved && cat Cartfile.resolved | grep --color=no realm || echo "(not in use here)")
-
-$(which git && git --version)
-\`\`\`" | tee /dev/tty | pbcopy
-```
-
-## Contributing Enhancements
-
-We love contributions to Realm! If you'd like to contribute code, documentation, or any other improvements, please [file a Pull Request](https://github.com/realm/realm-cocoa/pulls) on our GitHub repository. Make sure to accept our [CLA](#cla) and to follow our [style guide](https://github.com/realm/realm-cocoa/wiki/Objective-C-Style-Guide).
-
-### Commit Messages
-
-Although we don’t enforce a strict format for commit messages, we prefer that you follow the guidelines below, which are common among open source projects. Following these guidelines helps with the review process, searching commit logs and documentation of implementation details. At a high level, the contents of the commit message should convey the rationale of the change, without delving into much detail. For example, `setter names were not set right` leaves the reviewer wondering about which bits and why they weren’t “right”. In contrast, `[RLMProperty] Correctly capitalize setterName` conveys almost all there is to the change.
-
-Below are some guidelines about the format of the commit message itself:
-
-* Separate the commit message into a single-line title and a separate body that describes the change.
-* Make the title concise to be easily read within a commit log.
-* Make the body concise, while including the complete reasoning. Unless required to understand the change, additional code examples or other details should be left to the pull request.
-* If the commit fixes a bug, include the number of the issue in the message.
-* Use the first person present tense - for example "Fix …" instead of "Fixes …" or "Fixed …".
-* For text formatting and spelling, follow the same rules as documentation and in-code comments — for example, the use of capitalization and periods.
-* If the commit is a bug fix on top of another recently committed change, or a revert or reapply of a patch, include the Git revision number of the prior related commit, e.g. `Revert abcd3fg because it caused #1234`.
-
-### CLA
-
-Realm welcomes all contributions! The only requirement we have is that, like many other projects, we need to have a [Contributor License Agreement](https://en.wikipedia.org/wiki/Contributor_License_Agreement) (CLA) in place before we can accept any external code. Our own CLA is a modified version of the Apache Software Foundation’s CLA.
-
-[Please submit your CLA electronically using our Google form](https://docs.google.com/forms/d/1bVp-Wp5nmNFz9Nx-ngTmYBVWVdwTyKj4T0WtfVm0Ozs/viewform?fbzx=4154977190905366979) so we can accept your submissions. The GitHub username you file there will need to match that of your Pull Requests. If you have any questions or cannot file the CLA electronically, you can email <help@realm.io>.

+ 0 - 75
Carthage/Checkouts/realm-cocoa/Configuration/Base.xcconfig

@@ -1,75 +0,0 @@
-ALWAYS_SEARCH_USER_PATHS = NO;
-CLANG_CXX_LANGUAGE_STANDARD = c++17;
-CLANG_CXX_LIBRARY = libc++;
-CLANG_ENABLE_MODULES = YES;
-CLANG_ENABLE_OBJC_ARC = YES;
-CLANG_WARN_ASSIGN_ENUM = YES;
-CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
-CLANG_WARN_BOOL_CONVERSION = YES;
-CLANG_WARN_COMMA = YES;
-CLANG_WARN_CONSTANT_CONVERSION = YES;
-CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
-CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
-CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
-CLANG_WARN_EMPTY_BODY = YES;
-CLANG_WARN_ENUM_CONVERSION = YES;
-CLANG_WARN_INFINITE_RECURSION = YES;
-CLANG_WARN_INT_CONVERSION = YES;
-CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
-CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = NO;
-CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
-CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
-CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
-CLANG_WARN_STRICT_PROTOTYPES = YES;
-CLANG_WARN_SUSPICIOUS_MOVE = YES;
-CLANG_WARN_UNREACHABLE_CODE = YES;
-CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
-CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
-COMBINE_HIDPI_IMAGES = YES;
-ENABLE_STRICT_OBJC_MSGSEND = YES;
-GCC_C_LANGUAGE_STANDARD = gnu99;
-GCC_NO_COMMON_BLOCKS = YES;
-GCC_PRECOMPILE_PREFIX_HEADER = YES;
-GCC_PREFIX_HEADER = $(REALM_PREFIX_HEADER);
-GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES;
-GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
-GCC_WARN_ABOUT_MISSING_NEWLINE = YES;
-GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
-GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
-GCC_WARN_SIGN_COMPARE = YES;
-GCC_WARN_UNDECLARED_SELECTOR = YES;
-GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
-GCC_WARN_UNKNOWN_PRAGMAS = YES;
-GCC_WARN_UNUSED_FUNCTION = YES;
-GCC_WARN_UNUSED_PARAMETER = YES;
-GCC_WARN_UNUSED_VARIABLE = YES;
-SWIFT_COMPILATION_MODE = wholemodule;
-SWIFT_OPTIMIZATION_LEVEL = -Owholemodule;
-WARNING_CFLAGS = -Wmismatched-tags -Wunused-private-field -Wpartial-availability;
-OTHER_CFLAGS = -fvisibility-inlines-hidden;
-OTHER_CFLAGS[arch=armv7] = -fvisibility-inlines-hidden -fno-aligned-new;
-
-HEADER_SEARCH_PATHS = $(inherited) Realm/ObjectStore/src;
-REALM_CORE_FRAMEWORK = core/realm-sync$(REALM_LIBRARY_SUFFIX).xcframework;
-
-CODE_SIGN_IDENTITY[sdk=iphone*] = iPhone Developer;
-CODE_SIGNING_REQUIRED[sdk=macosx] = NO;
-
-MACOSX_DEPLOYMENT_TARGET = 10.9;
-IPHONEOS_DEPLOYMENT_TARGET = 9.0;
-WATCHOS_DEPLOYMENT_TARGET = 2.0;
-TVOS_DEPLOYMENT_TARGET = 9.0;
-
-// Xcode 11 "helpfully" "corrects" arm64 to x86_64 when you try to exclude
-// arm64 on platforms that it doesn't support building for arm64 on.
-REALM_ARM_ARCHS_1200 = arm64 arm64e;
-REALM_ARM_ARCHS = $(REALM_ARM_ARCHS_$(XCODE_VERSION_MAJOR))
-
-EXCLUDED_ARCHS[sdk=macosx*] = $(REALM_ARM_ARCHS);
-EXCLUDED_ARCHS[sdk=watchsimulator*] = $(REALM_ARM_ARCHS);
-EXCLUDED_ARCHS[sdk=iphonesimulator*] = $(REALM_ARM_ARCHS);
-EXCLUDED_ARCHS[sdk=appletvsimulator*] = $(REALM_ARM_ARCHS);
-
-SWIFT_VERSION = 5.0;
-TARGETED_DEVICE_FAMILY = 1,2,3,4;
-SDKROOT = $(REALM_SDKROOT);

+ 0 - 12
Carthage/Checkouts/realm-cocoa/Configuration/Debug.xcconfig

@@ -1,12 +0,0 @@
-#include "Base.xcconfig"
-
-BITCODE_GENERATION_MODE = marker;
-COPY_PHASE_STRIP = NO;
-ENABLE_TESTABILITY = YES;
-GCC_OPTIMIZATION_LEVEL = 0;
-ONLY_ACTIVE_ARCH = YES;
-SWIFT_OPTIMIZATION_LEVEL = -Onone;
-
-GCC_PREPROCESSOR_DEFINITIONS = DEBUG=1 REALM_DEBUG REALM_HAVE_CONFIG REALM_ENABLE_SYNC __ASSERTMACROS__;
-
-REALM_LIBRARY_SUFFIX = -dbg;

+ 0 - 11
Carthage/Checkouts/realm-cocoa/Configuration/Realm/Realm iOS static.xcconfig

@@ -1,11 +0,0 @@
-#include "Realm.xcconfig"
-
-SUPPORTED_PLATFORMS = iphoneos iphonesimulator;
-TARGETED_DEVICE_FAMILY = 1,2;
-IPHONEOS_DEPLOYMENT_TARGET = 9.0;
-
-MACH_O_TYPE = staticlib;
-EXECUTABLE_NAME = Realm;
-
-CONFIGURATION_BUILD_DIR = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)-static;
-CONFIGURATION_TEMP_DIR = $(PROJECT_TEMP_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)-static;

+ 0 - 28
Carthage/Checkouts/realm-cocoa/Configuration/Realm/Realm.xcconfig

@@ -1,28 +0,0 @@
-SUPPORTED_PLATFORMS = macosx iphoneos iphonesimulator watchos watchsimulator appletvos appletvsimulator;
-TARGETED_DEVICE_FAMILY = 1,2,3,4;
-
-INFOPLIST_FILE = Realm/Realm-Info.plist;
-MODULEMAP_FILE = $(SRCROOT)/Realm/Realm.modulemap;
-PRODUCT_BUNDLE_IDENTIFIER = io.Realm.${PRODUCT_NAME:rfc1034identifier};
-PRODUCT_NAME = Realm;
-SKIP_INSTALL = YES;
-
-DEFINES_MODULE = YES;
-DYLIB_COMPATIBILITY_VERSION = 1;
-DYLIB_CURRENT_VERSION = 1;
-DYLIB_INSTALL_NAME_BASE = @rpath;
-REALM_OBJC_MACH_O_TYPE = mh_dylib;
-MACH_O_TYPE = $(REALM_OBJC_MACH_O_TYPE);
-FRAMEWORK_VERSION = A;
-
-APPLICATION_EXTENSION_API_ONLY = YES;
-HEADER_SEARCH_PATHS = $(inherited) $(DERIVED_FILE_DIR);
-
-ENABLE_BITCODE[sdk=iphone*] = YES;
-ENABLE_BITCODE[sdk=watch*] = YES;
-ENABLE_BITCODE[sdk=appletv*] = YES;
-
-LD_RUNPATH_SEARCH_PATHS[sdk=macosx*] = $(inherited) @executable_path/../Frameworks @loader_path/../Frameworks;
-LD_RUNPATH_SEARCH_PATHS[sdk=iphone*] = $(inherited) @executable_path/Frameworks @loader_path/Frameworks;
-LD_RUNPATH_SEARCH_PATHS[sdk=watch*] = $(inherited) @executable_path/Frameworks @loader_path/Frameworks;
-LD_RUNPATH_SEARCH_PATHS[sdk=appletv*] = $(inherited) @executable_path/Frameworks @loader_path/Frameworks;

+ 0 - 7
Carthage/Checkouts/realm-cocoa/Configuration/Realm/Tests iOS static.xcconfig

@@ -1,7 +0,0 @@
-#include "Tests.xcconfig"
-
-CONFIGURATION_BUILD_DIR = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)-static;
-CONFIGURATION_TEMP_DIR = $(PROJECT_TEMP_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)-static;
-IPHONEOS_DEPLOYMENT_TARGET = 9.0;
-
-TEST_HOST[sdk=iphone*] = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)-static/TestHost static.app/TestHost static;

+ 0 - 22
Carthage/Checkouts/realm-cocoa/Configuration/Realm/Tests.xcconfig

@@ -1,22 +0,0 @@
-SUPPORTED_PLATFORMS = macosx iphonesimulator iphoneos appletvos appletvsimulator;
-SKIP_INSTALL = YES;
-
-INFOPLIST_FILE = Realm/Tests/RealmTests-Info.plist;
-PRODUCT_BUNDLE_IDENTIFIER = io.Realm.${PRODUCT_NAME:rfc1034identifier};
-
-LD_RUNPATH_SEARCH_PATHS[sdk=iphone*] = $(inherited) @executable_path/Frameworks @loader_path/Frameworks;
-LD_RUNPATH_SEARCH_PATHS[sdk=appletv*] = $(inherited) @executable_path/Frameworks @loader_path/Frameworks;
-LD_RUNPATH_SEARCH_PATHS[sdk=macosx*] = $(inherited) @executable_path/../Frameworks @loader_path/../Frameworks;
-
-OTHER_CFLAGS = -fobjc-arc-exceptions;
-
-SWIFT_OBJC_BRIDGING_HEADER = Realm/Tests/Swift/Swift-Tests-Bridging-Header.h;
-SWIFT_OPTIMIZATION_LEVEL = -Onone;
-
-TEST_HOST[sdk=iphone*] = $(BUILT_PRODUCTS_DIR)/TestHost.app/TestHost;
-TEST_HOST[sdk=appletv*] = $(BUILT_PRODUCTS_DIR)/TestHost.app/TestHost;
-TEST_HOST[sdk=macosx*] = $(BUILT_PRODUCTS_DIR)/TestHost.app/Contents/MacOS/TestHost;
-
-EXCLUDED_SOURCE_FILE_NAMES[sdk=iphone*] = InterprocessTests.m SwiftSchemaTests.swift;
-EXCLUDED_SOURCE_FILE_NAMES[sdk=appletv*] = EncryptionTests.mm InterprocessTests.m SwiftSchemaTests.swift;
-EXCLUDED_SOURCE_FILE_NAMES[sdk=watch*] = *;

+ 0 - 12
Carthage/Checkouts/realm-cocoa/Configuration/RealmSwift/RealmSwift.xcconfig

@@ -1,12 +0,0 @@
-SUPPORTED_PLATFORMS = macosx iphonesimulator iphoneos watchsimulator watchos appletvos appletvsimulator;
-APPLICATION_EXTENSION_API_ONLY = YES;
-SKIP_INSTALL = YES;
-
-DYLIB_COMPATIBILITY_VERSION = 1;
-DYLIB_CURRENT_VERSION = 1;
-DYLIB_INSTALL_NAME_BASE = @rpath;
-LD_RUNPATH_SEARCH_PATHS = $(inherited) @executable_path/Frameworks @loader_path/Frameworks;
-DEFINES_MODULE = YES;
-INFOPLIST_FILE = RealmSwift/RealmSwift-Info.plist;
-PRODUCT_NAME = RealmSwift;
-PRODUCT_BUNDLE_IDENTIFIER = io.realm.RealmSwit;

+ 0 - 18
Carthage/Checkouts/realm-cocoa/Configuration/RealmSwift/Tests.xcconfig

@@ -1,18 +0,0 @@
-SUPPORTED_PLATFORMS = macosx iphonesimulator iphoneos appletvos appletvsimulator;
-SKIP_INSTALL = YES;
-INFOPLIST_FILE = RealmSwift/Tests/RealmSwiftTests-Info.plist;
-PRODUCT_NAME = $(TARGET_NAME);
-SWIFT_OBJC_BRIDGING_HEADER = RealmSwift/Tests/RealmSwiftTests-BridgingHeader.h
-SWIFT_OPTIMIZATION_LEVEL = -Onone;
-
-LD_RUNPATH_SEARCH_PATHS[sdk=iphone*] = $(inherited) @executable_path/Frameworks @loader_path/Frameworks;
-LD_RUNPATH_SEARCH_PATHS[sdk=appletv*] = $(inherited) @executable_path/Frameworks @loader_path/Frameworks;
-LD_RUNPATH_SEARCH_PATHS[sdk=macosx*] = $(inherited) @executable_path/../Frameworks @loader_path/../Frameworks;
-
-EXCLUDED_SOURCE_FILE_NAMES[sdk=iphone*] = build/osx/*;
-EXCLUDED_SOURCE_FILE_NAMES[sdk=appletv*] = build/osx/*;
-EXCLUDED_SOURCE_FILE_NAMES[sdk=macosx*] = build/ios/*;
-
-TEST_HOST[sdk=iphone*] = $(BUILT_PRODUCTS_DIR)/TestHost.app/TestHost;
-TEST_HOST[sdk=appletv*] = $(BUILT_PRODUCTS_DIR)/TestHost.app/TestHost;
-TEST_HOST[sdk=macosx*] = $(BUILT_PRODUCTS_DIR)/TestHost.app/Contents/MacOS/TestHost;

+ 0 - 7
Carthage/Checkouts/realm-cocoa/Configuration/Release.xcconfig

@@ -1,7 +0,0 @@
-#include "Base.xcconfig"
-
-BITCODE_GENERATION_MODE = bitcode;
-DEBUG_INFORMATION_FORMAT = dwarf-with-dsym;
-ENABLE_NS_ASSERTIONS = NO;
-GCC_PREPROCESSOR_DEFINITIONS = REALM_HAVE_CONFIG REALM_ENABLE_SYNC __ASSERTMACROS__;
-VALIDATE_PRODUCT = YES;

+ 0 - 25
Carthage/Checkouts/realm-cocoa/Configuration/TestHost.xcconfig

@@ -1,25 +0,0 @@
-SUPPORTED_PLATFORMS = macosx iphonesimulator iphoneos appletvos appletvsimulator;
-
-CODE_SIGN_IDENTITY = "-";
-COPY_PHASE_STRIP = NO;
-LD_RUNPATH_SEARCH_PATHS = $(inherited) @executable_path/Frameworks;
-INFOPLIST_FILE = Realm/Tests/TestHost/Info.plist;
-PRODUCT_NAME = $(TARGET_NAME);
-CLANG_MODULES_AUTOLINK = NO;
-ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
-ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
-
-PRODUCT_BUNDLE_IDENTIFIER = io.realm.TestHost;
-
-REALM_UI_FRAMEWORK_ = Cocoa;
-REALM_UI_FRAMEWORK_uikit = UIKit;
-
-OTHER_LDFLAGS[sdk=iphone*] = -framework UIKit;
-OTHER_LDFLAGS[sdk=appletv*] = -framework UIKit;
-OTHER_LDFLAGS[sdk=macosx*] = -framework $(REALM_UI_FRAMEWORK_$(RESOURCES_UI_FRAMEWORK_FAMILY));
-
-PRINCIPAL_CLASS[sdk=iphone*] = UIApplication;
-PRINCIPAL_CLASS[sdk=appletv*] = UIApplication;
-PRINCIPAL_CLASS[sdk=macosx*] = NSApplication;
-
-IPHONEOS_DEPLOYMENT_TARGET = 9.0;

+ 0 - 15
Carthage/Checkouts/realm-cocoa/Configuration/object-server-config.yml

@@ -1,15 +0,0 @@
-storage:
-  root_path: 'root_dir'
-auth:
-  public_key_path: 'keys/token-signature.pub'
-  private_key_path: 'keys/token-signature.key'
-  sync_hosts:
-    - 'localhost:9080'
-  providers:
-    password:
-      iterations: 1
-proxy:
-  http:
-    listen_address: '::'
-enterprise:
-  skip_setup: true

+ 0 - 306
Carthage/Checkouts/realm-cocoa/Jenkinsfile.releasability

@@ -1,306 +0,0 @@
-xcodeVersions = ['11.3', '11.4.1', '11.5', '11.6']
-platforms = ['osx', 'ios', 'watchos', 'tvos', 'catalyst']
-carthagePlatforms = ['osx', 'ios', 'watchos', 'tvos']
-platformNames = ['osx': 'macOS', 'ios': 'iOS', 'watchos': 'watchOS', 'tvos': 'tvOS', 'catalyst': 'Catalyst']
-carthageXcodeVersion = '11.5'
-objcXcodeVersion = '11.3'
-docsSwiftVersion = '5.2.4'
-
-def installationTest(platform, test, language) {
-  return {
-    node('osx') {
-      deleteDir()
-      unstash 'source'
-
-      if (test == "dynamic" || test == "static") {
-        unstash "${language}-packaged"
-      }
-
-      sh """
-      hostname
-      export REALM_XCODE_VERSION=${carthageXcodeVersion}
-      cd examples/installation
-
-      archive=\$(echo \$PWD/realm-${language}-*.zip)
-      if [[ -f \$archive ]]; then
-        mv \$archive .
-        unzip realm-${language}-*.zip
-        rm realm-${language}-*.zip
-        mv realm-${language}-* realm-${language}-latest
-      fi
-
-      ./build.sh test-${platform}-${language}-${test}
-      """
-    }
-  }
-}
-
-def doBuild() {
-  stage('prepare') {
-    node('docker') {
-      deleteDir()
-
-      checkout(
-        [
-          $class           : 'GitSCM',
-          branches         : scm.branches,
-          gitTool          : 'native git',
-          extensions       : scm.extensions + [[$class: 'CleanCheckout'],
-                                               [$class: 'SubmoduleOption', parentCredentials: true]],
-          userRemoteConfigs: scm.userRemoteConfigs,
-        ]
-      )
-
-      stash includes: '**', name: 'source'
-    }
-  }
-
-  stage('build') {
-    def parallelBuilds = [
-      'Docs': {
-        node('osx') {
-          deleteDir()
-          unstash 'source'
-          sh """
-          hostname
-          export REALM_SWIFT_VERSION=${docsSwiftVersion}
-          export PATH='/Users/realm/.rbenv/bin:/Users/realm/.rbenv/shims:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/realm/.gems/bin'
-          ./scripts/reset-simulators.sh
-          ./build.sh docs
-          cd docs
-          zip -r objc-docs.zip objc_output
-          zip -r swift-docs.zip swift_output
-          """
-          dir('docs') {
-            archiveArtifacts artifacts: '*-docs.zip'
-          }
-        }
-      },
-
-      'Examples': {
-        node('osx') {
-          deleteDir()
-          unstash 'source'
-          sh './build.sh package-examples'
-          stash includes: 'realm-examples.zip', name: 'examples'
-        }
-      },
-
-      'iOS Obj-C static': {
-        node('osx') {
-          deleteDir()
-          unstash 'source'
-          sh "REALM_XCODE_VERSION=${objcXcodeVersion} ./build.sh package-ios-static"
-          dir("build/ios-static") {
-            stash includes: "realm-framework-ios-static.zip", name: "ios-static"
-          }
-        }
-      }
-    ]
-
-    for (def p in carthagePlatforms) {
-      def platform = p
-      def platformName = platformNames[platform]
-      parallelBuilds["${platformName} Carthage"] = {
-        node('osx') {
-          deleteDir()
-          unstash 'source'
-          sh """
-          hostname
-          export REALM_XCODE_VERSION=${carthageXcodeVersion}
-          . ./scripts/swift-version.sh
-          set_xcode_and_swift_versions
-
-          # Carthage scans every xcodeproj in the directory looking for
-          # targets. This can be very slow and even spuriously time out, so
-          # remove the ones we don't want it to build.
-          rm -r examples plugin
-
-          # For whatever reason 'xcodebuild -list' is very slow sometimes which
-          # makes Carthage time out, but it's a lot faster if no simulators
-          # exist, so delete them all first and only create a single simulator
-          # for each platform.
-          ./scripts/reset-simulators.rb -firstOnly
-
-          carthage build --no-skip-current --platform ${platform}
-          carthage archive --output Carthage-${platform}.framework.zip
-          """
-          stash includes: "Carthage-${platform}.framework.zip",
-                name: "${platform}-carthage"
-        }
-      }
-    }
-
-    for (def p in platforms) {
-      def platform = p
-      def platformName = platformNames[platform]
-      for (def v in xcodeVersions) {
-        def xcodeVersion = v
-        parallelBuilds["${platformName} ${xcodeVersion}"] = {
-          node('osx') {
-            deleteDir()
-            unstash 'source'
-            sh "REALM_XCODE_VERSION=${xcodeVersion} ./build.sh package ${platform}"
-            dir("build/${platform}") {
-              stash includes: "realm-framework-${platform}-${xcodeVersion}.zip",
-                    name: "${platform}-${xcodeVersion}"
-            }
-          }
-        }
-      }
-    }
-
-    parallel parallelBuilds
-  }
-
-  stage('package') {
-    parallel (
-      "Obj-C": {
-        node('osx') {
-          deleteDir()
-
-          for (def platform in platforms) {
-            unstash "${platform}-${objcXcodeVersion}"
-          }
-
-          unstash 'ios-static'
-          unstash 'examples'
-          unstash 'source'
-
-          sh "REALM_XCODE_VERSION=${objcXcodeVersion} ./build.sh package-release objc"
-          stash include: 'realm-objc-*.zip', name: 'objc-packaged'
-          archiveArtifacts artifacts: 'realm-objc-*.zip'
-        }
-      },
-      "Swift": {
-        node('osx') {
-          deleteDir()
-
-          for (def platform in platforms) {
-            for (def xcodeVersion in xcodeVersions) {
-              unstash "${platform}-${xcodeVersion}"
-            }
-          }
-
-          unstash 'examples'
-          unstash 'source'
-
-          sh './build.sh package-release swift'
-          stash include: 'realm-swift-*.zip', name: 'swift-packaged'
-          archiveArtifacts artifacts: 'realm-swift-*.zip'
-        }
-      },
-      "Carthage": {
-        node('osx') {
-          deleteDir()
-
-          for (def platform in carthagePlatforms) {
-            unstash "${platform}-carthage"
-          }
-
-          sh '''
-          for zip in Carthage-*.framework.zip; do
-            ditto -xk $zip merged/
-          done
-
-          ditto -ck merged/ Carthage.framework.zip
-          '''
-
-          archiveArtifacts artifacts: 'Carthage.framework.zip'
-        }
-      }
-    )
-  }
-
-  stage('test') {
-    def parallelBuilds = [
-      'Test Obj-C Examples': {
-        node('osx') {
-          deleteDir()
-
-          unstash 'objc-packaged'
-
-          def sha = params.sha
-          sh """
-          hostname
-          curl -O https://raw.githubusercontent.com/realm/realm-cocoa/${sha}/build.sh
-          mkdir -p scripts
-          curl https://raw.githubusercontent.com/realm/realm-cocoa/${sha}/scripts/swift-version.sh -o scripts/swift-version.sh
-          curl https://raw.githubusercontent.com/realm/realm-cocoa/${sha}/scripts/reset-simulators.sh -o scripts/reset-simulators.sh
-          curl https://raw.githubusercontent.com/realm/realm-cocoa/${sha}/scripts/reset-simulators.rb -o scripts/reset-simulators.rb
-          chmod +x scripts/reset-simulators.rb
-
-          sh build.sh package-test-examples-objc
-          """
-        }
-      },
-
-      'Test Swift Examples': {
-        node('osx') {
-          deleteDir()
-
-          unstash 'swift-packaged'
-
-          def sha = params.sha
-          sh """
-          hostname
-          curl -O https://raw.githubusercontent.com/realm/realm-cocoa/${sha}/build.sh
-          mkdir -p scripts
-          curl https://raw.githubusercontent.com/realm/realm-cocoa/${sha}/scripts/swift-version.sh -o scripts/swift-version.sh
-          curl https://raw.githubusercontent.com/realm/realm-cocoa/${sha}/scripts/reset-simulators.sh -o scripts/reset-simulators.sh
-          curl https://raw.githubusercontent.com/realm/realm-cocoa/${sha}/scripts/reset-simulators.rb -o scripts/reset-simulators.rb
-          chmod +x scripts/reset-simulators.rb
-
-          sh build.sh package-test-examples-swift
-          """
-        }
-      },
-
-      'Test iOS static': {
-        node('osx') {
-          deleteDir()
-          unstash 'source'
-
-          sh './scripts/reset-simulators.rb'
-          sh 'sh build.sh test-ios-static'
-        }
-      },
-
-      'Test macOS': {
-        node('osx') {
-          deleteDir()
-          unstash 'source'
-          sh 'sh build.sh test-osx'
-        }
-      }
-    ]
-
-    for (def platform in ["osx", "ios", "watchos"]) {
-      def platformName = platformNames[platform]
-      for (def test in ["dynamic", "cocoapods", "carthage"]) {
-        parallelBuilds["Installation - ${platformName} Obj-C ${test}"] = installationTest(platform, test, 'objc')
-      }
-    }
-
-    parallelBuilds["Installation - iOS Obj-C static"] = installationTest('ios', 'static', 'objc')
-    parallelBuilds["Installation - iOS Obj-C CocoaPods dynamic"] = installationTest('ios', 'cocoapods-dynamic', 'objc')
-
-    for (def platform in ["osx", "ios", "watchos"]) {
-      def platformName = platformNames[platform]
-      for (def test in ["dynamic", "cocoapods", "carthage"]) {
-        parallelBuilds["Installation - ${platformName} Swift ${test}"] = installationTest(platform, test, 'swift')
-      }
-    }
-
-    parallel parallelBuilds
-  }
-}
-
-try {
-  doBuild()
-} catch (e) {
-  // If there was an exception thrown, the build failed
-  currentBuild.result = "FAILED"
-  throw e
-}
-

+ 0 - 248
Carthage/Checkouts/realm-cocoa/LICENSE

@@ -1,248 +0,0 @@
-TABLE OF CONTENTS
-
-1. Apache License version 2.0
-2. Realm Components
-3. Export Compliance
-
-1. -------------------------------------------------------------------------------
-
-                                 Apache License
-                           Version 2.0, January 2004
-                        http://www.apache.org/licenses/
-
-   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-   1. Definitions.
-
-      "License" shall mean the terms and conditions for use, reproduction,
-      and distribution as defined by Sections 1 through 9 of this document.
-
-      "Licensor" shall mean the copyright owner or entity authorized by
-      the copyright owner that is granting the License.
-
-      "Legal Entity" shall mean the union of the acting entity and all
-      other entities that control, are controlled by, or are under common
-      control with that entity. For the purposes of this definition,
-      "control" means (i) the power, direct or indirect, to cause the
-      direction or management of such entity, whether by contract or
-      otherwise, or (ii) ownership of fifty percent (50%) or more of the
-      outstanding shares, or (iii) beneficial ownership of such entity.
-
-      "You" (or "Your") shall mean an individual or Legal Entity
-      exercising permissions granted by this License.
-
-      "Source" form shall mean the preferred form for making modifications,
-      including but not limited to software source code, documentation
-      source, and configuration files.
-
-      "Object" form shall mean any form resulting from mechanical
-      transformation or translation of a Source form, including but
-      not limited to compiled object code, generated documentation,
-      and conversions to other media types.
-
-      "Work" shall mean the work of authorship, whether in Source or
-      Object form, made available under the License, as indicated by a
-      copyright notice that is included in or attached to the work
-      (an example is provided in the Appendix below).
-
-      "Derivative Works" shall mean any work, whether in Source or Object
-      form, that is based on (or derived from) the Work and for which the
-      editorial revisions, annotations, elaborations, or other modifications
-      represent, as a whole, an original work of authorship. For the purposes
-      of this License, Derivative Works shall not include works that remain
-      separable from, or merely link (or bind by name) to the interfaces of,
-      the Work and Derivative Works thereof.
-
-      "Contribution" shall mean any work of authorship, including
-      the original version of the Work and any modifications or additions
-      to that Work or Derivative Works thereof, that is intentionally
-      submitted to Licensor for inclusion in the Work by the copyright owner
-      or by an individual or Legal Entity authorized to submit on behalf of
-      the copyright owner. For the purposes of this definition, "submitted"
-      means any form of electronic, verbal, or written communication sent
-      to the Licensor or its representatives, including but not limited to
-      communication on electronic mailing lists, source code control systems,
-      and issue tracking systems that are managed by, or on behalf of, the
-      Licensor for the purpose of discussing and improving the Work, but
-      excluding communication that is conspicuously marked or otherwise
-      designated in writing by the copyright owner as "Not a Contribution."
-
-      "Contributor" shall mean Licensor and any individual or Legal Entity
-      on behalf of whom a Contribution has been received by Licensor and
-      subsequently incorporated within the Work.
-
-   2. Grant of Copyright License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      copyright license to reproduce, prepare Derivative Works of,
-      publicly display, publicly perform, sublicense, and distribute the
-      Work and such Derivative Works in Source or Object form.
-
-   3. Grant of Patent License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      (except as stated in this section) patent license to make, have made,
-      use, offer to sell, sell, import, and otherwise transfer the Work,
-      where such license applies only to those patent claims licensable
-      by such Contributor that are necessarily infringed by their
-      Contribution(s) alone or by combination of their Contribution(s)
-      with the Work to which such Contribution(s) was submitted. If You
-      institute patent litigation against any entity (including a
-      cross-claim or counterclaim in a lawsuit) alleging that the Work
-      or a Contribution incorporated within the Work constitutes direct
-      or contributory patent infringement, then any patent licenses
-      granted to You under this License for that Work shall terminate
-      as of the date such litigation is filed.
-
-   4. Redistribution. You may reproduce and distribute copies of the
-      Work or Derivative Works thereof in any medium, with or without
-      modifications, and in Source or Object form, provided that You
-      meet the following conditions:
-
-      (a) You must give any other recipients of the Work or
-          Derivative Works a copy of this License; and
-
-      (b) You must cause any modified files to carry prominent notices
-          stating that You changed the files; and
-
-      (c) You must retain, in the Source form of any Derivative Works
-          that You distribute, all copyright, patent, trademark, and
-          attribution notices from the Source form of the Work,
-          excluding those notices that do not pertain to any part of
-          the Derivative Works; and
-
-      (d) If the Work includes a "NOTICE" text file as part of its
-          distribution, then any Derivative Works that You distribute must
-          include a readable copy of the attribution notices contained
-          within such NOTICE file, excluding those notices that do not
-          pertain to any part of the Derivative Works, in at least one
-          of the following places: within a NOTICE text file distributed
-          as part of the Derivative Works; within the Source form or
-          documentation, if provided along with the Derivative Works; or,
-          within a display generated by the Derivative Works, if and
-          wherever such third-party notices normally appear. The contents
-          of the NOTICE file are for informational purposes only and
-          do not modify the License. You may add Your own attribution
-          notices within Derivative Works that You distribute, alongside
-          or as an addendum to the NOTICE text from the Work, provided
-          that such additional attribution notices cannot be construed
-          as modifying the License.
-
-      You may add Your own copyright statement to Your modifications and
-      may provide additional or different license terms and conditions
-      for use, reproduction, or distribution of Your modifications, or
-      for any such Derivative Works as a whole, provided Your use,
-      reproduction, and distribution of the Work otherwise complies with
-      the conditions stated in this License.
-
-   5. Submission of Contributions. Unless You explicitly state otherwise,
-      any Contribution intentionally submitted for inclusion in the Work
-      by You to the Licensor shall be under the terms and conditions of
-      this License, without any additional terms or conditions.
-      Notwithstanding the above, nothing herein shall supersede or modify
-      the terms of any separate license agreement you may have executed
-      with Licensor regarding such Contributions.
-
-   6. Trademarks. This License does not grant permission to use the trade
-      names, trademarks, service marks, or product names of the Licensor,
-      except as required for reasonable and customary use in describing the
-      origin of the Work and reproducing the content of the NOTICE file.
-
-   7. Disclaimer of Warranty. Unless required by applicable law or
-      agreed to in writing, Licensor provides the Work (and each
-      Contributor provides its Contributions) on an "AS IS" BASIS,
-      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-      implied, including, without limitation, any warranties or conditions
-      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
-      PARTICULAR PURPOSE. You are solely responsible for determining the
-      appropriateness of using or redistributing the Work and assume any
-      risks associated with Your exercise of permissions under this License.
-
-   8. Limitation of Liability. In no event and under no legal theory,
-      whether in tort (including negligence), contract, or otherwise,
-      unless required by applicable law (such as deliberate and grossly
-      negligent acts) or agreed to in writing, shall any Contributor be
-      liable to You for damages, including any direct, indirect, special,
-      incidental, or consequential damages of any character arising as a
-      result of this License or out of the use or inability to use the
-      Work (including but not limited to damages for loss of goodwill,
-      work stoppage, computer failure or malfunction, or any and all
-      other commercial damages or losses), even if such Contributor
-      has been advised of the possibility of such damages.
-
-   9. Accepting Warranty or Additional Liability. While redistributing
-      the Work or Derivative Works thereof, You may choose to offer,
-      and charge a fee for, acceptance of support, warranty, indemnity,
-      or other liability obligations and/or rights consistent with this
-      License. However, in accepting such obligations, You may act only
-      on Your own behalf and on Your sole responsibility, not on behalf
-      of any other Contributor, and only if You agree to indemnify,
-      defend, and hold each Contributor harmless for any liability
-      incurred by, or claims asserted against, such Contributor by reason
-      of your accepting any such warranty or additional liability.
-
-2. -------------------------------------------------------------------------------
-
-REALM COMPONENTS
-
-This software contains components with separate copyright and license terms.
-Your use of these components is subject to the terms and conditions of the
-following licenses.
-
-For the Realm Platform Extensions component
-
-  Realm Platform Extensions License
-
-  Copyright (c) 2011-2017 Realm Inc All rights reserved
-
-  Redistribution and use in binary form, with or without modification, is
-  permitted provided that the following conditions are met:
-
-  1. You agree not to attempt to decompile, disassemble, reverse engineer or
-  otherwise discover the source code from which the binary code was derived.
-  You may, however, access and obtain a separate license for most of the
-  source code from which this Software was created, at
-  http://realm.io/pricing/.
-
-  2. Redistributions in binary form must reproduce the above copyright notice,
-  this list of conditions and the following disclaimer in the documentation
-  and/or other materials provided with the distribution.
-
-  3. Neither the name of the copyright holder nor the names of its
-  contributors may be used to endorse or promote products derived from this
-  software without specific prior written permission.
-
-  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-  POSSIBILITY OF SUCH DAMAGE.
-
-3. -------------------------------------------------------------------------------
-
-EXPORT COMPLIANCE
-
-You understand that the Software may contain cryptographic functions that may be
-subject to export restrictions, and you represent and warrant that you are not
-(i) located in a jurisdiction that is subject to United States economic
-sanctions (“Prohibited Jurisdiction”), including Cuba, Iran, North Korea,
-Sudan, Syria or the Crimea region, (ii) a person listed on any U.S. government
-blacklist (to include the List of Specially Designated Nationals and Blocked
-Persons or the Consolidated Sanctions List administered by the U.S. Department
-of the Treasury’s Office of Foreign Assets Control, or the Denied Persons List
-or Entity List administered by the U.S. Department of Commerce)
-(“Sanctioned Person”), or (iii) controlled or 50% or more owned by a Sanctioned
-Person.
-
-You agree to comply with all export, re-export and import restrictions and
-regulations of the U.S. Department of Commerce or other agency or authority of
-the United States or other applicable countries. You also agree not to transfer,
-or authorize the transfer of, directly or indirectly, of the Software to any
-Prohibited Jurisdiction, or otherwise in violation of any such restrictions or
-regulations.

+ 0 - 114
Carthage/Checkouts/realm-cocoa/Realm.podspec

@@ -1,114 +0,0 @@
-Pod::Spec.new do |s|
-  s.name                    = 'Realm'
-  version                   = `sh build.sh get-version`
-  s.version                 = version
-  s.summary                 = 'Realm is a modern data framework & database for iOS, macOS, tvOS & watchOS.'
-  s.description             = <<-DESC
-                              The Realm Mobile Database, for Objective-C. (If you want to use Realm from Swift, see the “RealmSwift” pod.)
-
-                              The Realm Mobile Database is a fast, easy-to-use replacement for Core Data & SQLite. Use it with the Realm Mobile Platform for realtime, automatic data sync. Works on iOS, macOS, tvOS & watchOS. Learn more and get help at https://realm.io.
-                              DESC
-  s.homepage                = "https://realm.io"
-  s.source                  = { :git => 'https://github.com/realm/realm-cocoa.git', :tag => "v#{s.version}", :submodules => true }
-  s.author                  = { 'Realm' => 'help@realm.io' }
-  s.library                 = 'c++', 'z'
-  s.requires_arc            = true
-  s.social_media_url        = 'https://twitter.com/realm'
-  has_versioned_docs        = !(version =~ /alpha|beta|rc/)
-  s.documentation_url       = "https://realm.io/docs/objc/#{has_versioned_docs ? s.version : 'latest'}"
-  s.license                 = { :type => 'Apache 2.0', :file => 'LICENSE' }
-
-  public_header_files       = 'include/**/RLMArray.h',
-                              'include/**/RLMCollection.h',
-                              'include/**/RLMConstants.h',
-                              'include/**/RLMListBase.h',
-                              'include/**/RLMMigration.h',
-                              'include/**/RLMObject.h',
-                              'include/**/RLMObjectBase.h',
-                              'include/**/RLMObjectSchema.h',
-                              'include/**/RLMOptionalBase.h',
-                              'include/**/RLMPlatform.h',
-                              'include/**/RLMProperty.h',
-                              'include/**/RLMRealm.h',
-                              'include/**/RLMRealm+Sync.h',
-                              'include/**/RLMRealmConfiguration+Sync.h',
-                              'include/**/RLMRealmConfiguration.h',
-                              'include/**/RLMResults.h',
-                              'include/**/RLMSchema.h',
-                              'include/**/RLMSyncConfiguration.h',
-                              'include/**/RLMSyncCredentials.h',
-                              'include/**/RLMSyncManager.h',
-                              'include/**/RLMSyncPermission.h',
-                              'include/**/RLMSyncSession.h',
-                              'include/**/RLMSyncSubscription.h',
-                              'include/**/RLMSyncUser.h',
-                              'include/**/RLMSyncUtil.h',
-                              'include/**/RLMThreadSafeReference.h',
-                              'include/**/NSError+RLMSync.h',
-                              'include/**/Realm.h',
-
-                              # Realm.Dynamic module
-                              'include/**/RLMRealm_Dynamic.h',
-                              'include/**/RLMObjectBase_Dynamic.h'
-
-                              # Realm.Private module
-  private_header_files      = 'include/**/RLMAccessor.h',
-                              'include/**/RLMArray_Private.h',
-                              'include/**/RLMCollection_Private.h',
-                              'include/**/RLMListBase.h',
-                              'include/**/RLMObjectBase_Private.h',
-                              'include/**/RLMObjectSchema_Private.h',
-                              'include/**/RLMObjectStore.h',
-                              'include/**/RLMObject_Private.h',
-                              'include/**/RLMOptionalBase.h',
-                              'include/**/RLMProperty_Private.h',
-                              'include/**/RLMRealmConfiguration_Private.h',
-                              'include/**/RLMRealm_Private.h',
-                              'include/**/RLMResults_Private.h',
-                              'include/**/RLMSchema_Private.h',
-                              'include/**/RLMSyncConfiguration_Private.h',
-                              'include/**/RLMSyncUtil_Private.h'
-
-  source_files              = 'Realm/*.{m,mm}',
-                              'Realm/ObjectStore/src/*.cpp',
-                              'Realm/ObjectStore/src/sync/*.cpp',
-                              'Realm/ObjectStore/src/sync/impl/*.cpp',
-                              'Realm/ObjectStore/src/sync/impl/apple/*.cpp',
-                              'Realm/ObjectStore/src/impl/*.cpp',
-                              'Realm/ObjectStore/src/impl/apple/*.cpp',
-                              'Realm/ObjectStore/src/util/*.cpp',
-                              'Realm/ObjectStore/src/util/apple/*.cpp'
-
-  s.frameworks              = 'Security'
-  s.module_map              = 'Realm/Realm.modulemap'
-  s.compiler_flags          = "-DREALM_HAVE_CONFIG -DREALM_COCOA_VERSION='@\"#{s.version}\"' -D__ASSERTMACROS__ -DREALM_ENABLE_SYNC"
-  s.prepare_command         = 'sh build.sh cocoapods-setup'
-  s.source_files            = source_files + private_header_files
-  s.private_header_files    = private_header_files
-  s.header_mappings_dir     = 'include'
-  s.pod_target_xcconfig     = { 'APPLICATION_EXTENSION_API_ONLY' => 'YES',
-                                'CLANG_CXX_LANGUAGE_STANDARD' => 'c++17',
-                                'CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF' => 'NO',
-                                'OTHER_CPLUSPLUSFLAGS' => '-isystem "${PODS_ROOT}/Realm/include/core" -fvisibility-inlines-hidden',
-                                'OTHER_CPLUSPLUSFLAGS[arch=armv7]' => '-isystem "${PODS_ROOT}/Realm/include/core" -fvisibility-inlines-hidden -fno-aligned-new',
-                                'USER_HEADER_SEARCH_PATHS' => '"${PODS_ROOT}/Realm/include" "${PODS_ROOT}/Realm/include/Realm"',
-                              }
-  s.preserve_paths          = %w(build.sh include)
-
-  s.ios.deployment_target   = '9.0'
-  s.ios.vendored_library    = 'core/librealmcore-ios.a'
-
-  s.osx.deployment_target   = '10.9'
-  s.osx.vendored_library    = 'core/librealmcore-macosx.a'
-
-  s.watchos.deployment_target = '2.0'
-  s.watchos.vendored_library  = 'core/librealmcore-watchos.a'
-
-  s.tvos.deployment_target = '9.0'
-  s.tvos.vendored_library  = 'core/librealmcore-tvos.a'
-
-  s.subspec 'Headers' do |s|
-    s.source_files          = public_header_files
-    s.public_header_files   = public_header_files
-  end
-end

+ 0 - 46
Carthage/Checkouts/realm-cocoa/Realm/NSError+RLMSync.h

@@ -1,46 +0,0 @@
-////////////////////////////////////////////////////////////////////////////
-//
-// Copyright 2017 Realm Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////
-
-#import <Foundation/Foundation.h>
-
-NS_ASSUME_NONNULL_BEGIN
-
-@class RLMSyncErrorActionToken;
-
-/// NSError category extension providing methods to get data out of Realm's
-/// "client reset" error.
-@interface NSError (RLMSync)
-
-/**
- Given an appropriate Realm Object Server error, return the token that
- can be passed into `+[RLMSyncSession immediatelyHandleError:]` to
- immediately perform error clean-up work, or nil if the error isn't of
- a type that provides a token.
- */
-- (nullable RLMSyncErrorActionToken *)rlmSync_errorActionToken NS_REFINED_FOR_SWIFT;
-
-/**
- Given a Realm Object Server client reset error, return the path where the
- backup copy of the Realm will be placed once the client reset process is
- complete.
- */
-- (nullable NSString *)rlmSync_clientResetBackedUpRealmPath NS_SWIFT_UNAVAILABLE("");
-
-@end
-
-NS_ASSUME_NONNULL_END

+ 0 - 43
Carthage/Checkouts/realm-cocoa/Realm/NSError+RLMSync.m

@@ -1,43 +0,0 @@
-////////////////////////////////////////////////////////////////////////////
-//
-// Copyright 2017 Realm Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////
-
-#import "NSError+RLMSync.h"
-
-#import "RLMSyncUtil.h"
-
-@implementation NSError (RLMSync)
-
-- (RLMSyncErrorActionToken *)rlmSync_errorActionToken {
-    if (self.domain != RLMSyncErrorDomain) {
-        return nil;
-    }
-    if (self.code == RLMSyncErrorClientResetError
-        || self.code == RLMSyncErrorPermissionDeniedError) {
-        return (RLMSyncErrorActionToken *)self.userInfo[kRLMSyncErrorActionTokenKey];
-    }
-    return nil;
-}
-
-- (NSString *)rlmSync_clientResetBackedUpRealmPath {
-    if (self.domain == RLMSyncErrorDomain && self.code == RLMSyncErrorClientResetError) {
-        return self.userInfo[kRLMSyncPathOfRealmBackupCopyKey];
-    }
-    return nil;
-}
-
-@end

+ 0 - 20
Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/Object-Server-Tests-Bridging-Header.h

@@ -1,20 +0,0 @@
-////////////////////////////////////////////////////////////////////////////
-//
-// Copyright 2016 Realm Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////
-
-#import "RLMSyncTestCase.h"
-#import "RLMSyncUser+ObjectServerTests.h"

+ 0 - 22
Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/ObjectServerTests-Info.plist

@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
-	<key>CFBundleDevelopmentRegion</key>
-	<string>en</string>
-	<key>CFBundleExecutable</key>
-	<string>${EXECUTABLE_NAME}</string>
-	<key>CFBundleIdentifier</key>
-	<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
-	<key>CFBundleInfoDictionaryVersion</key>
-	<string>6.0</string>
-	<key>CFBundlePackageType</key>
-	<string>BNDL</string>
-	<key>CFBundleShortVersionString</key>
-	<string>1.0</string>
-	<key>CFBundleSignature</key>
-	<string>????</string>
-	<key>CFBundleVersion</key>
-	<string>1</string>
-</dict>
-</plist>

+ 0 - 58
Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/RLMAncillaryObjectServerTests.m

@@ -1,58 +0,0 @@
-////////////////////////////////////////////////////////////////////////////
-//
-// Copyright 2017 Realm Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////
-
-#import <XCTest/XCTest.h>
-
-#import "RLMSyncSessionRefreshHandle+ObjectServerTests.h"
-
-@interface RLMAncillaryObjectServerTests : XCTestCase
-@end
-
-@interface RLMSyncSessionRefreshHandle ()
-+ (NSDate *)fireDateForTokenExpirationDate:(NSDate *)date nowDate:(NSDate *)nowDate;
-@end
-
-@implementation RLMAncillaryObjectServerTests
-
-/// Ensure the `fireDateForTokenExpirationDate:nowDate:` method works properly.
-/// Rationale: we swizzle this method out for our end-to-end tests, so we need to verify the original works.
-- (void)testRefreshHandleDateComparison {
-    [RLMSyncSessionRefreshHandle calculateFireDateUsingTestLogic:NO blockOnRefreshCompletion:nil];
-
-    // The method should return nil if the dates are equal in value.
-    NSDate *date = [NSDate date];
-    NSDate *nowDate = [NSDate dateWithTimeIntervalSince1970:date.timeIntervalSince1970];
-    XCTAssertNil([RLMSyncSessionRefreshHandle fireDateForTokenExpirationDate:date nowDate:nowDate]);
-
-    // The method should return nil if the expiration date is in the past.
-    date = [NSDate dateWithTimeIntervalSince1970:(date.timeIntervalSince1970 - 1)];
-    XCTAssertNil([RLMSyncSessionRefreshHandle fireDateForTokenExpirationDate:date nowDate:nowDate]);
-
-    // The method should return nil if the expiration date is not far enough forward in the future.
-    date = [NSDate dateWithTimeIntervalSince1970:(date.timeIntervalSince1970 + 1)];
-    XCTAssertNil([RLMSyncSessionRefreshHandle fireDateForTokenExpirationDate:date nowDate:nowDate]);
-
-    // The method should return an actual date if the expiration date is far enough forward in the future.
-    date = [NSDate dateWithTimeIntervalSince1970:(date.timeIntervalSince1970 + 100)];
-    NSDate *fireDate = [RLMSyncSessionRefreshHandle fireDateForTokenExpirationDate:date nowDate:nowDate];
-    XCTAssertNotNil(fireDate);
-    XCTAssertGreaterThan(fireDate.timeIntervalSinceReferenceDate, nowDate.timeIntervalSinceReferenceDate);
-    XCTAssertLessThan(fireDate.timeIntervalSinceReferenceDate, date.timeIntervalSinceReferenceDate);
-}
-
-@end

+ 0 - 2451
Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/RLMObjectServerTests.mm

@@ -1,2451 +0,0 @@
-////////////////////////////////////////////////////////////////////////////
-//
-// Copyright 2016 Realm Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////
-
-#import "RLMSyncTestCase.h"
-#import "RLMTestUtils.h"
-#import "RLMSyncSessionRefreshHandle+ObjectServerTests.h"
-#import "RLMSyncUser+ObjectServerTests.h"
-
-#import "RLMObjectSchema_Private.hpp"
-#import "RLMRealm+Sync.h"
-#import "RLMRealmConfiguration_Private.h"
-#import "RLMRealmUtil.hpp"
-#import "RLMRealm_Dynamic.h"
-#import "RLMRealm_Private.hpp"
-#import "RLMSchema_Private.h"
-#import "RLMSyncUtil_Private.h"
-
-#import "shared_realm.hpp"
-
-#pragma mark - Test objects
-
-@interface PartialSyncObjectA : RLMObject
-@property NSInteger number;
-@property NSString *string;
-+ (instancetype)objectWithNumber:(NSInteger)number string:(NSString *)string;
-@end
-
-@interface PartialSyncObjectB : RLMObject
-@property NSInteger number;
-@property NSString *firstString;
-@property NSString *secondString;
-+ (instancetype)objectWithNumber:(NSInteger)number firstString:(NSString *)first secondString:(NSString *)second;
-@end
-
-@implementation PartialSyncObjectA
-+ (instancetype)objectWithNumber:(NSInteger)number string:(NSString *)string {
-    PartialSyncObjectA *object = [[PartialSyncObjectA alloc] init];
-    object.number = number;
-    object.string = string;
-    return object;
-}
-@end
-
-@implementation PartialSyncObjectB
-+ (instancetype)objectWithNumber:(NSInteger)number firstString:(NSString *)first secondString:(NSString *)second {
-    PartialSyncObjectB *object = [[PartialSyncObjectB alloc] init];
-    object.number = number;
-    object.firstString = first;
-    object.secondString = second;
-    return object;
-}
-@end
-
-@interface RLMObjectServerTests : RLMSyncTestCase
-@end
-
-@implementation RLMObjectServerTests
-
-#pragma mark - Authentication and Tokens
-
-/// Valid username/password credentials should be able to log in a user. Using the same credentials should return the
-/// same user object.
-- (void)testUsernamePasswordAuthentication {
-    RLMSyncUser *firstUser = [self logInUserForCredentials:[RLMSyncTestCase basicCredentialsWithName:NSStringFromSelector(_cmd)
-                                                                                            register:YES]
-                                                    server:[RLMSyncTestCase authServerURL]];
-    RLMSyncUser *secondUser = [self logInUserForCredentials:[RLMSyncTestCase basicCredentialsWithName:NSStringFromSelector(_cmd)
-                                                                                             register:NO]
-                                                     server:[RLMSyncTestCase authServerURL]];
-    // Two users created with the same credential should resolve to the same actual user.
-    XCTAssertTrue([firstUser.identity isEqualToString:secondUser.identity]);
-    // Authentication server property should be properly set.
-    XCTAssertEqualObjects(firstUser.authenticationServer, [RLMSyncTestCase authServerURL]);
-    XCTAssertFalse(firstUser.isAdmin);
-}
-
-/// A valid admin token should be able to log in a user.
-- (void)testAdminTokenAuthentication {
-    RLMSyncCredentials *credentials = [RLMSyncCredentials credentialsWithAccessToken:self.adminToken identity:@"test"];
-    XCTAssertNotNil(credentials);
-
-    RLMSyncUser *user = [self logInUserForCredentials:credentials server:[RLMObjectServerTests authServerURL]];
-    XCTAssertTrue(user.isAdmin);
-}
-
-- (void)testCustomRefreshTokenAuthentication {
-    RLMSyncCredentials *credentials = [RLMSyncCredentials credentialsWithCustomRefreshToken:@"token" identity:@"custom_identity1" isAdmin:NO];
-    XCTAssertNotNil(credentials);
-
-    RLMSyncUser *user = [self logInUserForCredentials:credentials server:[RLMObjectServerTests authServerURL]];
-    XCTAssertEqualObjects(user.refreshToken, @"token");
-    XCTAssertEqualObjects(user.identity, @"custom_identity1");
-    XCTAssertFalse(user.isAdmin);
-
-    credentials = [RLMSyncCredentials credentialsWithCustomRefreshToken:@"token" identity:@"custom_identity2" isAdmin:YES];
-    XCTAssertNotNil(credentials);
-
-    user = [self logInUserForCredentials:credentials server:[RLMObjectServerTests authServerURL]];
-    XCTAssertEqualObjects(user.refreshToken, @"token");
-    XCTAssertEqualObjects(user.identity, @"custom_identity2");
-    XCTAssertTrue(user.isAdmin);
-}
-
-/// An invalid username/password credential should not be able to log in a user and a corresponding error should be generated.
-- (void)testInvalidPasswordAuthentication {
-    [self logInUserForCredentials:[RLMSyncTestCase basicCredentialsWithName:NSStringFromSelector(_cmd) register:YES]
-                          server:[RLMSyncTestCase authServerURL]];
-
-    RLMSyncCredentials *credentials = [RLMSyncCredentials credentialsWithUsername:NSStringFromSelector(_cmd)
-                                                                         password:@"INVALID_PASSWORD"
-                                                                         register:NO];
-
-    XCTestExpectation *expectation = [self expectationWithDescription:@""];
-    [RLMSyncUser logInWithCredentials:credentials
-                        authServerURL:[RLMObjectServerTests authServerURL]
-                         onCompletion:^(RLMSyncUser *user, NSError *error) {
-        XCTAssertNil(user);
-        XCTAssertNotNil(error);
-        XCTAssertEqual(error.domain, RLMSyncAuthErrorDomain);
-        XCTAssertEqual(error.code, RLMSyncAuthErrorInvalidCredential);
-        XCTAssertNotNil(error.localizedDescription);
-
-        [expectation fulfill];
-    }];
-    [self waitForExpectationsWithTimeout:2.0 handler:nil];
-}
-
-/// A non-existsing user should not be able to log in and a corresponding error should be generated.
-- (void)testNonExistingUsernameAuthentication {
-    RLMSyncCredentials *credentials = [RLMSyncTestCase basicCredentialsWithName:NSStringFromSelector(_cmd)
-                                                                       register:NO];
-
-    XCTestExpectation *expectation = [self expectationWithDescription:@""];
-    [RLMSyncUser logInWithCredentials:credentials
-                        authServerURL:[RLMObjectServerTests authServerURL]
-                         onCompletion:^(RLMSyncUser *user, NSError *error) {
-        XCTAssertNil(user);
-        XCTAssertNotNil(error);
-        XCTAssertEqual(error.domain, RLMSyncAuthErrorDomain);
-        XCTAssertEqual(error.code, RLMSyncAuthErrorInvalidCredential);
-        XCTAssertNotNil(error.localizedDescription);
-
-        [expectation fulfill];
-    }];
-    [self waitForExpectationsWithTimeout:2.0 handler:nil];
-}
-
-/// Registering a user with existing username should return corresponding error.
-- (void)testExistingUsernameRegistration {
-    RLMSyncCredentials *credentials = [RLMObjectServerTests basicCredentialsWithName:NSStringFromSelector(_cmd)
-                                                                            register:YES];
-
-    [self logInUserForCredentials:credentials server:[RLMSyncTestCase authServerURL]];
-
-    XCTestExpectation *expectation = [self expectationWithDescription:@""];
-    [RLMSyncUser logInWithCredentials:credentials
-                        authServerURL:[RLMObjectServerTests authServerURL]
-                        onCompletion:^(RLMSyncUser *user, NSError *error) {
-        XCTAssertNil(user);
-        XCTAssertNotNil(error);
-        XCTAssertEqual(error.domain, RLMSyncAuthErrorDomain);
-        XCTAssertEqual(error.code, RLMSyncAuthErrorInvalidCredential);
-        XCTAssertNotNil(error.localizedDescription);
-
-        [expectation fulfill];
-    }];
-    [self waitForExpectationsWithTimeout:2.0 handler:nil];
-}
-
-/// Errors reported in RLMSyncManager.errorHandler shouldn't contain sync error domain errors as underlying error
-- (void)testSyncErrorHandlerErrorDomain {
-    RLMSyncUser *user = [self logInUserForCredentials:[RLMObjectServerTests basicCredentialsWithName:NSStringFromSelector(_cmd)
-                                                                                            register:YES]
-                                               server:[RLMObjectServerTests authServerURL]];
-    XCTAssertNotNil(user);
-
-    NSURL *realmURL = [NSURL URLWithString:@"realm://127.0.0.1:9080/THE_PATH_USER_DONT_HAVE_ACCESS_TO/test"];
-
-    RLMRealmConfiguration *c = [user configurationWithURL:realmURL fullSynchronization:true];
-
-    NSError *error = nil;
-    __attribute__((objc_precise_lifetime)) RLMRealm *realm = [RLMRealm realmWithConfiguration:c error:&error];
-    XCTAssertNil(error);
-    XCTAssertTrue(realm.isEmpty);
-
-    XCTestExpectation *expectation = [self expectationWithDescription:@""];
-    [RLMSyncManager sharedManager].errorHandler = ^(__unused NSError *error,
-                                                    __unused RLMSyncSession *session) {
-        XCTAssertTrue([error.domain isEqualToString:RLMSyncErrorDomain]);
-        XCTAssertFalse([[error.userInfo[kRLMSyncUnderlyingErrorKey] domain] isEqualToString:RLMSyncErrorDomain]);
-        [expectation fulfill];
-    };
-
-    [self waitForExpectationsWithTimeout:2.0 handler:nil];
-}
-
-/// The pre-emptive token refresh subsystem should function, and properly refresh the token.
-- (void)testPreemptiveTokenRefresh {
-    // Prepare the test.
-    __block NSInteger refreshCount = 0;
-    __block NSInteger errorCount = 0;
-    [RLMSyncManager sharedManager].errorHandler = ^(__unused NSError *error,
-                                                    __unused RLMSyncSession *session) {
-        errorCount++;
-    };
-
-    __block XCTestExpectation *ex;
-    [RLMSyncSessionRefreshHandle calculateFireDateUsingTestLogic:YES
-                                        blockOnRefreshCompletion:^(BOOL success) {
-        XCTAssertTrue(success);
-        if (refreshCount++ == 3) { // arbitrary choice; refreshes every second
-            [ex fulfill];
-        }
-    }];
-    // Open the Realm.
-    NSURL *url = REALM_URL();
-    RLMSyncUser *user = [self logInUserForCredentials:[RLMObjectServerTests basicCredentialsWithName:NSStringFromSelector(_cmd)
-                                                                                            register:true]
-                                               server:[RLMObjectServerTests authServerURL]];
-    __attribute__((objc_precise_lifetime)) RLMRealm *realm = [self openRealmForURL:url user:user];
-    ex = [self expectationWithDescription:@"Timer fired"];
-    [self waitForExpectationsWithTimeout:10 handler:nil];
-    XCTAssertTrue(errorCount == 0);
-    XCTAssertTrue(refreshCount >= 4);
-}
-
-- (void)testLoginConnectionTimeoutFromManager {
-    // First create the user, talking directly to ROS
-    NSString *userName = NSStringFromSelector(_cmd);
-    @autoreleasepool {
-        RLMSyncCredentials *credentials = [RLMObjectServerTests basicCredentialsWithName:userName register:YES];
-        RLMSyncUser *user = [self logInUserForCredentials:credentials server:[NSURL URLWithString:@"http://127.0.0.1:9080"]];
-        [user logOut];
-    }
-
-    RLMSyncTimeoutOptions *timeoutOptions = [RLMSyncTimeoutOptions new];
-
-    // 9082 is a proxy which delays responding to requests
-    NSURL *authURL = [NSURL URLWithString:@"http://127.0.0.1:9082"];
-
-    // Login attempt should time out
-    timeoutOptions.connectTimeout = 1000.0;
-    RLMSyncManager.sharedManager.timeoutOptions = timeoutOptions;
-
-    RLMSyncCredentials *credentials = [RLMObjectServerTests basicCredentialsWithName:userName register:NO];
-    XCTestExpectation *ex = [self expectationWithDescription:@"Login should time out"];
-    [RLMSyncUser logInWithCredentials:credentials authServerURL:authURL
-                         onCompletion:^(RLMSyncUser *user, NSError *error) {
-        XCTAssertNil(user);
-        XCTAssertNotNil(error);
-        XCTAssertEqualObjects(error.domain, NSURLErrorDomain);
-        XCTAssertEqual(error.code, NSURLErrorTimedOut);
-        [ex fulfill];
-    }];
-    [self waitForExpectationsWithTimeout:2.0 handler:nil];
-
-    // Login attempt should succeeed
-    timeoutOptions.connectTimeout = 3000.0;
-    RLMSyncManager.sharedManager.timeoutOptions = timeoutOptions;
-
-    ex = [self expectationWithDescription:@"Login should succeed"];
-    [RLMSyncUser logInWithCredentials:credentials authServerURL:authURL
-                         onCompletion:^(RLMSyncUser *user, NSError *error) {
-        [user logOut];
-        XCTAssertNotNil(user);
-        XCTAssertNil(error);
-        [ex fulfill];
-    }];
-    [self waitForExpectationsWithTimeout:3.0 handler:nil];
-}
-
-- (void)testLoginConnectionTimeoutDirect {
-    // First create the user, talking directly to ROS
-    NSString *userName = NSStringFromSelector(_cmd);
-    @autoreleasepool {
-        RLMSyncCredentials *credentials = [RLMObjectServerTests basicCredentialsWithName:userName register:YES];
-        RLMSyncUser *user = [self logInUserForCredentials:credentials server:[NSURL URLWithString:@"http://127.0.0.1:9080"]];
-        [user logOut];
-    }
-
-    // 9082 is a proxy which delays responding to requests
-    NSURL *authURL = [NSURL URLWithString:@"http://127.0.0.1:9082"];
-
-    // Login attempt should time out
-    RLMSyncCredentials *credentials = [RLMObjectServerTests basicCredentialsWithName:userName register:NO];
-    XCTestExpectation *ex = [self expectationWithDescription:@"Login should time out"];
-    [RLMSyncUser logInWithCredentials:credentials authServerURL:authURL
-                              timeout:1.0 callbackQueue:dispatch_get_main_queue()
-                         onCompletion:^(RLMSyncUser *user, NSError *error) {
-        XCTAssertNil(user);
-        XCTAssertNotNil(error);
-        XCTAssertEqualObjects(error.domain, NSURLErrorDomain);
-        XCTAssertEqual(error.code, NSURLErrorTimedOut);
-        [ex fulfill];
-    }];
-    [self waitForExpectationsWithTimeout:2.0 handler:nil];
-
-    // Login attempt should succeeed
-    ex = [self expectationWithDescription:@"Login should succeed"];
-    [RLMSyncUser logInWithCredentials:credentials authServerURL:authURL
-                              timeout:3.0 callbackQueue:dispatch_get_main_queue()
-                         onCompletion:^(RLMSyncUser *user, NSError *error) {
-        [user logOut];
-        XCTAssertNotNil(user);
-        XCTAssertNil(error);
-        [ex fulfill];
-    }];
-    [self waitForExpectationsWithTimeout:3.0 handler:nil];
-}
-
-#pragma mark - Users
-
-/// `[RLMSyncUser all]` should be updated once a user is logged in.
-- (void)testBasicUserPersistence {
-    XCTAssertNil([RLMSyncUser currentUser]);
-    XCTAssertEqual([[RLMSyncUser allUsers] count], 0U);
-    RLMSyncUser *user = [self logInUserForCredentials:[RLMObjectServerTests basicCredentialsWithName:NSStringFromSelector(_cmd)
-                                                                                            register:YES]
-                                               server:[RLMObjectServerTests authServerURL]];
-    XCTAssertNotNil(user);
-    XCTAssertEqual([[RLMSyncUser allUsers] count], 1U);
-    XCTAssertEqualObjects([RLMSyncUser allUsers], @{user.identity: user});
-    XCTAssertEqualObjects([RLMSyncUser currentUser], user);
-
-    RLMSyncUser *user2 = [self logInUserForCredentials:[RLMObjectServerTests basicCredentialsWithName:[NSStringFromSelector(_cmd) stringByAppendingString:@"2"]
-                                                                                             register:YES]
-                                               server:[RLMObjectServerTests authServerURL]];
-    XCTAssertEqual([[RLMSyncUser allUsers] count], 2U);
-    NSDictionary *dict2 = @{user.identity: user, user2.identity: user2};
-    XCTAssertEqualObjects([RLMSyncUser allUsers], dict2);
-    RLMAssertThrowsWithReasonMatching([RLMSyncUser currentUser], @"currentUser cannot be called if more that one valid, logged-in user exists");
-}
-
-/// `[RLMSyncUser currentUser]` should become nil if the user is logged out.
-- (void)testCurrentUserLogout {
-    XCTAssertNil([RLMSyncUser currentUser]);
-    RLMSyncUser *user = [self logInUserForCredentials:[RLMObjectServerTests basicCredentialsWithName:NSStringFromSelector(_cmd)
-                                                                                            register:YES]
-                                               server:[RLMObjectServerTests authServerURL]];
-    XCTAssertNotNil(user);
-    XCTAssertEqualObjects([RLMSyncUser currentUser], user);
-    [user logOut];
-    XCTAssertNil([RLMSyncUser currentUser]);
-}
-
-/// A sync user should return a session when asked for it based on the path.
-- (void)testUserGetSessionForValidURL {
-    RLMSyncUser *user = [self logInUserForCredentials:[RLMObjectServerTests basicCredentialsWithName:NSStringFromSelector(_cmd)
-                                                                                            register:YES]
-                                               server:[RLMObjectServerTests authServerURL]];
-    NSURL *url = REALM_URL();
-    [self openRealmForURL:url user:user immediatelyBlock:^{
-        RLMSyncSession *session = [user sessionForURL:url];
-        XCTAssertNotNil(session);
-    }];
-    // Check session existence after binding.
-    RLMSyncSession *session = [user sessionForURL:url];
-    XCTAssertNotNil(session);
-}
-
-/// A sync user should return nil when asked for a URL that doesn't exist.
-- (void)testUserGetSessionForInvalidURL {
-    RLMSyncUser *user = [self logInUserForCredentials:[RLMObjectServerTests basicCredentialsWithName:NSStringFromSelector(_cmd)
-                                                                                            register:YES]
-                                               server:[RLMObjectServerTests authServerURL]];
-    RLMSyncSession *badSession = [user sessionForURL:[NSURL URLWithString:@"realm://127.0.0.1:9080/noSuchRealm"]];
-    XCTAssertNil(badSession);
-}
-
-/// A sync user should be able to successfully change their own password.
-- (void)testUserChangePassword {
-    NSString *userName = NSStringFromSelector(_cmd);
-    NSString *firstPassword = @"a";
-    NSString *secondPassword = @"b";
-    // Successfully create user, change its password, log out,
-    // then fail to change password again due to being logged out.
-    {
-        RLMSyncCredentials *creds = [RLMSyncCredentials credentialsWithUsername:userName password:firstPassword
-                                                                       register:YES];
-        RLMSyncUser *user = [self logInUserForCredentials:creds
-                                                   server:[RLMObjectServerTests authServerURL]];
-        XCTestExpectation *ex = [self expectationWithDescription:@"change password callback invoked"];
-        [user changePassword:secondPassword completion:^(NSError * _Nullable error) {
-            XCTAssertNil(error);
-            [ex fulfill];
-        }];
-        [self waitForExpectationsWithTimeout:2.0 handler:nil];
-        [user logOut];
-        ex = [self expectationWithDescription:@"change password callback invoked"];
-        [user changePassword:@"fail" completion:^(NSError * _Nullable error) {
-            XCTAssertNotNil(error);
-            [ex fulfill];
-        }];
-        [self waitForExpectationsWithTimeout:2.0 handler:nil];
-    }
-    // Fail to log in with original password.
-    {
-        RLMSyncCredentials *creds = [RLMSyncCredentials credentialsWithUsername:userName password:firstPassword
-                                                                       register:NO];
-
-        XCTestExpectation *ex = [self expectationWithDescription:@"login callback invoked"];
-        [RLMSyncUser logInWithCredentials:creds
-                            authServerURL:[RLMObjectServerTests authServerURL]
-                             onCompletion:^(RLMSyncUser *user, NSError *error) {
-            XCTAssertNil(user);
-            XCTAssertNotNil(error);
-            XCTAssertEqual(error.domain, RLMSyncAuthErrorDomain);
-            XCTAssertEqual(error.code, RLMSyncAuthErrorInvalidCredential);
-            XCTAssertNotNil(error.localizedDescription);
-
-            [ex fulfill];
-        }];
-        [self waitForExpectationsWithTimeout:2.0 handler:nil];
-    }
-    // Successfully log in with new password.
-    {
-        RLMSyncCredentials *creds = [RLMSyncCredentials credentialsWithUsername:userName password:secondPassword
-                                                                       register:NO];
-        RLMSyncUser *user = [self logInUserForCredentials:creds server:[RLMObjectServerTests authServerURL]];
-        XCTAssertNotNil(user);
-        XCTAssertEqualObjects(RLMSyncUser.currentUser, user);
-        [user logOut];
-        XCTAssertNil(RLMSyncUser.currentUser);
-    }
-}
-
-/// A sync admin user should be able to successfully change another user's password.
-- (void)testOtherUserChangePassword {
-    // Create admin user.
-    NSURL *url = [RLMObjectServerTests authServerURL];
-    RLMSyncUser *adminUser = [self createAdminUserForURL:url username:[[NSUUID UUID] UUIDString]];
-
-    NSString *username = NSStringFromSelector(_cmd);
-    NSString *firstPassword = @"a";
-    NSString *secondPassword = @"b";
-    NSString *nonAdminUserID = nil;
-    // Successfully create user.
-    {
-        RLMSyncCredentials *creds = [RLMSyncCredentials credentialsWithUsername:username
-                                                                       password:firstPassword
-                                                                       register:YES];
-        RLMSyncUser *user = [self logInUserForCredentials:creds server:url];
-        nonAdminUserID = user.identity;
-        [user logOut];
-    }
-    // Fail to change password from non-admin user.
-    {
-        NSString *username2 = [NSString stringWithFormat:@"%@_2", username];
-        RLMSyncCredentials *creds2 = [RLMSyncCredentials credentialsWithUsername:username2
-                                                                             password:@"a"
-                                                                             register:YES];
-        RLMSyncUser *user2 = [self logInUserForCredentials:creds2 server:url];
-        XCTestExpectation *ex = [self expectationWithDescription:@"change password callback invoked"];
-        [user2 changePassword:@"foobar" forUserID:nonAdminUserID completion:^(NSError *error) {
-            XCTAssertNotNil(error);
-            [ex fulfill];
-        }];
-        [self waitForExpectationsWithTimeout:2.0 handler:nil];
-    }
-    // Change password from admin user.
-    {
-        XCTestExpectation *ex = [self expectationWithDescription:@"change password callback invoked"];
-        [adminUser changePassword:secondPassword forUserID:nonAdminUserID completion:^(NSError *error) {
-            XCTAssertNil(error);
-            [ex fulfill];
-        }];
-        [self waitForExpectationsWithTimeout:2.0 handler:nil];
-    }
-    // Fail to log in with original password.
-    {
-        RLMSyncCredentials *creds = [RLMSyncCredentials credentialsWithUsername:username
-                                                                       password:firstPassword
-                                                                       register:NO];
-
-        XCTestExpectation *ex = [self expectationWithDescription:@"login callback invoked"];
-        [RLMSyncUser logInWithCredentials:creds
-                            authServerURL:[RLMObjectServerTests authServerURL]
-                             onCompletion:^(RLMSyncUser *user, NSError *error) {
-            XCTAssertNil(user);
-            XCTAssertNotNil(error);
-            XCTAssertEqual(error.domain, RLMSyncAuthErrorDomain);
-            XCTAssertEqual(error.code, RLMSyncAuthErrorInvalidCredential);
-            XCTAssertNotNil(error.localizedDescription);
-
-            [ex fulfill];
-        }];
-        [self waitForExpectationsWithTimeout:2.0 handler:nil];
-    }
-    // Successfully log in with new password.
-    {
-        RLMSyncCredentials *creds = [RLMSyncCredentials credentialsWithUsername:username
-                                                                       password:secondPassword
-                                                                       register:NO];
-        RLMSyncUser *user = [self logInUserForCredentials:creds server:[RLMObjectServerTests authServerURL]];
-        XCTAssertNotNil(user);
-        [user logOut];
-    }
-}
-
-- (void)testRequestPasswordResetForRegisteredUser {
-    NSString *userName = [NSStringFromSelector(_cmd) stringByAppendingString:@"@example.com"];
-    RLMSyncCredentials *creds = [RLMSyncCredentials credentialsWithUsername:userName password:@"a" register:YES];
-    [[self logInUserForCredentials:creds server:[RLMObjectServerTests authServerURL]] logOut];
-
-    XCTestExpectation *ex = [self expectationWithDescription:@"callback invoked"];
-    [RLMSyncUser requestPasswordResetForAuthServer:[RLMObjectServerTests authServerURL] userEmail:userName completion:^(NSError *error) {
-        XCTAssertNil(error);
-        [ex fulfill];
-    }];
-    [self waitForExpectationsWithTimeout:2.0 handler:nil];
-
-    NSString *token = [self emailForAddress:userName];
-    XCTAssertNotNil(token);
-
-    // Use the password reset token
-    ex = [self expectationWithDescription:@"callback invoked"];
-    [RLMSyncUser completePasswordResetForAuthServer:[RLMObjectServerTests authServerURL] token:token password:@"new password"
-                                         completion:^(NSError *error) {
-                                             XCTAssertNil(error);
-                                             [ex fulfill];
-                                         }];
-    [self waitForExpectationsWithTimeout:2.0 handler:nil];
-
-    // Should now be able to log in with the new password
-    {
-        RLMSyncCredentials *creds = [RLMSyncCredentials credentialsWithUsername:userName
-                                                                       password:@"new password"
-                                                                       register:NO];
-        RLMSyncUser *user = [self logInUserForCredentials:creds server:[RLMObjectServerTests authServerURL]];
-        XCTAssertNotNil(user);
-        [user logOut];
-    }
-
-    // Reusing the token should fail
-    ex = [self expectationWithDescription:@"callback invoked"];
-    [RLMSyncUser completePasswordResetForAuthServer:[RLMObjectServerTests authServerURL] token:token password:@"new password 2"
-                                         completion:^(NSError *error) {
-                                             XCTAssertNotNil(error);
-                                             [ex fulfill];
-                                         }];
-    [self waitForExpectationsWithTimeout:2.0 handler:nil];
-}
-
-- (void)testRequestPasswordResetForNonexistentUser {
-    NSString *userName = [NSStringFromSelector(_cmd) stringByAppendingString:@"@example.com"];
-
-    XCTestExpectation *ex = [self expectationWithDescription:@"callback invoked"];
-    [RLMSyncUser requestPasswordResetForAuthServer:[RLMObjectServerTests authServerURL] userEmail:userName completion:^(NSError *error) {
-        // Not an error even though the user doesn't exist
-        XCTAssertNil(error);
-        [ex fulfill];
-    }];
-    [self waitForExpectationsWithTimeout:2.0 handler:nil];
-
-    // Should not have sent an email to the non-registered user
-    XCTAssertNil([self emailForAddress:userName]);
-}
-
-- (void)testRequestPasswordResetWithBadAuthURL {
-    NSString *userName = [NSStringFromSelector(_cmd) stringByAppendingString:@"@example.com"];
-
-    XCTestExpectation *ex = [self expectationWithDescription:@"callback invoked"];
-    NSURL *badAuthUrl = [[RLMObjectServerTests authServerURL] URLByAppendingPathComponent:@"/bad"];
-    [RLMSyncUser requestPasswordResetForAuthServer:badAuthUrl userEmail:userName completion:^(NSError *error) {
-        XCTAssertNotNil(error);
-        XCTAssertEqualObjects(error.userInfo[@"statusCode"], @404);
-        [ex fulfill];
-    }];
-    [self waitForExpectationsWithTimeout:2.0 handler:nil];
-}
-
-- (void)testRequestConfirmEmailForRegisteredUser {
-    NSString *userName = [NSStringFromSelector(_cmd) stringByAppendingString:@"@example.com"];
-    RLMSyncCredentials *creds = [RLMSyncCredentials credentialsWithUsername:userName password:@"a" register:YES];
-    [[self logInUserForCredentials:creds server:[RLMObjectServerTests authServerURL]] logOut];
-
-    // This token is sent by ROS upon user registration
-    NSString *registrationToken = [self emailForAddress:userName];
-    XCTAssertNotNil(registrationToken);
-
-    XCTestExpectation *ex = [self expectationWithDescription:@"callback invoked"];
-    [RLMSyncUser requestEmailConfirmationForAuthServer:[RLMObjectServerTests authServerURL]
-                                             userEmail:userName completion:^(NSError *error) {
-                                                 XCTAssertNil(error);
-                                                 [ex fulfill];
-                                             }];
-    [self waitForExpectationsWithTimeout:2.0 handler:nil];
-
-    // This token should have been created when requestEmailConfirmationForAuthServer was called
-    NSString *token = [self emailForAddress:userName];
-    XCTAssertNotNil(token);
-    XCTAssertNotEqual(token, registrationToken);
-
-    // Use the token
-    ex = [self expectationWithDescription:@"callback invoked"];
-    [RLMSyncUser confirmEmailForAuthServer:[RLMObjectServerTests authServerURL] token:token
-                                            completion:^(NSError *error) {
-                                                XCTAssertNil(error);
-                                                [ex fulfill];
-                                            }];
-    [self waitForExpectationsWithTimeout:2.0 handler:nil];
-
-    // Reusing the token should fail
-    ex = [self expectationWithDescription:@"callback invoked"];
-    [RLMSyncUser confirmEmailForAuthServer:[RLMObjectServerTests authServerURL] token:token
-                                            completion:^(NSError *error) {
-                                                XCTAssertNotNil(error);
-                                                [ex fulfill];
-                                            }];
-    [self waitForExpectationsWithTimeout:2.0 handler:nil];
-}
-
-- (void)testRequestConfirmEmailForNonexistentUser {
-    NSString *userName = [NSStringFromSelector(_cmd) stringByAppendingString:@"@example.com"];
-
-    XCTestExpectation *ex = [self expectationWithDescription:@"callback invoked"];
-    [RLMSyncUser requestEmailConfirmationForAuthServer:[RLMObjectServerTests authServerURL]
-                                             userEmail:userName completion:^(NSError *error) {
-                                                 // Not an error even though the user doesn't exist
-                                                 XCTAssertNil(error);
-                                                 [ex fulfill];
-                                             }];
-    [self waitForExpectationsWithTimeout:2.0 handler:nil];
-
-    // Should not have sent an email to the non-registered user
-    XCTAssertNil([self emailForAddress:userName]);
-}
-
-/// A sync admin user should be able to retrieve information about other users.
-- (void)testRetrieveUserInfo {
-    NSString *nonAdminUsername = @"meela@realm.example.org";
-    NSString *adminUsername = @"jyaku";
-    NSString *pw = @"p";
-    NSURL *server = [RLMObjectServerTests authServerURL];
-
-    // Create a non-admin user.
-    RLMSyncCredentials *c1 = [RLMSyncCredentials credentialsWithUsername:nonAdminUsername password:pw register:YES];
-    RLMSyncUser *nonAdminUser = [self logInUserForCredentials:c1 server:server];
-
-    // Create an admin user.
-    __unused RLMSyncUser *adminUser = [self createAdminUserForURL:server username:adminUsername];
-
-    // Create another admin user.
-    RLMSyncUser *userDoingLookups = [self createAdminUserForURL:server username:[[NSUUID UUID] UUIDString]];
-
-    // Get the non-admin user's info.
-    XCTestExpectation *ex1 = [self expectationWithDescription:@"should be able to get info about non-admin user"];
-    [userDoingLookups retrieveInfoForUser:nonAdminUsername
-                         identityProvider:RLMIdentityProviderUsernamePassword
-                               completion:^(RLMSyncUserInfo *info, NSError *err) {
-                                   XCTAssertNil(err);
-                                   XCTAssertNotNil(info);
-                                   XCTAssertGreaterThan([info.accounts count], ((NSUInteger) 0));
-                                   RLMSyncUserAccountInfo *acctInfo = [info.accounts firstObject];
-                                   XCTAssertEqualObjects(acctInfo.providerUserIdentity, nonAdminUsername);
-                                   XCTAssertEqualObjects(acctInfo.provider, RLMIdentityProviderUsernamePassword);
-                                   XCTAssertFalse(info.isAdmin);
-                                   [ex1 fulfill];
-                               }];
-    [self waitForExpectationsWithTimeout:10 handler:nil];
-
-    // Get the admin user's info.
-    XCTestExpectation *ex2 = [self expectationWithDescription:@"should be able to get info about admin user"];
-    [userDoingLookups retrieveInfoForUser:adminUsername
-                         identityProvider:RLMIdentityProviderDebug
-                               completion:^(RLMSyncUserInfo *info, NSError *err) {
-                                   XCTAssertNil(err);
-                                   XCTAssertNotNil(info);
-                                   XCTAssertGreaterThan([info.accounts count], ((NSUInteger) 0));
-                                   RLMSyncUserAccountInfo *acctInfo = [info.accounts firstObject];
-                                   XCTAssertEqualObjects(acctInfo.providerUserIdentity, adminUsername);
-                                   XCTAssertEqualObjects(acctInfo.provider, RLMIdentityProviderDebug);
-                                   XCTAssertTrue(info.isAdmin);
-                                   [ex2 fulfill];
-                               }];
-    [self waitForExpectationsWithTimeout:10 handler:nil];
-
-    // Get invalid user's info.
-    XCTestExpectation *ex3 = [self expectationWithDescription:@"should fail for non-existent user"];
-    [userDoingLookups retrieveInfoForUser:@"invalid_user@realm.example.org"
-                         identityProvider:RLMIdentityProviderUsernamePassword
-                               completion:^(RLMSyncUserInfo *info, NSError *err) {
-                                   XCTAssertNotNil(err);
-                                   XCTAssertEqualObjects(err.domain, RLMSyncAuthErrorDomain);
-                                   XCTAssertEqual(err.code, RLMSyncAuthErrorUserDoesNotExist);
-                                   XCTAssertNil(info);
-                                   [ex3 fulfill];
-                               }];
-    [self waitForExpectationsWithTimeout:10 handler:nil];
-
-    // Get info using user without admin privileges.
-    XCTestExpectation *ex4 = [self expectationWithDescription:@"should fail for user without admin privileges"];
-    [nonAdminUser retrieveInfoForUser:adminUsername
-                     identityProvider:RLMIdentityProviderUsernamePassword
-                           completion:^(RLMSyncUserInfo *info, NSError *err) {
-                               XCTAssertNotNil(err);
-                               XCTAssertEqualObjects(err.domain, RLMSyncAuthErrorDomain);
-                               // FIXME: Shouldn't this be RLMSyncAuthErrorAccessDeniedOrInvalidPath?
-                               XCTAssertEqual(err.code, RLMSyncAuthErrorUserDoesNotExist);
-                               XCTAssertNil(info);
-                               [ex4 fulfill];
-                           }];
-    [self waitForExpectationsWithTimeout:10 handler:nil];
-}
-
-/// The login queue argument should be respected.
-- (void)testLoginQueueForSuccessfulLogin {
-    // Make global queue
-    dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
-
-    RLMSyncCredentials *c1 = [RLMSyncCredentials credentialsWithUsername:[[NSUUID UUID] UUIDString]
-                                                                password:@"p"
-                                                                register:YES];
-    XCTestExpectation *ex1 = [self expectationWithDescription:@"User logs in successfully on background queue"];
-    [RLMSyncUser logInWithCredentials:c1
-                        authServerURL:[RLMObjectServerTests authServerURL]
-                              timeout:30.0
-                        callbackQueue:queue
-                         onCompletion:^(RLMSyncUser *user, __unused NSError *error) {
-                             XCTAssertNotNil(user);
-                             XCTAssertFalse([NSThread isMainThread]);
-                             [ex1 fulfill];
-                         }];
-    [self waitForExpectationsWithTimeout:2.0 handler:nil];
-
-    RLMSyncCredentials *c2 = [RLMSyncCredentials credentialsWithUsername:[[NSUUID UUID] UUIDString]
-                                                                password:@"p"
-                                                                register:YES];
-    XCTestExpectation *ex2 = [self expectationWithDescription:@"User logs in successfully on main queue"];
-    [RLMSyncUser logInWithCredentials:c2
-                        authServerURL:[RLMObjectServerTests authServerURL]
-                              timeout:30.0
-                        callbackQueue:dispatch_get_main_queue()
-                         onCompletion:^(RLMSyncUser *user, __unused NSError *error) {
-                             XCTAssertNotNil(user);
-                             XCTAssertTrue([NSThread isMainThread]);
-                             [ex2 fulfill];
-                         }];
-    [self waitForExpectationsWithTimeout:2.0 handler:nil];
-}
-
-/// The login queue argument should be respected.
-- (void)testLoginQueueForFailedLogin {
-    // Make global queue
-    dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
-
-    RLMSyncCredentials *c1 = [RLMSyncCredentials credentialsWithUsername:[[NSUUID UUID] UUIDString]
-                                                                password:@"p"
-                                                                register:NO];
-    XCTestExpectation *ex1 = [self expectationWithDescription:@"Error returned on background queue"];
-    [RLMSyncUser logInWithCredentials:c1
-                        authServerURL:[RLMObjectServerTests authServerURL]
-                              timeout:30.0
-                        callbackQueue:queue
-                         onCompletion:^(__unused RLMSyncUser *user, NSError *error) {
-                             XCTAssertNotNil(error);
-                             XCTAssertFalse([NSThread isMainThread]);
-                             [ex1 fulfill];
-                         }];
-    [self waitForExpectationsWithTimeout:2.0 handler:nil];
-
-    RLMSyncCredentials *c2 = [RLMSyncCredentials credentialsWithUsername:[[NSUUID UUID] UUIDString]
-                                                                password:@"p"
-                                                                register:NO];
-    XCTestExpectation *ex2 = [self expectationWithDescription:@"Error returned on main queue"];
-    [RLMSyncUser logInWithCredentials:c2
-                        authServerURL:[RLMObjectServerTests authServerURL]
-                              timeout:30.0
-                        callbackQueue:dispatch_get_main_queue()
-                         onCompletion:^(__unused RLMSyncUser *user, NSError *error) {
-                             XCTAssertNotNil(error);
-                             XCTAssertTrue([NSThread isMainThread]);
-                             [ex2 fulfill];
-                         }];
-    [self waitForExpectationsWithTimeout:2.0 handler:nil];
-}
-
-- (void)testUserExpirationCallback {
-    NSString *username = NSStringFromSelector(_cmd);
-    RLMSyncCredentials *credentials = [RLMSyncCredentials credentialsWithUsername:username
-                                                                         password:@"a"
-                                                                         register:YES];
-    RLMSyncUser *user = [self logInUserForCredentials:credentials
-                                               server:[RLMObjectServerTests authServerURL]];
-
-    XCTestExpectation *ex = [self expectationWithDescription:@"callback should fire"];
-    // Set a callback on the user
-    __weak RLMSyncUser *weakUser = user;
-    user.errorHandler = ^(RLMSyncUser *u, NSError *error) {
-        XCTAssertEqualObjects(u.identity, weakUser.identity);
-        // Make sure we get the right error.
-        XCTAssertEqualObjects(error.domain, RLMSyncAuthErrorDomain);
-        XCTAssertEqual(error.code, RLMSyncAuthErrorAccessDeniedOrInvalidPath);
-        [ex fulfill];
-    };
-
-    // Screw up the token on the user using a debug API
-    [self manuallySetRefreshTokenForUser:user value:@"not_a_real_refresh_token"];
-
-    // Try to log in a Realm; this will cause our errorHandler block defined above to be fired.
-    __attribute__((objc_precise_lifetime)) RLMRealm *r = [self immediatelyOpenRealmForURL:REALM_URL() user:user];
-    [self waitForExpectationsWithTimeout:10.0 handler:nil];
-    XCTAssertTrue(user.state == RLMSyncUserStateLoggedOut);
-}
-
-#pragma mark - Basic Sync
-
-/// It should be possible to successfully open a Realm configured for sync with an access token.
-- (void)testOpenRealmWithAdminToken {
-    // FIXME (tests): opening a Realm with the access token, then opening a Realm at the same virtual path
-    // with normal credentials, causes Realms to fail to bind with a "bad virtual path" error.
-    RLMSyncCredentials *credentials = [RLMSyncCredentials credentialsWithAccessToken:self.adminToken identity:@"test"];
-    XCTAssertNotNil(credentials);
-    RLMSyncUser *user = [self logInUserForCredentials:credentials
-                                               server:[RLMObjectServerTests authServerURL]];
-    NSURL *url = [NSURL URLWithString:@"realm://127.0.0.1:9080/testSyncWithAdminToken"];
-    RLMRealmConfiguration *c = [user configurationWithURL:url fullSynchronization:YES];
-    NSError *error = nil;
-    RLMRealm *realm = [RLMRealm realmWithConfiguration:c error:&error];
-    XCTAssertNil(error);
-    XCTAssertTrue(realm.isEmpty);
-}
-
-/// It should be possible to successfully open a Realm configured for sync with a normal user.
-- (void)testOpenRealmWithNormalCredentials {
-    RLMSyncUser *user = [self logInUserForCredentials:[RLMObjectServerTests basicCredentialsWithName:NSStringFromSelector(_cmd)
-                                                                                            register:YES]
-                                               server:[RLMObjectServerTests authServerURL]];
-    NSURL *url = REALM_URL();
-    RLMRealm *realm = [self openRealmForURL:url user:user];
-    XCTAssertTrue(realm.isEmpty);
-}
-
-/// If client B adds objects to a synced Realm, client A should see those objects.
-- (void)testAddObjects {
-    NSURL *url = REALM_URL();
-    RLMSyncUser *user = [self logInUserForCredentials:[RLMObjectServerTests basicCredentialsWithName:NSStringFromSelector(_cmd)
-                                                                                            register:self.isParent]
-                                              server:[RLMObjectServerTests authServerURL]];
-    RLMRealm *realm = [self openRealmForURL:url user:user];
-    if (self.isParent) {
-        CHECK_COUNT(0, SyncObject, realm);
-        RLMRunChildAndWait();
-        [self waitForDownloadsForUser:user realms:@[realm] realmURLs:@[url] expectedCounts:@[@3]];
-    } else {
-        // Add objects.
-        [self addSyncObjectsToRealm:realm descriptions:@[@"child-1", @"child-2", @"child-3"]];
-        [self waitForUploadsForRealm:realm];
-        CHECK_COUNT(3, SyncObject, realm);
-    }
-}
-
-/// If client B deletes objects from a synced Realm, client A should see the effects of that deletion.
-- (void)testDeleteObjects {
-    NSURL *url = REALM_URL();
-    RLMSyncUser *user = [self logInUserForCredentials:[RLMObjectServerTests basicCredentialsWithName:NSStringFromSelector(_cmd)
-                                                                                            register:self.isParent]
-                                               server:[RLMObjectServerTests authServerURL]];
-    RLMRealm *realm = [self openRealmForURL:url user:user];
-    if (self.isParent) {
-        // Add objects.
-        [self addSyncObjectsToRealm:realm descriptions:@[@"parent-1", @"parent-2", @"parent-3"]];
-        [self waitForUploadsForRealm:realm];
-        CHECK_COUNT(3, SyncObject, realm);
-        RLMRunChildAndWait();
-        [self waitForDownloadsForRealm:realm];
-        CHECK_COUNT(0, SyncObject, realm);
-    } else {
-        [self waitForDownloadsForRealm:realm];
-        CHECK_COUNT(3, SyncObject, realm);
-        [realm beginWriteTransaction];
-        [realm deleteAllObjects];
-        [realm commitWriteTransaction];
-        [self waitForUploadsForRealm:realm];
-        CHECK_COUNT(0, SyncObject, realm);
-    }
-}
-
-#pragma mark - Encryption
-
-/// If client B encrypts its synced Realm, client A should be able to access that Realm with a different encryption key.
-- (void)testEncryptedSyncedRealm {
-    NSURL *url = REALM_URL();
-    RLMSyncUser *user = [self logInUserForCredentials:[RLMObjectServerTests basicCredentialsWithName:NSStringFromSelector(_cmd)
-                                                                                            register:self.isParent]
-                                               server:[RLMObjectServerTests authServerURL]];
-
-    NSData *key = RLMGenerateKey();
-    RLMRealm *realm = [self openRealmForURL:url user:user encryptionKey:key
-                                 stopPolicy:RLMSyncStopPolicyAfterChangesUploaded immediatelyBlock:nil];
-    if (self.isParent) {
-        CHECK_COUNT(0, SyncObject, realm);
-        RLMRunChildAndWait();
-        [self waitForDownloadsForUser:user realms:@[realm] realmURLs:@[url] expectedCounts:@[@3]];
-    } else {
-        // Add objects.
-        [self addSyncObjectsToRealm:realm descriptions:@[@"child-1", @"child-2", @"child-3"]];
-        [self waitForUploadsForRealm:realm];
-        CHECK_COUNT(3, SyncObject, realm);
-    }
-}
-
-/// If an encrypted synced Realm is re-opened with the wrong key, throw an exception.
-- (void)testEncryptedSyncedRealmWrongKey {
-    NSURL *url = REALM_URL();
-    RLMSyncUser *user = [self logInUserForCredentials:[RLMObjectServerTests basicCredentialsWithName:NSStringFromSelector(_cmd)
-                                                                                            register:self.isParent]
-                                               server:[RLMObjectServerTests authServerURL]];
-
-    if (self.isParent) {
-        NSString *path;
-        @autoreleasepool {
-            RLMRealm *realm = [self openRealmForURL:url user:user encryptionKey:RLMGenerateKey()
-                                         stopPolicy:RLMSyncStopPolicyImmediately immediatelyBlock:nil];
-            path = realm.configuration.pathOnDisk;
-            CHECK_COUNT(0, SyncObject, realm);
-            RLMRunChildAndWait();
-            [self waitForDownloadsForUser:user realms:@[realm] realmURLs:@[url] expectedCounts:@[@3]];
-        }
-        RLMRealmConfiguration *c = [RLMRealmConfiguration defaultConfiguration];
-        c.fileURL = [NSURL fileURLWithPath:path];
-        RLMAssertThrowsWithError([RLMRealm realmWithConfiguration:c error:nil],
-                                 @"Unable to open a realm at path",
-                                 RLMErrorFileAccess,
-                                 @"invalid mnemonic");
-        c.encryptionKey = RLMGenerateKey();
-        RLMAssertThrowsWithError([RLMRealm realmWithConfiguration:c error:nil],
-                                 @"Unable to open a realm at path",
-                                 RLMErrorFileAccess,
-                                 @"Realm file decryption failed");
-    } else {
-        RLMRealm *realm = [self openRealmForURL:url user:user encryptionKey:RLMGenerateKey()
-                                     stopPolicy:RLMSyncStopPolicyImmediately immediatelyBlock:nil];
-        [self addSyncObjectsToRealm:realm descriptions:@[@"child-1", @"child-2", @"child-3"]];
-        [self waitForUploadsForRealm:realm];
-        CHECK_COUNT(3, SyncObject, realm);
-    }
-}
-
-#pragma mark - Multiple Realm Sync
-
-/// If a client opens multiple Realms, there should be one session object for each Realm that was opened.
-- (void)testMultipleRealmsSessions {
-    NSURL *urlA = CUSTOM_REALM_URL(@"a");
-    NSURL *urlB = CUSTOM_REALM_URL(@"b");
-    NSURL *urlC = CUSTOM_REALM_URL(@"c");
-    RLMSyncUser *user = [self logInUserForCredentials:[RLMObjectServerTests basicCredentialsWithName:NSStringFromSelector(_cmd)
-                                                                                            register:self.isParent]
-                                               server:[RLMObjectServerTests authServerURL]];
-    // Open three Realms.
-    __attribute__((objc_precise_lifetime)) RLMRealm *realmealmA = [self openRealmForURL:urlA user:user];
-    __attribute__((objc_precise_lifetime)) RLMRealm *realmealmB = [self openRealmForURL:urlB user:user];
-    __attribute__((objc_precise_lifetime)) RLMRealm *realmealmC = [self openRealmForURL:urlC user:user];
-    // Make sure there are three active sessions for the user.
-    XCTAssert(user.allSessions.count == 3, @"Expected 3 sessions, but didn't get 3 sessions");
-    XCTAssertNotNil([user sessionForURL:urlA], @"Expected to get a session for URL A");
-    XCTAssertNotNil([user sessionForURL:urlB], @"Expected to get a session for URL B");
-    XCTAssertNotNil([user sessionForURL:urlC], @"Expected to get a session for URL C");
-    XCTAssertTrue([user sessionForURL:urlA].state == RLMSyncSessionStateActive, @"Expected active session for URL A");
-    XCTAssertTrue([user sessionForURL:urlB].state == RLMSyncSessionStateActive, @"Expected active session for URL B");
-    XCTAssertTrue([user sessionForURL:urlC].state == RLMSyncSessionStateActive, @"Expected active session for URL C");
-}
-
-/// A client should be able to open multiple Realms and add objects to each of them.
-- (void)testMultipleRealmsAddObjects {
-    NSURL *urlA = CUSTOM_REALM_URL(@"a");
-    NSURL *urlB = CUSTOM_REALM_URL(@"b");
-    NSURL *urlC = CUSTOM_REALM_URL(@"c");
-    RLMSyncUser *user = [self logInUserForCredentials:[RLMObjectServerTests basicCredentialsWithName:NSStringFromSelector(_cmd)
-                                                                                            register:self.isParent]
-                                               server:[RLMObjectServerTests authServerURL]];
-    RLMRealm *realmA = [self openRealmForURL:urlA user:user];
-    RLMRealm *realmB = [self openRealmForURL:urlB user:user];
-    RLMRealm *realmC = [self openRealmForURL:urlC user:user];
-    if (self.isParent) {
-        [self waitForDownloadsForRealm:realmA];
-        [self waitForDownloadsForRealm:realmB];
-        [self waitForDownloadsForRealm:realmC];
-        CHECK_COUNT(0, SyncObject, realmA);
-        CHECK_COUNT(0, SyncObject, realmB);
-        CHECK_COUNT(0, SyncObject, realmC);
-        RLMRunChildAndWait();
-        [self waitForDownloadsForUser:user
-                               realms:@[realmA, realmB, realmC]
-                            realmURLs:@[urlA, urlB, urlC]
-                       expectedCounts:@[@3, @2, @5]];
-    } else {
-        // Add objects.
-        [self addSyncObjectsToRealm:realmA
-                       descriptions:@[@"child-A1", @"child-A2", @"child-A3"]];
-        [self addSyncObjectsToRealm:realmB
-                       descriptions:@[@"child-B1", @"child-B2"]];
-        [self addSyncObjectsToRealm:realmC
-                       descriptions:@[@"child-C1", @"child-C2", @"child-C3", @"child-C4", @"child-C5"]];
-        [self waitForUploadsForRealm:realmA];
-        [self waitForUploadsForRealm:realmB];
-        [self waitForUploadsForRealm:realmC];
-        CHECK_COUNT(3, SyncObject, realmA);
-        CHECK_COUNT(2, SyncObject, realmB);
-        CHECK_COUNT(5, SyncObject, realmC);
-    }
-}
-
-/// A client should be able to open multiple Realms and delete objects from each of them.
-- (void)testMultipleRealmsDeleteObjects {
-    NSURL *urlA = CUSTOM_REALM_URL(@"a");
-    NSURL *urlB = CUSTOM_REALM_URL(@"b");
-    NSURL *urlC = CUSTOM_REALM_URL(@"c");
-    RLMSyncUser *user = [self logInUserForCredentials:[RLMObjectServerTests basicCredentialsWithName:NSStringFromSelector(_cmd)
-                                                                                            register:self.isParent]
-                                               server:[RLMObjectServerTests authServerURL]];
-    RLMRealm *realmA = [self openRealmForURL:urlA user:user];
-    RLMRealm *realmB = [self openRealmForURL:urlB user:user];
-    RLMRealm *realmC = [self openRealmForURL:urlC user:user];
-    if (self.isParent) {
-        [self waitForDownloadsForRealm:realmA];
-        [self waitForDownloadsForRealm:realmB];
-        [self waitForDownloadsForRealm:realmC];
-        // Add objects.
-        [self addSyncObjectsToRealm:realmA
-                       descriptions:@[@"parent-A1", @"parent-A2", @"parent-A3", @"parent-A4"]];
-        [self addSyncObjectsToRealm:realmB
-                       descriptions:@[@"parent-B1", @"parent-B2", @"parent-B3", @"parent-B4", @"parent-B5"]];
-        [self addSyncObjectsToRealm:realmC
-                       descriptions:@[@"parent-C1", @"parent-C2"]];
-        [self waitForUploadsForRealm:realmA];
-        [self waitForUploadsForRealm:realmB];
-        [self waitForUploadsForRealm:realmC];
-        CHECK_COUNT(4, SyncObject, realmA);
-        CHECK_COUNT(5, SyncObject, realmB);
-        CHECK_COUNT(2, SyncObject, realmC);
-        RLMRunChildAndWait();
-        [self waitForDownloadsForUser:user
-                               realms:@[realmA, realmB, realmC]
-                            realmURLs:@[urlA, urlB, urlC]
-                       expectedCounts:@[@0, @0, @0]];
-    } else {
-        // Delete all the objects from the Realms.
-        [self waitForDownloadsForRealm:realmA];
-        [self waitForDownloadsForRealm:realmB];
-        [self waitForDownloadsForRealm:realmC];
-        CHECK_COUNT(4, SyncObject, realmA);
-        CHECK_COUNT(5, SyncObject, realmB);
-        CHECK_COUNT(2, SyncObject, realmC);
-        [realmA beginWriteTransaction];
-        [realmA deleteAllObjects];
-        [realmA commitWriteTransaction];
-        [realmB beginWriteTransaction];
-        [realmB deleteAllObjects];
-        [realmB commitWriteTransaction];
-        [realmC beginWriteTransaction];
-        [realmC deleteAllObjects];
-        [realmC commitWriteTransaction];
-        [self waitForUploadsForRealm:realmA];
-        [self waitForUploadsForRealm:realmB];
-        [self waitForUploadsForRealm:realmC];
-        CHECK_COUNT(0, SyncObject, realmA);
-        CHECK_COUNT(0, SyncObject, realmB);
-        CHECK_COUNT(0, SyncObject, realmC);
-    }
-}
-
-#pragma mark - Session Lifetime
-
-/// When a session opened by a Realm goes out of scope, it should stay alive long enough to finish any waiting uploads.
-- (void)testUploadChangesWhenRealmOutOfScope {
-    const NSInteger OBJECT_COUNT = 10000;
-    NSURL *url = REALM_URL();
-    // Log in the user.
-    RLMSyncUser *user = [self logInUserForCredentials:[RLMObjectServerTests basicCredentialsWithName:NSStringFromSelector(_cmd)
-                                                                                            register:self.isParent]
-                                               server:[RLMObjectServerTests authServerURL]];
-
-    if (self.isParent) {
-        // Open the Realm in an autorelease pool so that it is destroyed as soon as possible.
-        @autoreleasepool {
-            RLMRealm *realm = [self openRealmForURL:url user:user];
-            [realm beginWriteTransaction];
-            for (NSInteger i=0; i<OBJECT_COUNT; i++) {
-                [realm addObject:[[SyncObject alloc] initWithValue:@[[NSString stringWithFormat:@"parent-%@", @(i+1)]]]];
-            }
-            [realm commitWriteTransaction];
-            CHECK_COUNT(OBJECT_COUNT, SyncObject, realm);
-        }
-        // Run the sub-test. (Give the upload a bit of time to start.)
-        // NOTE: This sleep should be fine because:
-        // - There is currently no API that allows asynchronous coordination for waiting for an upload to begin.
-        // - A delay longer than the specified one will not affect the outcome of the test.
-        sleep(2);
-        RLMRunChildAndWait();
-    } else {
-        RLMRealm *realm = [self openRealmForURL:url user:user];
-        // Wait for download to complete.
-        [self waitForDownloadsForRealm:realm];
-        CHECK_COUNT(OBJECT_COUNT, SyncObject, realm);
-    }
-}
-
-#pragma mark - Logging Back In
-
-/// A Realm that was opened before a user logged out should be able to resume uploading if the user logs back in.
-- (void)testLogBackInSameRealmUpload {
-    NSURL *url = REALM_URL();
-    // Log in the user.
-    RLMSyncUser *user = [self logInUserForCredentials:[RLMObjectServerTests basicCredentialsWithName:NSStringFromSelector(_cmd)
-                                                                                            register:self.isParent]
-                                               server:[RLMObjectServerTests authServerURL]];
-    RLMRealm *realm = [self openRealmForURL:url user:user];
-
-    if (self.isParent) {
-        [self addSyncObjectsToRealm:realm descriptions:@[@"parent-1"]];
-        CHECK_COUNT(1, SyncObject, realm);
-        [self waitForUploadsForRealm:realm];
-        // Log out the user.
-        [user logOut];
-        // Log the user back in.
-        user = [self logInUserForCredentials:[RLMObjectServerTests basicCredentialsWithName:NSStringFromSelector(_cmd)
-                                                                                   register:NO]
-                                      server:[RLMObjectServerTests authServerURL]];
-        [self addSyncObjectsToRealm:realm descriptions:@[@"parent-2", @"parent-3"]];
-        [self waitForUploadsForRealm:realm];
-        CHECK_COUNT(3, SyncObject, realm);
-        RLMRunChildAndWait();
-    } else {
-        [self waitForDownloadsForRealm:realm];
-        CHECK_COUNT(3, SyncObject, realm);
-    }
-}
-
-/// A Realm that was opened before a user logged out should be able to resume downloading if the user logs back in.
-- (void)testLogBackInSameRealmDownload {
-    NSURL *url = REALM_URL();
-    // Log in the user.
-    RLMSyncUser *user = [self logInUserForCredentials:[RLMObjectServerTests basicCredentialsWithName:NSStringFromSelector(_cmd)
-                                                                                            register:self.isParent]
-                                               server:[RLMObjectServerTests authServerURL]];
-    RLMRealm *realm = [self openRealmForURL:url user:user];
-
-    if (self.isParent) {
-        [self addSyncObjectsToRealm:realm descriptions:@[@"parent-1"]];
-        CHECK_COUNT(1, SyncObject, realm);
-        [self waitForUploadsForRealm:realm];
-        // Log out the user.
-        [user logOut];
-        // Log the user back in.
-        user = [self logInUserForCredentials:[RLMObjectServerTests basicCredentialsWithName:NSStringFromSelector(_cmd)
-                                                                                   register:NO]
-                                      server:[RLMObjectServerTests authServerURL]];
-        RLMRunChildAndWait();
-        [self waitForDownloadsForRealm:realm];
-        CHECK_COUNT(3, SyncObject, realm);
-    } else {
-        [self waitForDownloadsForRealm:realm];
-        [self addSyncObjectsToRealm:realm descriptions:@[@"child-1", @"child-2"]];
-        [self waitForUploadsForRealm:realm];
-        CHECK_COUNT(3, SyncObject, realm);
-    }
-}
-
-/// A Realm that was opened while a user was logged out should be able to start uploading if the user logs back in.
-- (void)testLogBackInDeferredRealmUpload {
-    NSURL *url = REALM_URL();
-    // Log in the user.
-    RLMSyncUser *user = [self logInUserForCredentials:[RLMObjectServerTests basicCredentialsWithName:NSStringFromSelector(_cmd)
-                                                                                            register:self.isParent]
-                                               server:[RLMObjectServerTests authServerURL]];
-    NSError *error = nil;
-    if (self.isParent) {
-        // Semaphore for knowing when the Realm is successfully opened for sync.
-        dispatch_semaphore_t sema = dispatch_semaphore_create(0);
-        RLMRealmConfiguration *config = [user configurationWithURL:url fullSynchronization:true];
-        [user logOut];
-        // Open a Realm after the user's been logged out.
-        [self primeSyncManagerWithSemaphore:sema];
-        RLMRealm *realm = [RLMRealm realmWithConfiguration:config error:&error];
-        XCTAssertNil(error, @"Error when opening Realm: %@", error);
-        [self addSyncObjectsToRealm:realm descriptions:@[@"parent-1"]];
-        CHECK_COUNT(1, SyncObject, realm);
-        user = [self logInUserForCredentials:[RLMObjectServerTests basicCredentialsWithName:NSStringFromSelector(_cmd)
-                                                                                   register:NO]
-                                      server:[RLMObjectServerTests authServerURL]];
-        // Wait for the Realm's session to be bound.
-        WAIT_FOR_SEMAPHORE(sema, 30);
-        [self addSyncObjectsToRealm:realm descriptions:@[@"parent-2", @"parent-3"]];
-        [self waitForUploadsForRealm:realm];
-        CHECK_COUNT(3, SyncObject, realm);
-        RLMRunChildAndWait();
-    } else {
-        RLMRealm *realm = [self openRealmForURL:url user:user];
-        XCTAssertNil(error, @"Error when opening Realm: %@", error);
-        [self waitForDownloadsForRealm:realm];
-        CHECK_COUNT(3, SyncObject, realm);
-    }
-}
-
-/// A Realm that was opened while a user was logged out should be able to start downloading if the user logs back in.
-- (void)testLogBackInDeferredRealmDownload {
-    NSURL *url = REALM_URL();
-    // Log in the user.
-    RLMSyncUser *user = [self logInUserForCredentials:[RLMObjectServerTests basicCredentialsWithName:NSStringFromSelector(_cmd)
-                                                                                            register:self.isParent]
-                                               server:[RLMObjectServerTests authServerURL]];
-    NSError *error = nil;
-    if (self.isParent) {
-        dispatch_semaphore_t sema = dispatch_semaphore_create(0);
-        RLMRunChildAndWait();
-        RLMRealmConfiguration *config = [user configurationWithURL:url fullSynchronization:true];
-        [user logOut];
-        // Open a Realm after the user's been logged out.
-        [self primeSyncManagerWithSemaphore:sema];
-        RLMRealm *realm = [RLMRealm realmWithConfiguration:config error:&error];
-        XCTAssertNil(error, @"Error when opening Realm: %@", error);
-        [self addSyncObjectsToRealm:realm descriptions:@[@"parent-1"]];
-        CHECK_COUNT(1, SyncObject, realm);
-        user = [self logInUserForCredentials:[RLMObjectServerTests basicCredentialsWithName:NSStringFromSelector(_cmd)
-                                                                                   register:NO]
-                                      server:[RLMObjectServerTests authServerURL]];
-        // Wait for the Realm's session to be bound.
-        WAIT_FOR_SEMAPHORE(sema, 30);
-        [self waitForDownloadsForUser:user realms:@[realm] realmURLs:@[url] expectedCounts:@[@4]];
-    } else {
-        RLMRealm *realm = [self openRealmForURL:url user:user];
-        XCTAssertNil(error, @"Error when opening Realm: %@", error);
-        [self addSyncObjectsToRealm:realm descriptions:@[@"child-1", @"child-2", @"child-3"]];
-        [self waitForUploadsForRealm:realm];
-        CHECK_COUNT(3, SyncObject, realm);
-    }
-}
-
-/// After logging back in, a Realm whose path has been opened for the first time should properly upload changes.
-- (void)testLogBackInOpenFirstTimePathUpload {
-    NSURL *url = REALM_URL();
-    // Log in the user.
-    RLMSyncUser *user = [self logInUserForCredentials:[RLMObjectServerTests basicCredentialsWithName:NSStringFromSelector(_cmd)
-                                                                                            register:self.isParent]
-                                               server:[RLMObjectServerTests authServerURL]];
-
-    // Now run a basic multi-client test.
-    if (self.isParent) {
-        // Log out the user.
-        [user logOut];
-        // Log the user back in.
-        user = [self logInUserForCredentials:[RLMObjectServerTests basicCredentialsWithName:NSStringFromSelector(_cmd)
-                                                                                   register:NO]
-                                     server:[RLMObjectServerTests authServerURL]];
-        // Open the Realm (for the first time).
-        RLMRealm *realm = [self openRealmForURL:url user:user];
-        [self addSyncObjectsToRealm:realm descriptions:@[@"child-1", @"child-2"]];
-        [self waitForUploadsForRealm:realm];
-        CHECK_COUNT(2, SyncObject, realm);
-        RLMRunChildAndWait();
-    } else {
-        RLMRealm *realm = [self openRealmForURL:url user:user];
-        // Add objects.
-        [self waitForDownloadsForRealm:realm];
-        CHECK_COUNT(2, SyncObject, realm);
-    }
-}
-
-/// After logging back in, a Realm whose path has been opened for the first time should properly download changes.
-- (void)testLogBackInOpenFirstTimePathDownload {
-    NSURL *url = REALM_URL();
-    // Log in the user.
-    RLMSyncUser *user = [self logInUserForCredentials:[RLMObjectServerTests basicCredentialsWithName:NSStringFromSelector(_cmd)
-                                                                                            register:self.isParent]
-                                               server:[RLMObjectServerTests authServerURL]];
-
-    // Now run a basic multi-client test.
-    if (self.isParent) {
-        // Log out the user.
-        [user logOut];
-        // Log the user back in.
-        user = [self logInUserForCredentials:[RLMObjectServerTests basicCredentialsWithName:NSStringFromSelector(_cmd)
-                                                                                   register:NO]
-                                      server:[RLMObjectServerTests authServerURL]];
-        // Open the Realm (for the first time).
-        RLMRealm *realm = [self openRealmForURL:url user:user];
-        // Run the sub-test.
-        RLMRunChildAndWait();
-        [self waitForDownloadsForRealm:realm];
-        CHECK_COUNT(2, SyncObject, realm);
-    } else {
-        RLMRealm *realm = [self openRealmForURL:url user:user];
-        // Add objects.
-        [self waitForDownloadsForRealm:realm];
-        [self addSyncObjectsToRealm:realm descriptions:@[@"child-1", @"child-2"]];
-        [self waitForUploadsForRealm:realm];
-        CHECK_COUNT(2, SyncObject, realm);
-    }
-}
-
-/// If a client logs in, connects, logs out, and logs back in, sync should properly upload changes for a new
-/// `RLMRealm` that is opened for the same path as a previously-opened Realm.
-- (void)testLogBackInReopenRealmUpload {
-    NSURL *url = REALM_URL();
-    // Log in the user.
-    RLMSyncUser *user = [self logInUserForCredentials:[RLMObjectServerTests basicCredentialsWithName:NSStringFromSelector(_cmd)
-                                                                                            register:self.isParent]
-                                               server:[RLMObjectServerTests authServerURL]];
-    // Open the Realm
-    RLMRealm *realm = [self openRealmForURL:url user:user];
-    if (self.isParent) {
-        [self addSyncObjectsToRealm:realm descriptions:@[@"parent-1"]];
-        [self waitForUploadsForRealm:realm];
-        CHECK_COUNT(1, SyncObject, realm);
-        // Log out the user.
-        [user logOut];
-        // Log the user back in.
-        user = [self logInUserForCredentials:[RLMObjectServerTests basicCredentialsWithName:NSStringFromSelector(_cmd)
-                                                                                   register:NO]
-                                      server:[RLMObjectServerTests authServerURL]];
-        // Open the Realm again.
-        realm = [self immediatelyOpenRealmForURL:url user:user];
-        [self addSyncObjectsToRealm:realm descriptions:@[@"child-1", @"child-2", @"child-3", @"child-4"]];
-        CHECK_COUNT(5, SyncObject, realm);
-        [self waitForUploadsForRealm:realm];
-        RLMRunChildAndWait();
-    } else {
-        [self waitForDownloadsForRealm:realm];
-        CHECK_COUNT(5, SyncObject, realm);
-    }
-}
-
-/// If a client logs in, connects, logs out, and logs back in, sync should properly download changes for a new
-/// `RLMRealm` that is opened for the same path as a previously-opened Realm.
-- (void)testLogBackInReopenRealmDownload {
-    NSURL *url = REALM_URL();
-    // Log in the user.
-    RLMSyncUser *user = [self logInUserForCredentials:[RLMObjectServerTests basicCredentialsWithName:NSStringFromSelector(_cmd)
-                                                                                            register:self.isParent]
-                                              server:[RLMObjectServerTests authServerURL]];
-    // Open the Realm
-    RLMRealm *realm = [self openRealmForURL:url user:user];
-    if (self.isParent) {
-        [self addSyncObjectsToRealm:realm descriptions:@[@"parent-1"]];
-        [self waitForUploadsForRealm:realm];
-        XCTAssert([SyncObject allObjectsInRealm:realm].count == 1, @"Expected 1 item");
-        // Log out the user.
-        [user logOut];
-        // Log the user back in.
-        user = [self logInUserForCredentials:[RLMObjectServerTests basicCredentialsWithName:NSStringFromSelector(_cmd)
-                                                                                   register:NO]
-                                      server:[RLMObjectServerTests authServerURL]];
-        // Run the sub-test.
-        RLMRunChildAndWait();
-        // Open the Realm again and get the items.
-        realm = [self immediatelyOpenRealmForURL:url user:user];
-        [self waitForDownloadsForUser:user realms:@[realm] realmURLs:@[url] expectedCounts:@[@5]];
-    } else {
-        // Add objects.
-        [self waitForDownloadsForRealm:realm];
-        CHECK_COUNT(1, SyncObject, realm);
-        [self addSyncObjectsToRealm:realm descriptions:@[@"child-1", @"child-2", @"child-3", @"child-4"]];
-        [self waitForUploadsForRealm:realm];
-        CHECK_COUNT(5, SyncObject, realm);
-    }
-}
-
-#pragma mark - Session suspend and resume
-
-- (void)testSuspendAndResume {
-    NSURL *urlA = CUSTOM_REALM_URL(@"a");
-    NSURL *urlB = CUSTOM_REALM_URL(@"b");
-    RLMSyncUser *user = [self logInUserForCredentials:[RLMObjectServerTests basicCredentialsWithName:NSStringFromSelector(_cmd)
-                                                                                            register:self.isParent]
-                                               server:[RLMObjectServerTests authServerURL]];
-    RLMRealm *realmA = [self openRealmForURL:urlA user:user];
-    RLMRealm *realmB = [self openRealmForURL:urlB user:user];
-    if (self.isParent) {
-        [self waitForDownloadsForRealm:realmA];
-        [self waitForDownloadsForRealm:realmB];
-        CHECK_COUNT(0, SyncObject, realmA);
-        CHECK_COUNT(0, SyncObject, realmB);
-
-        // Suspend the session for realm A and then add an object to each Realm
-        RLMSyncSession *sessionA = [RLMSyncSession sessionForRealm:realmA];
-        [sessionA suspend];
-
-        [self addSyncObjectsToRealm:realmA descriptions:@[@"child-A1"]];
-        [self addSyncObjectsToRealm:realmB descriptions:@[@"child-B1"]];
-        [self waitForUploadsForRealm:realmB];
-
-        RLMRunChildAndWait();
-
-        // A should still be 1 since it's suspended. If it wasn't suspended, it
-        // should have downloaded before B due to the ordering in the child.
-        [self waitForDownloadsForRealm:realmB];
-        CHECK_COUNT(1, SyncObject, realmA);
-        CHECK_COUNT(3, SyncObject, realmB);
-
-        // A should see the other two from the child after resuming
-        [sessionA resume];
-        [self waitForDownloadsForRealm:realmA];
-        CHECK_COUNT(3, SyncObject, realmA);
-    } else {
-        // Child shouldn't see the object in A
-        [self waitForDownloadsForRealm:realmA];
-        [self waitForDownloadsForRealm:realmB];
-        CHECK_COUNT(0, SyncObject, realmA);
-        CHECK_COUNT(1, SyncObject, realmB);
-
-        [self addSyncObjectsToRealm:realmA descriptions:@[@"child-A2", @"child-A3"]];
-        [self waitForUploadsForRealm:realmA];
-        [self addSyncObjectsToRealm:realmB descriptions:@[@"child-B2", @"child-B3"]];
-        [self waitForUploadsForRealm:realmB];
-        CHECK_COUNT(2, SyncObject, realmA);
-        CHECK_COUNT(3, SyncObject, realmB);
-    }
-}
-
-#pragma mark - Client reset
-
-/// Ensure that a client reset error is propagated up to the binding successfully.
-- (void)testClientReset {
-    NSURL *url = REALM_URL();
-    NSString *sessionName = NSStringFromSelector(_cmd);
-    RLMSyncUser *user = [self logInUserForCredentials:[RLMObjectServerTests basicCredentialsWithName:sessionName
-                                                                                            register:true]
-                                               server:[RLMObjectServerTests authServerURL]];
-    // Open the Realm
-    __attribute__((objc_precise_lifetime)) RLMRealm *realm = [self openRealmForURL:url user:user];
-
-    __block NSError *theError = nil;
-    XCTestExpectation *ex = [self expectationWithDescription:@"Waiting for error handler to be called..."];
-    [RLMSyncManager sharedManager].errorHandler = ^void(NSError *error, RLMSyncSession *session) {
-        // Make sure we're actually looking at the right session.
-        XCTAssertTrue([[session.realmURL absoluteString] rangeOfString:sessionName].location != NSNotFound);
-        theError = error;
-        [ex fulfill];
-    };
-    [user simulateClientResetErrorForSession:url];
-    [self waitForExpectationsWithTimeout:10 handler:nil];
-    XCTAssertNotNil(theError);
-    XCTAssertTrue(theError.code == RLMSyncErrorClientResetError);
-    NSString *pathValue = [theError rlmSync_clientResetBackedUpRealmPath];
-    XCTAssertNotNil(pathValue);
-    // Sanity check the recovery path.
-    NSString *recoveryPath = @"io.realm.object-server-recovered-realms/recovered_realm";
-    XCTAssertTrue([pathValue rangeOfString:recoveryPath].location != NSNotFound);
-    XCTAssertNotNil([theError rlmSync_errorActionToken]);
-}
-
-/// Test manually initiating client reset.
-- (void)testClientResetManualInitiation {
-    NSURL *url = REALM_URL();
-    NSString *sessionName = NSStringFromSelector(_cmd);
-    RLMSyncUser *user = [self logInUserForCredentials:[RLMObjectServerTests basicCredentialsWithName:sessionName
-                                                                                            register:true]
-                                               server:[RLMObjectServerTests authServerURL]];
-    __block NSError *theError = nil;
-    @autoreleasepool {
-        __attribute__((objc_precise_lifetime)) RLMRealm *realm = [self openRealmForURL:url user:user];
-        XCTestExpectation *ex = [self expectationWithDescription:@"Waiting for error handler to be called..."];
-        [RLMSyncManager sharedManager].errorHandler = ^void(NSError *error, RLMSyncSession *session) {
-            // Make sure we're actually looking at the right session.
-            XCTAssertTrue([[session.realmURL absoluteString] rangeOfString:sessionName].location != NSNotFound);
-            theError = error;
-            [ex fulfill];
-        };
-        [user simulateClientResetErrorForSession:url];
-        [self waitForExpectationsWithTimeout:10 handler:nil];
-        XCTAssertNotNil(theError);
-    }
-    // At this point the Realm should be invalidated and client reset should be possible.
-    NSString *pathValue = [theError rlmSync_clientResetBackedUpRealmPath];
-    XCTAssertFalse([[NSFileManager defaultManager] fileExistsAtPath:pathValue]);
-    [RLMSyncSession immediatelyHandleError:[theError rlmSync_errorActionToken]];
-    XCTAssertTrue([[NSFileManager defaultManager] fileExistsAtPath:pathValue]);
-}
-
-#pragma mark - Progress Notifications
-
-static const NSInteger NUMBER_OF_BIG_OBJECTS = 2;
-
-- (void)populateDataForUser:(RLMSyncUser *)user url:(NSURL *)url {
-    RLMRealm *realm = [self openRealmForURL:url user:user];
-    [realm beginWriteTransaction];
-    for (NSInteger i=0; i<NUMBER_OF_BIG_OBJECTS; i++) {
-        [realm addObject:[HugeSyncObject object]];
-    }
-    [realm commitWriteTransaction];
-    [self waitForUploadsForRealm:realm];
-    CHECK_COUNT(NUMBER_OF_BIG_OBJECTS, HugeSyncObject, realm);
-}
-
-- (void)testStreamingDownloadNotifier {
-    NSURL *url = REALM_URL();
-    RLMSyncUser *user = [self logInUserForCredentials:[RLMObjectServerTests basicCredentialsWithName:NSStringFromSelector(_cmd) register:self.isParent]
-                                               server:[RLMObjectServerTests authServerURL]];
-    if (!self.isParent) {
-        [self populateDataForUser:user url:url];
-        return;
-    }
-
-    __block NSInteger callCount = 0;
-    __block NSUInteger transferred = 0;
-    __block NSUInteger transferrable = 0;
-    __block BOOL hasBeenFulfilled = NO;
-    // Register a notifier.
-    [self openRealmForURL:url user:user];
-    RLMSyncSession *session = [user sessionForURL:url];
-    XCTAssertNotNil(session);
-    XCTestExpectation *ex = [self expectationWithDescription:@"streaming-download-notifier"];
-    id token = [session addProgressNotificationForDirection:RLMSyncProgressDirectionDownload
-                                                       mode:RLMSyncProgressModeReportIndefinitely
-                                                      block:^(NSUInteger xfr, NSUInteger xfb) {
-                                                          // Make sure the values are increasing, and update our stored copies.
-                                                          XCTAssert(xfr >= transferred);
-                                                          XCTAssert(xfb >= transferrable);
-                                                          transferred = xfr;
-                                                          transferrable = xfb;
-                                                          callCount++;
-                                                          if (transferrable > 0 && transferred >= transferrable && !hasBeenFulfilled) {
-                                                              [ex fulfill];
-                                                              hasBeenFulfilled = YES;
-                                                          }
-                                                      }];
-    // Wait for the child process to upload everything.
-    RLMRunChildAndWait();
-    [self waitForExpectationsWithTimeout:10.0 handler:nil];
-    [token invalidate];
-    // The notifier should have been called at least twice: once at the beginning and at least once
-    // to report progress.
-    XCTAssert(callCount > 1);
-    XCTAssert(transferred >= transferrable,
-              @"Transferred (%@) needs to be greater than or equal to transferrable (%@)",
-              @(transferred), @(transferrable));
-}
-
-- (void)testStreamingUploadNotifier {
-    NSURL *url = REALM_URL();
-    RLMSyncUser *user = [self logInUserForCredentials:[RLMObjectServerTests basicCredentialsWithName:NSStringFromSelector(_cmd) register:self.isParent]
-                                               server:[RLMObjectServerTests authServerURL]];
-    __block NSInteger callCount = 0;
-    __block NSUInteger transferred = 0;
-    __block NSUInteger transferrable = 0;
-    // Open the Realm
-    RLMRealm *realm = [self openRealmForURL:url user:user];
-
-    // Register a notifier.
-    RLMSyncSession *session = [user sessionForURL:url];
-    XCTAssertNotNil(session);
-    XCTestExpectation *ex = [self expectationWithDescription:@"streaming-upload-expectation"];
-    auto token = [session addProgressNotificationForDirection:RLMSyncProgressDirectionUpload
-                                                         mode:RLMSyncProgressModeReportIndefinitely
-                                                        block:^(NSUInteger xfr, NSUInteger xfb) {
-                                                            // Make sure the values are
-                                                            // increasing, and update our
-                                                            // stored copies.
-                                                            XCTAssert(xfr >= transferred);
-                                                            XCTAssert(xfb >= transferrable);
-                                                            transferred = xfr;
-                                                            transferrable = xfb;
-                                                            callCount++;
-                                                            if (transferred > 0 && transferred >= transferrable && transferrable > 1000000 * NUMBER_OF_BIG_OBJECTS) {
-                                                                [ex fulfill];
-                                                            }
-                                                        }];
-    // Upload lots of data
-    [realm beginWriteTransaction];
-    for (NSInteger i=0; i<NUMBER_OF_BIG_OBJECTS; i++) {
-        [realm addObject:[HugeSyncObject object]];
-    }
-    [realm commitWriteTransaction];
-    // Wait for upload to begin and finish
-    [self waitForExpectationsWithTimeout:10.0 handler:nil];
-    [token invalidate];
-    // The notifier should have been called at least twice: once at the beginning and at least once
-    // to report progress.
-    XCTAssert(callCount > 1);
-    XCTAssert(transferred >= transferrable,
-              @"Transferred (%@) needs to be greater than or equal to transferrable (%@)",
-              @(transferred), @(transferrable));
-}
-
-#pragma mark - Download Realm
-
-- (void)testDownloadRealm {
-    const NSInteger NUMBER_OF_BIG_OBJECTS = 2;
-    NSURL *url = REALM_URL();
-    RLMSyncUser *user = [self logInUserForCredentials:[RLMObjectServerTests basicCredentialsWithName:NSStringFromSelector(_cmd) register:self.isParent]
-                                               server:[RLMObjectServerTests authServerURL]];
-    if (!self.isParent) {
-        [self populateDataForUser:user url:url];
-        return;
-    }
-
-    // Wait for the child process to upload everything.
-    RLMRunChildAndWait();
-
-    XCTestExpectation *ex = [self expectationWithDescription:@"download-realm"];
-    RLMRealmConfiguration *c = [user configurationWithURL:url fullSynchronization:true];
-    XCTAssertFalse([[NSFileManager defaultManager] fileExistsAtPath:c.pathOnDisk isDirectory:nil]);
-    [RLMRealm asyncOpenWithConfiguration:c
-                           callbackQueue:dispatch_get_main_queue()
-                                callback:^(RLMRealm * _Nullable realm, NSError * _Nullable error) {
-                                    XCTAssertNil(error);
-                                    CHECK_COUNT(NUMBER_OF_BIG_OBJECTS, HugeSyncObject, realm);
-                                    [ex fulfill];
-                                }];
-    NSUInteger (^fileSize)(NSString *) = ^NSUInteger(NSString *path) {
-        NSDictionary *attributes = [[NSFileManager defaultManager] attributesOfItemAtPath:path error:nil];
-        if (attributes)
-            return [(NSNumber *)attributes[NSFileSize] unsignedLongLongValue];
-
-        return 0;
-    };
-    XCTAssertNil(RLMGetAnyCachedRealmForPath(c.pathOnDisk.UTF8String));
-    [self waitForExpectationsWithTimeout:10.0 handler:nil];
-    XCTAssertGreaterThan(fileSize(c.pathOnDisk), 0U);
-    XCTAssertNil(RLMGetAnyCachedRealmForPath(c.pathOnDisk.UTF8String));
-}
-
-- (void)testDownloadAlreadyOpenRealm {
-    const NSInteger NUMBER_OF_BIG_OBJECTS = 2;
-    NSURL *url = REALM_URL();
-    // Log in the user.
-    RLMSyncUser *user = [self logInUserForCredentials:[RLMObjectServerTests basicCredentialsWithName:NSStringFromSelector(_cmd) register:self.isParent]
-                                               server:[RLMObjectServerTests authServerURL]];
-    if (!self.isParent) {
-        [self populateDataForUser:user url:url];
-        return;
-    }
-
-    XCTestExpectation *ex = [self expectationWithDescription:@"download-realm"];
-    RLMRealmConfiguration *c = [user configurationWithURL:url fullSynchronization:true];
-    XCTAssertFalse([[NSFileManager defaultManager] fileExistsAtPath:c.pathOnDisk isDirectory:nil]);
-    RLMRealm *realm = [RLMRealm realmWithConfiguration:c error:nil];
-    CHECK_COUNT(0, HugeSyncObject, realm);
-    [realm.syncSession suspend];
-
-    // Wait for the child process to upload everything.
-    RLMRunChildAndWait();
-
-    auto fileSize = ^NSUInteger(NSString *path) {
-        NSDictionary *attributes = [[NSFileManager defaultManager] attributesOfItemAtPath:path error:nil];
-        return [(NSNumber *)attributes[NSFileSize] unsignedLongLongValue];
-    };
-    NSUInteger sizeBefore = fileSize(c.pathOnDisk);
-    XCTAssertGreaterThan(sizeBefore, 0U);
-    XCTAssertNotNil(RLMGetAnyCachedRealmForPath(c.pathOnDisk.UTF8String));
-
-    [RLMRealm asyncOpenWithConfiguration:c
-                           callbackQueue:dispatch_get_main_queue()
-                                callback:^(RLMRealm * _Nullable realm, NSError * _Nullable error) {
-        XCTAssertNil(error);
-        CHECK_COUNT(NUMBER_OF_BIG_OBJECTS, HugeSyncObject, realm);
-        [ex fulfill];
-    }];
-    [realm.syncSession resume];
-    [self waitForExpectationsWithTimeout:2.0 handler:nil];
-
-    XCTAssertGreaterThan(fileSize(c.pathOnDisk), sizeBefore);
-    XCTAssertNotNil(RLMGetAnyCachedRealmForPath(c.pathOnDisk.UTF8String));
-    CHECK_COUNT(NUMBER_OF_BIG_OBJECTS, HugeSyncObject, realm);
-
-    (void)[realm configuration];
-}
-
-- (void)testDownloadCancelsOnAuthError {
-    RLMSyncUser *user = [self logInUserForCredentials:[RLMObjectServerTests basicCredentialsWithName:NSStringFromSelector(_cmd) register:self.isParent]
-                                               server:[RLMObjectServerTests authServerURL]];
-    auto c = [user configurationWithURL:[NSURL URLWithString:@"realm://127.0.0.1:9080/invalid"] fullSynchronization:true];
-    auto ex = [self expectationWithDescription:@"async open"];
-    [RLMRealm asyncOpenWithConfiguration:c callbackQueue:dispatch_get_main_queue()
-                                callback:^(RLMRealm *realm, NSError *error) {
-                                    XCTAssertNil(realm);
-                                    XCTAssertNotNil(error);
-                                    [ex fulfill];
-    }];
-    [self waitForExpectationsWithTimeout:2.0 handler:nil];
-}
-
-- (void)testCancelDownload {
-    NSURL *url = REALM_URL();
-    RLMSyncUser *user = [self logInUserForCredentials:[RLMObjectServerTests basicCredentialsWithName:NSStringFromSelector(_cmd) register:self.isParent]
-                                               server:[RLMObjectServerTests authServerURL]];
-    if (!self.isParent) {
-        [self populateDataForUser:user url:url];
-        return;
-    }
-
-    // Wait for the child process to upload everything.
-    RLMRunChildAndWait();
-
-    // Use a serial queue for asyncOpen to ensure that the first one adds
-    // the completion block before the second one cancels it
-    RLMSetAsyncOpenQueue(dispatch_queue_create("io.realm.asyncOpen", 0));
-
-    XCTestExpectation *ex = [self expectationWithDescription:@"download-realm"];
-    RLMRealmConfiguration *c = [user configurationWithURL:url fullSynchronization:true];
-
-    [RLMRealm asyncOpenWithConfiguration:c
-                           callbackQueue:dispatch_get_main_queue()
-                                callback:^(RLMRealm *realm, NSError *error) {
-                                    XCTAssertNil(realm);
-                                    XCTAssertNotNil(error);
-                                    [ex fulfill];
-                                }];
-    [[RLMRealm asyncOpenWithConfiguration:c
-                            callbackQueue:dispatch_get_main_queue()
-                                 callback:^(RLMRealm *, NSError *) {
-                                     XCTFail(@"Cancelled callback got called");
-                                 }] cancel];
-    [self waitForExpectationsWithTimeout:2.0 handler:nil];
-}
-
-- (void)testAsyncOpenProgressNotifications {
-    NSURL *url = REALM_URL();
-    RLMSyncUser *user = [self logInUserForCredentials:[RLMObjectServerTests basicCredentialsWithName:NSStringFromSelector(_cmd) register:self.isParent]
-                                               server:[RLMObjectServerTests authServerURL]];
-    if (!self.isParent) {
-        [self populateDataForUser:user url:url];
-        return;
-    }
-
-    RLMRunChildAndWait();
-
-    XCTestExpectation *ex1 = [self expectationWithDescription:@"async open"];
-    XCTestExpectation *ex2 = [self expectationWithDescription:@"download progress complete"];
-    RLMRealmConfiguration *c = [user configurationWithURL:url fullSynchronization:true];
-
-    auto task = [RLMRealm asyncOpenWithConfiguration:c
-                                       callbackQueue:dispatch_get_main_queue()
-                                            callback:^(RLMRealm *realm, NSError *error) {
-                                                XCTAssertNil(error);
-                                                XCTAssertNotNil(realm);
-                                                [ex1 fulfill];
-                                            }];
-    [task addProgressNotificationBlock:^(NSUInteger transferredBytes, NSUInteger transferrableBytes) {
-        if (transferrableBytes > 0 && transferredBytes == transferrableBytes) {
-            [ex2 fulfill];
-        }
-    }];
-    [self waitForExpectationsWithTimeout:2.0 handler:nil];
-}
-
-- (void)testAsyncOpenConnectionTimeout {
-    NSString *userName = NSStringFromSelector(_cmd);
-    // 9083 is a proxy which delays responding to requests
-    NSURL *authURL = [NSURL URLWithString:@"http://127.0.0.1:9083"];
-    RLMSyncUser *user = [self logInUserForCredentials:[RLMObjectServerTests basicCredentialsWithName:userName register:YES]
-                                               server:authURL];
-    RLMRealmConfiguration *c = [user configuration];
-    RLMSyncConfiguration *syncConfig = c.syncConfiguration;
-    syncConfig.cancelAsyncOpenOnNonFatalErrors = true;
-    c.syncConfiguration = syncConfig;
-
-    RLMSyncTimeoutOptions *timeoutOptions = [RLMSyncTimeoutOptions new];
-    timeoutOptions.connectTimeout = 1000.0;
-    RLMSyncManager.sharedManager.timeoutOptions = timeoutOptions;
-
-    XCTestExpectation *ex = [self expectationWithDescription:@"async open"];
-    [RLMRealm asyncOpenWithConfiguration:c
-                           callbackQueue:dispatch_get_main_queue()
-                                callback:^(RLMRealm *realm, NSError *error) {
-        XCTAssertNotNil(error);
-        XCTAssertEqual(error.code, ETIMEDOUT);
-        XCTAssertEqual(error.domain, NSPOSIXErrorDomain);
-        XCTAssertNil(realm);
-        [ex fulfill];
-    }];
-    [self waitForExpectationsWithTimeout:10.0 handler:nil];
-}
-
-#pragma mark - Compact on Launch
-
-- (void)testCompactOnLaunch {
-    NSURL *url = REALM_URL();
-    RLMSyncUser *user = [self logInUserForCredentials:[RLMObjectServerTests basicCredentialsWithName:NSStringFromSelector(_cmd)
-                                                                                            register:YES]
-                                               server:[RLMObjectServerTests authServerURL]];
-
-    NSString *path;
-    // Create a large object and then delete it in the next transaction so that
-    // the file is bloated
-    @autoreleasepool {
-        auto realm = [self openRealmForURL:url user:user];
-        [realm beginWriteTransaction];
-        [realm addObject:[HugeSyncObject object]];
-        [realm commitWriteTransaction];
-        [self waitForUploadsForRealm:realm];
-
-        [realm beginWriteTransaction];
-        [realm deleteAllObjects];
-        [realm commitWriteTransaction];
-        [self waitForUploadsForRealm:realm];
-        [self waitForDownloadsForRealm:realm];
-
-        path = realm.configuration.pathOnDisk;
-    }
-
-    auto fileManager = NSFileManager.defaultManager;
-    auto initialSize = [[fileManager attributesOfItemAtPath:path error:nil][NSFileSize] unsignedLongLongValue];
-
-    // Reopen the file with a shouldCompactOnLaunch block and verify that it is
-    // actually compacted
-    auto config = [user configurationWithURL:url fullSynchronization:true];
-    __block bool blockCalled = false;
-    __block NSUInteger usedSize = 0;
-    config.shouldCompactOnLaunch = ^(NSUInteger, NSUInteger used) {
-        usedSize = used;
-        blockCalled = true;
-        return YES;
-    };
-
-    @autoreleasepool {
-        [RLMRealm realmWithConfiguration:config error:nil];
-    }
-    XCTAssertTrue(blockCalled);
-
-    auto finalSize = [[fileManager attributesOfItemAtPath:path error:nil][NSFileSize] unsignedLongLongValue];
-    XCTAssertLessThan(finalSize, initialSize);
-    XCTAssertLessThanOrEqual(finalSize, usedSize + 4096U);
-}
-
-#pragma mark - Partial sync
-
-- (void)waitForKeyPath:(NSString *)keyPath object:(id)object value:(id)value {
-    [self waitForExpectations:@[[[XCTKVOExpectation alloc] initWithKeyPath:keyPath object:object expectedValue:value]] timeout:20.0];
-}
-
-- (void)testPartialSync {
-    // Make credentials.
-    NSString *name = NSStringFromSelector(_cmd);
-    NSURL *server = [RLMObjectServerTests authServerURL];
-
-    // Log in and populate the Realm.
-    @autoreleasepool {
-        RLMSyncCredentials *creds = [RLMObjectServerTests basicCredentialsWithName:name register:YES];
-        RLMSyncUser *user = [self logInUserForCredentials:creds server:server];
-        RLMRealmConfiguration *configuration = [user configuration];
-        RLMRealm *realm = [self openRealmWithConfiguration:configuration];
-        [realm beginWriteTransaction];
-        // FIXME: make this less hideous
-        // Add ten of each object
-        [realm addObject:[PartialSyncObjectA objectWithNumber:0 string:@"realm"]];
-        [realm addObject:[PartialSyncObjectA objectWithNumber:1 string:@""]];
-        [realm addObject:[PartialSyncObjectA objectWithNumber:2 string:@""]];
-        [realm addObject:[PartialSyncObjectA objectWithNumber:3 string:@""]];
-        [realm addObject:[PartialSyncObjectA objectWithNumber:4 string:@"realm"]];
-        [realm addObject:[PartialSyncObjectA objectWithNumber:5 string:@"sync"]];
-        [realm addObject:[PartialSyncObjectA objectWithNumber:6 string:@"partial"]];
-        [realm addObject:[PartialSyncObjectA objectWithNumber:7 string:@"partial"]];
-        [realm addObject:[PartialSyncObjectA objectWithNumber:8 string:@"partial"]];
-        [realm addObject:[PartialSyncObjectA objectWithNumber:9 string:@"partial"]];
-        [realm addObject:[PartialSyncObjectB objectWithNumber:0 firstString:@"" secondString:@""]];
-        [realm addObject:[PartialSyncObjectB objectWithNumber:1 firstString:@"" secondString:@""]];
-        [realm addObject:[PartialSyncObjectB objectWithNumber:2 firstString:@"" secondString:@""]];
-        [realm addObject:[PartialSyncObjectB objectWithNumber:3 firstString:@"" secondString:@""]];
-        [realm addObject:[PartialSyncObjectB objectWithNumber:4 firstString:@"" secondString:@""]];
-        [realm addObject:[PartialSyncObjectB objectWithNumber:5 firstString:@"" secondString:@""]];
-        [realm addObject:[PartialSyncObjectB objectWithNumber:6 firstString:@"" secondString:@""]];
-        [realm addObject:[PartialSyncObjectB objectWithNumber:7 firstString:@"" secondString:@""]];
-        [realm addObject:[PartialSyncObjectB objectWithNumber:8 firstString:@"" secondString:@""]];
-        [realm addObject:[PartialSyncObjectB objectWithNumber:9 firstString:@"" secondString:@""]];
-        [realm commitWriteTransaction];
-        [self waitForUploadsForRealm:realm];
-    }
-
-    // Log back in and do partial sync stuff.
-    @autoreleasepool {
-        RLMSyncCredentials *creds = [RLMObjectServerTests basicCredentialsWithName:name register:NO];
-        RLMSyncUser *user = [self logInUserForCredentials:creds server:server];
-        RLMRealmConfiguration *configuration = [user configuration];
-        RLMRealm *realm = [self openRealmWithConfiguration:configuration];
-
-        // Perform some partial sync queries
-        RLMResults *objects = [PartialSyncObjectA objectsInRealm:realm where:@"number > 5"];
-        RLMSyncSubscription *subscription = [objects subscribeWithName:@"query"];
-
-        // Wait for the results to become available.
-        [self waitForKeyPath:@"state" object:subscription value:@(RLMSyncSubscriptionStateComplete)];
-
-        // Verify that we got what we're looking for
-        XCTAssertEqual(objects.count, 4U);
-        for (PartialSyncObjectA *object in objects) {
-            XCTAssertGreaterThan(object.number, 5);
-            XCTAssertEqualObjects(object.string, @"partial");
-        }
-
-        // Verify that we didn't get any other objects
-        XCTAssertEqual([PartialSyncObjectA allObjectsInRealm:realm].count, objects.count);
-        XCTAssertEqual([PartialSyncObjectB allObjectsInRealm:realm].count, 0u);
-
-
-        // Create a subscription with the same name but a different query. This should trigger an error.
-        RLMResults *objects2 = [PartialSyncObjectA objectsInRealm:realm where:@"number < 5"];
-        RLMSyncSubscription *subscription2 = [objects2 subscribeWithName:@"query"];
-
-        // Wait for the error to be reported.
-        [self waitForKeyPath:@"state" object:subscription2 value:@(RLMSyncSubscriptionStateError)];
-        XCTAssertNotNil(subscription2.error);
-
-        // Unsubscribe from the query, and ensure that it correctly transitions to the invalidated state.
-        [subscription unsubscribe];
-        [self waitForKeyPath:@"state" object:subscription value:@(RLMSyncSubscriptionStateInvalidated)];
-    }
-}
-
-- (RLMRealm *)partialRealmWithName:(SEL)sel {
-    NSString *name = NSStringFromSelector(sel);
-    NSURL *server = [RLMObjectServerTests authServerURL];
-    RLMSyncCredentials *creds = [RLMObjectServerTests basicCredentialsWithName:name register:YES];
-    RLMSyncUser *user = [self logInUserForCredentials:creds server:server];
-    RLMRealmConfiguration *configuration = [user configuration];
-    return [self openRealmWithConfiguration:configuration];
-}
-
-- (void)testAllSubscriptionsChecksThatRealmIsQBS {
-    RLMRealm *nonsyncRealm = [RLMRealm defaultRealm];
-    RLMAssertThrowsWithReason(nonsyncRealm.subscriptions, @"query-based sync");
-
-    NSString *name = NSStringFromSelector(_cmd);
-    NSURL *server = [RLMObjectServerTests authServerURL];
-    RLMSyncCredentials *creds = [RLMObjectServerTests basicCredentialsWithName:name register:YES];
-    RLMSyncUser *user = [self logInUserForCredentials:creds server:server];
-    RLMRealm *fullsyncRealm = [self openRealmWithConfiguration:[user configurationWithURL:[NSURL URLWithString:@"realms://localhost:9443/~/default"] fullSynchronization:YES]];
-    RLMAssertThrowsWithReason(fullsyncRealm.subscriptions, @"query-based sync");
-}
-
-- (void)testAllSubscriptionsReportsNewlyCreatedSubscription {
-    RLMRealm *realm = [self partialRealmWithName:_cmd];
-    XCTAssertEqual(0U, realm.subscriptions.count);
-
-    RLMSyncSubscription *subscription = [[PartialSyncObjectA objectsInRealm:realm where:@"number > 5"]
-                                         subscribeWithName:@"query"];
-    // Should still be 0 because the subscription is created asynchronously
-    XCTAssertEqual(0U, realm.subscriptions.count);
-
-    [self waitForKeyPath:@"state" object:subscription value:@(RLMSyncSubscriptionStateComplete)];
-    XCTAssertEqual(1U, realm.subscriptions.count);
-
-    RLMSyncSubscription *subscription2 = realm.subscriptions.firstObject;
-    XCTAssertEqualObjects(@"query", subscription2.name);
-    XCTAssertEqual(RLMSyncSubscriptionStateComplete, subscription2.state);
-    XCTAssertNil(subscription2.error);
-}
-
-- (void)testAllSubscriptionsDoesNotReportLocalError {
-    RLMRealm *realm = [self partialRealmWithName:_cmd];
-    RLMSyncSubscription *subscription1 = [[PartialSyncObjectA objectsInRealm:realm where:@"number > 5"]
-                                         subscribeWithName:@"query"];
-    [self waitForKeyPath:@"state" object:subscription1 value:@(RLMSyncSubscriptionStateComplete)];
-    RLMSyncSubscription *subscription2 = [[PartialSyncObjectA objectsInRealm:realm where:@"number > 6"]
-                                         subscribeWithName:@"query"];
-    [self waitForKeyPath:@"state" object:subscription2 value:@(RLMSyncSubscriptionStateError)];
-    XCTAssertEqual(1U, realm.subscriptions.count);
-}
-
-- (void)testAllSubscriptionsReportsServerError {
-    RLMRealm *realm = [self partialRealmWithName:_cmd];
-    RLMSyncSubscription *subscription = [[PersonObject objectsInRealm:realm where:@"SUBQUERY(parents, $p1, $p1.age < 31 AND SUBQUERY($p1.parents, $p2, $p2.age > 35 AND $p2.name == 'Michael').@count > 0).@count > 0"]
-                                          subscribeWithName:@"query"];
-    XCTAssertEqual(0U, realm.subscriptions.count);
-    [self waitForKeyPath:@"state" object:subscription value:@(RLMSyncSubscriptionStateError)];
-    XCTAssertEqual(1U, realm.subscriptions.count);
-
-    RLMSyncSubscription *subscription2 = realm.subscriptions.lastObject;
-    XCTAssertEqualObjects(@"query", subscription2.name);
-    XCTAssertEqual(RLMSyncSubscriptionStateError, subscription2.state);
-    XCTAssertNotNil(subscription2.error);
-}
-
-- (void)testUnsubscribeUsingOriginalSubscriptionObservingFetched {
-    RLMRealm *realm = [self partialRealmWithName:_cmd];
-    RLMSyncSubscription *original = [[PartialSyncObjectA allObjectsInRealm:realm] subscribeWithName:@"query"];
-    [self waitForKeyPath:@"state" object:original value:@(RLMSyncSubscriptionStateComplete)];
-    XCTAssertEqual(1U, realm.subscriptions.count);
-    RLMSyncSubscription *fetched = realm.subscriptions.firstObject;
-
-    [original unsubscribe];
-    [self waitForKeyPath:@"state" object:fetched value:@(RLMSyncSubscriptionStateInvalidated)];
-    XCTAssertEqual(0U, realm.subscriptions.count);
-    XCTAssertEqual(RLMSyncSubscriptionStateInvalidated, original.state);
-
-    // XCTKVOExpecatation retains the object and releases it sometime later on
-    // a background thread, which causes issues if the realm is closed after
-    // we reset the global state
-    realm->_realm->close();
-}
-
-- (void)testUnsubscribeUsingFetchedSubscriptionObservingFetched {
-    RLMRealm *realm = [self partialRealmWithName:_cmd];
-    RLMSyncSubscription *original = [[PartialSyncObjectA allObjectsInRealm:realm] subscribeWithName:@"query"];
-    [self waitForKeyPath:@"state" object:original value:@(RLMSyncSubscriptionStateComplete)];
-    XCTAssertEqual(1U, realm.subscriptions.count);
-    RLMSyncSubscription *fetched = realm.subscriptions.firstObject;
-
-    [fetched unsubscribe];
-    [self waitForKeyPath:@"state" object:fetched value:@(RLMSyncSubscriptionStateInvalidated)];
-    XCTAssertEqual(0U, realm.subscriptions.count);
-    XCTAssertEqual(RLMSyncSubscriptionStateInvalidated, original.state);
-
-    // XCTKVOExpecatation retains the object and releases it sometime later on
-    // a background thread, which causes issues if the realm is closed after
-    // we reset the global state
-    realm->_realm->close();
-}
-
-- (void)testUnsubscribeUsingFetchedSubscriptionObservingOriginal {
-    RLMRealm *realm = [self partialRealmWithName:_cmd];
-    RLMSyncSubscription *original = [[PartialSyncObjectA allObjectsInRealm:realm] subscribeWithName:@"query"];
-    [self waitForKeyPath:@"state" object:original value:@(RLMSyncSubscriptionStateComplete)];
-    XCTAssertEqual(1U, realm.subscriptions.count);
-    RLMSyncSubscription *fetched = realm.subscriptions.firstObject;
-
-    [fetched unsubscribe];
-    [self waitForKeyPath:@"state" object:original value:@(RLMSyncSubscriptionStateInvalidated)];
-    XCTAssertEqual(0U, realm.subscriptions.count);
-    XCTAssertEqual(RLMSyncSubscriptionStateInvalidated, fetched.state);
-}
-
-- (void)testSubscriptionWithName {
-    RLMRealm *nonsyncRealm = [RLMRealm defaultRealm];
-    XCTAssertThrows([nonsyncRealm subscriptionWithName:@"name"]);
-
-    RLMRealm *realm = [self partialRealmWithName:_cmd];
-    XCTAssertNil([realm subscriptionWithName:@"query"]);
-
-    RLMSyncSubscription *subscription = [[PartialSyncObjectA allObjectsInRealm:realm] subscribeWithName:@"query"];
-    XCTAssertNil([realm subscriptionWithName:@"query"]);
-
-    [self waitForKeyPath:@"state" object:subscription value:@(RLMSyncSubscriptionStateComplete)];
-    XCTAssertNotNil([realm subscriptionWithName:@"query"]);
-    XCTAssertNil([realm subscriptionWithName:@"query2"]);
-
-    RLMSyncSubscription *subscription2 = [realm subscriptionWithName:@"query"];
-    XCTAssertEqualObjects(@"query", subscription2.name);
-    XCTAssertEqual(RLMSyncSubscriptionStateComplete, subscription2.state);
-    XCTAssertNil(subscription2.error);
-
-    [subscription unsubscribe];
-    XCTAssertNotNil([realm subscriptionWithName:@"query"]);
-
-    [self waitForKeyPath:@"state" object:subscription value:@(RLMSyncSubscriptionStateInvalidated)];
-    XCTAssertNil([realm subscriptionWithName:@"query"]);
-    XCTAssertEqual(RLMSyncSubscriptionStateInvalidated, subscription2.state);
-}
-
-- (void)testSortAndFilterSubscriptions {
-    RLMRealm *realm = [self partialRealmWithName:_cmd];
-
-    NSDate *now = NSDate.date;
-    [self waitForKeyPath:@"state" object:[[PartialSyncObjectA allObjectsInRealm:realm] subscribeWithName:@"query 1"]
-                   value:@(RLMSyncSubscriptionStateComplete)];
-    [self waitForKeyPath:@"state" object:[[PartialSyncObjectA allObjectsInRealm:realm] subscribeWithName:@"query 2"]
-                   value:@(RLMSyncSubscriptionStateComplete)];
-    [self waitForKeyPath:@"state" object:[[PartialSyncObjectB allObjectsInRealm:realm] subscribeWithName:@"query 3"]
-                   value:@(RLMSyncSubscriptionStateComplete)];
-    RLMResults *unsupportedQuery = [PersonObject objectsInRealm:realm where:@"SUBQUERY(parents, $p1, $p1.age < 31 AND SUBQUERY($p1.parents, $p2, $p2.age > 35 AND $p2.name == 'Michael').@count > 0).@count > 0"];
-    [self waitForKeyPath:@"state" object:[unsupportedQuery subscribeWithName:@"query 4"]
-                   value:@(RLMSyncSubscriptionStateError)];
-
-    auto subscriptions = realm.subscriptions;
-    XCTAssertEqual(4U, subscriptions.count);
-    XCTAssertEqual(0U, ([subscriptions objectsWhere:@"name = %@", @"query 0"].count));
-    XCTAssertEqualObjects(@"query 1", ([subscriptions objectsWhere:@"name = %@", @"query 1"].firstObject.name));
-    XCTAssertEqual(3U, ([subscriptions objectsWhere:@"status = %@", @(RLMSyncSubscriptionStateComplete)].count));
-    XCTAssertEqual(1U, ([subscriptions objectsWhere:@"status = %@", @(RLMSyncSubscriptionStateError)].count));
-
-    XCTAssertEqual(4U, ([subscriptions objectsWhere:@"createdAt >= %@", now]).count);
-    XCTAssertEqual(0U, ([subscriptions objectsWhere:@"createdAt < %@", now]).count);
-    XCTAssertEqual(4U, [subscriptions objectsWhere:@"expiresAt = nil"].count);
-    XCTAssertEqual(4U, [subscriptions objectsWhere:@"timeToLive = nil"].count);
-
-    XCTAssertThrows([subscriptions sortedResultsUsingKeyPath:@"name" ascending:NO]);
-    XCTAssertThrows([subscriptions sortedResultsUsingDescriptors:@[]]);
-    XCTAssertThrows([subscriptions distinctResultsUsingKeyPaths:@[@"name"]]);
-}
-
-- (void)testIncludeLinkingObjectsErrorHandling {
-    RLMRealm *realm = [self partialRealmWithName:_cmd];
-
-    RLMResults *objects = [PersonObject allObjectsInRealm:realm];
-    RLMSyncSubscriptionOptions *opt = [RLMSyncSubscriptionOptions new];
-
-    opt.includeLinkingObjectProperties = @[@"nonexistent"];
-    RLMAssertThrowsWithReason([objects subscribeWithOptions:opt],
-                              @"Invalid LinkingObjects inclusion from key path 'nonexistent': property 'PersonObject.nonexistent' does not exist.");
-
-    opt.includeLinkingObjectProperties = @[@"name"];
-    RLMAssertThrowsWithReason([objects subscribeWithOptions:opt],
-                              @"Invalid LinkingObjects inclusion from key path 'name': property 'PersonObject.name' is of unsupported type 'string'.");
-
-    opt.includeLinkingObjectProperties = @[@"children.name"];
-    RLMAssertThrowsWithReason([objects subscribeWithOptions:opt],
-                              @"Invalid LinkingObjects inclusion from key path 'children.name': property 'PersonObject.name' is of unsupported type 'string'.");
-
-    opt.includeLinkingObjectProperties = @[@"children"];
-    RLMAssertThrowsWithReason([objects subscribeWithOptions:opt],
-                              @"Invalid LinkingObjects inclusion from key path 'children': key path must end in a LinkingObjects property and 'PersonObject.children' is of type 'array'.");
-
-    opt.includeLinkingObjectProperties = @[@"children."];
-    RLMAssertThrowsWithReason([objects subscribeWithOptions:opt],
-                              @"Invalid LinkingObjects inclusion from key path 'children.': missing property name.");
-
-    opt.includeLinkingObjectProperties = @[@""];
-    RLMAssertThrowsWithReason([objects subscribeWithOptions:opt],
-                              @"Invalid LinkingObjects inclusion from key path '': missing property name.");
-}
-
-#pragma mark - Certificate pinning
-
-- (void)attemptLoginWithUsername:(NSString *)userName callback:(void (^)(RLMSyncUser *, NSError *))callback {
-    NSURL *url = [RLMObjectServerTests secureAuthServerURL];
-    RLMSyncCredentials *creds = [RLMObjectServerTests basicCredentialsWithName:userName register:YES];
-
-    XCTestExpectation *expectation = [self expectationWithDescription:@"HTTP login"];
-    [RLMSyncUser logInWithCredentials:creds authServerURL:url
-                         onCompletion:^(RLMSyncUser *user, NSError *error) {
-                             callback(user, error);
-                             [expectation fulfill];
-                         }];
-    [self waitForExpectationsWithTimeout:4.0 handler:nil];
-}
-
-- (void)testHTTPSLoginFailsWithoutCertificate {
-    [self attemptLoginWithUsername:NSStringFromSelector(_cmd) callback:^(RLMSyncUser *user, NSError *error) {
-        XCTAssertNil(user);
-        XCTAssertNotNil(error);
-        XCTAssertEqualObjects(error.domain, NSURLErrorDomain);
-        XCTAssertEqual(error.code, NSURLErrorServerCertificateUntrusted);
-    }];
-}
-
-static NSURL *certificateURL(NSString *filename) {
-    return [NSURL fileURLWithPath:[[[@(__FILE__) stringByDeletingLastPathComponent]
-                                    stringByAppendingPathComponent:@"certificates"]
-                                   stringByAppendingPathComponent:filename]];
-}
-
-- (void)testHTTPSLoginFailsWithIncorrectCertificate {
-    RLMSyncManager.sharedManager.pinnedCertificatePaths = @{@"localhost": certificateURL(@"not-localhost.cer")};
-    [self attemptLoginWithUsername:NSStringFromSelector(_cmd) callback:^(RLMSyncUser *user, NSError *error) {
-        XCTAssertNil(user);
-        XCTAssertNotNil(error);
-        XCTAssertEqualObjects(error.domain, NSURLErrorDomain);
-        XCTAssertEqual(error.code, NSURLErrorServerCertificateUntrusted);
-    }];
-}
-
-- (void)testHTTPSLoginFailsWithInvalidPathToCertificate {
-    RLMSyncManager.sharedManager.pinnedCertificatePaths = @{@"localhost": certificateURL(@"nonexistent.pem")};
-    [self attemptLoginWithUsername:NSStringFromSelector(_cmd) callback:^(RLMSyncUser *user, NSError *error) {
-        XCTAssertNil(user);
-        XCTAssertNotNil(error);
-        XCTAssertEqualObjects(error.domain, NSCocoaErrorDomain);
-        XCTAssertEqual(error.code, NSFileReadNoSuchFileError);
-    }];
-}
-
-- (void)testHTTPSLoginFailsWithDifferentValidCert {
-    RLMSyncManager.sharedManager.pinnedCertificatePaths = @{@"localhost": certificateURL(@"localhost-other.cer")};
-    [self attemptLoginWithUsername:NSStringFromSelector(_cmd) callback:^(RLMSyncUser *user, NSError *error) {
-        XCTAssertNil(user);
-        XCTAssertNotNil(error);
-        XCTAssertEqualObjects(error.domain, NSURLErrorDomain);
-        XCTAssertEqual(error.code, NSURLErrorServerCertificateUntrusted);
-    }];
-}
-
-- (void)testHTTPSLoginFailsWithFileThatIsNotACert {
-    RLMSyncManager.sharedManager.pinnedCertificatePaths = @{@"localhost": certificateURL(@"../test-ros-server.js")};
-    [self attemptLoginWithUsername:NSStringFromSelector(_cmd) callback:^(RLMSyncUser *user, NSError *error) {
-        XCTAssertNil(user);
-        XCTAssertNotNil(error);
-        XCTAssertEqualObjects(error.domain, NSOSStatusErrorDomain);
-        XCTAssertEqual(error.code, errSecUnknownFormat);
-    }];
-}
-
-- (void)testHTTPSLoginDoesNotUseCertificateForDifferentDomain {
-    RLMSyncManager.sharedManager.pinnedCertificatePaths = @{@"example.com": certificateURL(@"localhost.cer")};
-    [self attemptLoginWithUsername:NSStringFromSelector(_cmd) callback:^(RLMSyncUser *user, NSError *error) {
-        XCTAssertNil(user);
-        XCTAssertNotNil(error);
-        XCTAssertEqualObjects(error.domain, NSURLErrorDomain);
-        XCTAssertEqual(error.code, NSURLErrorServerCertificateUntrusted);
-    }];
-}
-
-- (void)testHTTPSLoginSucceedsWithValidSelfSignedCertificate {
-    RLMSyncManager.sharedManager.pinnedCertificatePaths = @{@"localhost": certificateURL(@"localhost.cer")};
-
-    [self attemptLoginWithUsername:NSStringFromSelector(_cmd) callback:^(RLMSyncUser *user, NSError *error) {
-        XCTAssertNotNil(user);
-        XCTAssertNil(error);
-    }];
-}
-
-- (void)testConfigurationFromUserAutomaticallyUsesCert {
-    RLMSyncManager.sharedManager.pinnedCertificatePaths = @{@"localhost": certificateURL(@"localhost.cer")};
-
-    __block RLMSyncUser *user;
-    [self attemptLoginWithUsername:NSStringFromSelector(_cmd) callback:^(RLMSyncUser *u, NSError *error) {
-        XCTAssertNotNil(u);
-        XCTAssertNil(error);
-        user = u;
-    }];
-
-    RLMRealmConfiguration *config = [user configuration];
-    XCTAssertEqualObjects(config.syncConfiguration.realmURL.scheme, @"realms");
-    XCTAssertEqualObjects(config.syncConfiguration.pinnedCertificateURL, certificateURL(@"localhost.cer"));
-
-    // Verify that we can actually open the Realm
-    auto realm = [self openRealmWithConfiguration:config];
-    NSError *error;
-    [self waitForUploadsForRealm:realm error:&error];
-    XCTAssertNil(error);
-}
-
-- (void)verifyOpenSucceeds:(RLMRealmConfiguration *)config {
-    auto realm = [self openRealmWithConfiguration:config];
-    NSError *error;
-    [self waitForUploadsForRealm:realm error:&error];
-    XCTAssertNil(error);
-}
-
-- (void)verifyOpenFails:(RLMRealmConfiguration *)config {
-    XCTestExpectation *expectation = [self expectationWithDescription:@"wait for error"];
-    RLMSyncManager.sharedManager.errorHandler = ^(NSError *error, __unused RLMSyncSession *session) {
-        XCTAssertTrue([error.domain isEqualToString:RLMSyncErrorDomain]);
-        XCTAssertFalse([[error.userInfo[kRLMSyncUnderlyingErrorKey] domain] isEqualToString:RLMSyncErrorDomain]);
-        [expectation fulfill];
-    };
-
-    [self openRealmWithConfiguration:config];
-    [self waitForExpectationsWithTimeout:20.0 handler:nil];
-}
-
-- (void)testConfigurationFromInsecureUserAutomaticallyUsesCert {
-    RLMSyncManager.sharedManager.pinnedCertificatePaths = @{@"localhost": certificateURL(@"localhost.cer")};
-
-    RLMSyncUser *user = [self logInUserForCredentials:[RLMSyncTestCase basicCredentialsWithName:NSStringFromSelector(_cmd)
-                                                                                       register:YES]
-                                               server:[RLMSyncTestCase authServerURL]];
-
-    RLMRealmConfiguration *config = [user configurationWithURL:[NSURL URLWithString:@"realms://localhost:9443/~/default"]];
-    XCTAssertEqualObjects(config.syncConfiguration.realmURL.scheme, @"realms");
-    XCTAssertEqualObjects(config.syncConfiguration.pinnedCertificateURL, certificateURL(@"localhost.cer"));
-
-    [self verifyOpenSucceeds:config];
-}
-
-- (void)testOpenSecureRealmWithNoCert {
-    RLMSyncUser *user = [self logInUserForCredentials:[RLMSyncTestCase basicCredentialsWithName:NSStringFromSelector(_cmd)
-                                                                                       register:YES]
-                                               server:[RLMSyncTestCase authServerURL]];
-    [self verifyOpenFails:[user configurationWithURL:[NSURL URLWithString:@"realms://localhost:9443/~/default"]]];
-}
-
-- (void)testOpenSecureRealmWithIncorrectCert {
-    RLMSyncManager.sharedManager.pinnedCertificatePaths = @{@"localhost": certificateURL(@"not-localhost.cer")};
-
-    RLMSyncUser *user = [self logInUserForCredentials:[RLMSyncTestCase basicCredentialsWithName:NSStringFromSelector(_cmd)
-                                                                                       register:YES]
-                                               server:[RLMSyncTestCase authServerURL]];
-    [self verifyOpenFails:[user configurationWithURL:[NSURL URLWithString:@"realms://localhost:9443/~/default"]]];
-}
-
-- (void)DISABLE_testOpenSecureRealmWithMissingCertFile {
-    // FIXME: this currently crashes inside the sync library
-    RLMSyncManager.sharedManager.pinnedCertificatePaths = @{@"localhost": certificateURL(@"nonexistent.pem")};
-
-    RLMSyncUser *user = [self logInUserForCredentials:[RLMSyncTestCase basicCredentialsWithName:NSStringFromSelector(_cmd)
-                                                                                       register:YES]
-                                               server:[RLMSyncTestCase authServerURL]];
-    [self verifyOpenFails:[user configurationWithURL:[NSURL URLWithString:@"realms://localhost:9443/~/default"]]];
-}
-
-#pragma mark - Custom request headers
-
-- (void)testLoginFailsWithoutCustomHeader {
-    XCTestExpectation *expectation = [self expectationWithDescription:@"register user"];
-    [RLMSyncUser logInWithCredentials:[RLMSyncTestCase basicCredentialsWithName:NSStringFromSelector(_cmd)
-                                                                       register:YES]
-                        authServerURL:[NSURL URLWithString:@"http://127.0.0.1:9081"]
-                         onCompletion:^(RLMSyncUser *user, NSError *error) {
-                             XCTAssertNil(user);
-                             XCTAssertNotNil(error);
-                             XCTAssertEqualObjects(@400, error.userInfo[@"statusCode"]);
-                             [expectation fulfill];
-                         }];
-    [self waitForExpectationsWithTimeout:4.0 handler:nil];
-}
-
-- (void)testLoginUsesCustomHeader {
-    RLMSyncManager.sharedManager.customRequestHeaders = @{@"X-Allow-Connection": @"true"};
-    RLMSyncUser *user = [self logInUserForCredentials:[RLMSyncTestCase basicCredentialsWithName:NSStringFromSelector(_cmd)
-                                                                                       register:YES]
-                                               server:[NSURL URLWithString:@"http://127.0.0.1:9081"]];
-    XCTAssertNotNil(user);
-}
-
-- (void)testModifyCustomHeadersAfterOpeningRealm {
-    RLMSyncManager.sharedManager.customRequestHeaders = @{@"X-Allow-Connection": @"true"};
-    RLMSyncUser *user = [self logInUserForCredentials:[RLMSyncTestCase basicCredentialsWithName:NSStringFromSelector(_cmd)
-                                                                                       register:YES]
-                                               server:[NSURL URLWithString:@"http://127.0.0.1:9081"]];
-    XCTAssertNotNil(user);
-
-    RLMSyncManager.sharedManager.customRequestHeaders = nil;
-
-    NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"realm://127.0.0.1:9081/~/%@", NSStringFromSelector(_cmd)]];
-    auto c = [user configurationWithURL:url fullSynchronization:true];
-
-    // Should initially fail to connect due to the missing header
-    XCTestExpectation *ex1 = [self expectationWithDescription:@"connection failure"];
-    RLMSyncManager.sharedManager.errorHandler = ^(NSError *error, RLMSyncSession *) {
-        XCTAssertNotNil(error);
-        XCTAssertEqualObjects(@400, [error.userInfo[@"underlying_error"] userInfo][@"statusCode"]);
-        [ex1 fulfill];
-    };
-    RLMRealm *realm = [RLMRealm realmWithConfiguration:c error:nil];
-    RLMSyncSession *syncSession = realm.syncSession;
-    [self waitForExpectationsWithTimeout:4.0 handler:nil];
-    XCTAssertEqual(syncSession.connectionState, RLMSyncConnectionStateDisconnected);
-
-    // Should successfully connect once the header is set
-    RLMSyncManager.sharedManager.errorHandler = nil;
-    auto ex2 = [[XCTKVOExpectation alloc] initWithKeyPath:@"connectionState"
-                                                   object:syncSession
-                                            expectedValue:@(RLMSyncConnectionStateConnected)];
-    RLMSyncManager.sharedManager.customRequestHeaders = @{@"X-Allow-Connection": @"true"};
-    [self waitForExpectations:@[ex2] timeout:4.0];
-
-    // Should disconnect and fail to reconnect when the wrong header is set
-    XCTestExpectation *ex3 = [self expectationWithDescription:@"reconnection failure"];
-    RLMSyncManager.sharedManager.errorHandler = ^(NSError *error, RLMSyncSession *) {
-        XCTAssertNotNil(error);
-        XCTAssertEqualObjects(@400, [error.userInfo[@"underlying_error"] userInfo][@"statusCode"]);
-        [ex3 fulfill];
-    };
-    auto ex4 = [[XCTKVOExpectation alloc] initWithKeyPath:@"connectionState"
-                                                   object:syncSession
-                                            expectedValue:@(RLMSyncConnectionStateDisconnected)];
-    RLMSyncManager.sharedManager.customRequestHeaders = @{@"X-Other-Header": @"true"};
-    [self waitForExpectations:@[ex3, ex4] timeout:4.0];
-}
-
-#pragma mark - Read Only
-
-- (RLMSyncUser *)userForTest:(SEL)sel {
-    return [self logInUserForCredentials:[RLMObjectServerTests basicCredentialsWithName:NSStringFromSelector(sel)
-                                                                               register:self.isParent]
-                                  server:[RLMObjectServerTests authServerURL]];
-}
-
-- (void)testPartialSyncCannotBeReadOnly {
-    RLMSyncUser *user = [self userForTest:_cmd];
-    RLMRealmConfiguration *config = [user configurationWithURL:nil fullSynchronization:NO];
-    RLMAssertThrowsWithReason(config.readOnly = true,
-                              @"Read-only mode is not supported for query-based sync.");
-}
-
-- (void)testOpenSynchronouslyInReadOnlyBeforeRemoteSchemaIsInitialized {
-    NSURL *url = REALM_URL();
-    RLMSyncUser *user = [self userForTest:_cmd];
-
-    if (self.isParent) {
-        RLMRealmConfiguration *config = [user configurationWithURL:url fullSynchronization:YES];
-        config.readOnly = true;
-        RLMRealm *realm = [RLMRealm realmWithConfiguration:config error:nil];
-        CHECK_COUNT(0, SyncObject, realm);
-        RLMRunChildAndWait();
-        [self waitForDownloadsForUser:user realms:@[realm] realmURLs:@[url] expectedCounts:@[@3]];
-    } else {
-        RLMRealm *realm = [self openRealmForURL:url user:user];
-        [self addSyncObjectsToRealm:realm descriptions:@[@"child-1", @"child-2", @"child-3"]];
-        [self waitForUploadsForRealm:realm];
-        CHECK_COUNT(3, SyncObject, realm);
-    }
-}
-
-- (void)testAddPropertyToReadOnlyRealmWithExistingLocalCopy {
-    NSURL *url = REALM_URL();
-    RLMSyncUser *user = [self userForTest:_cmd];
-
-    if (!self.isParent) {
-        RLMRealm *realm = [self openRealmForURL:url user:user];
-        [self addSyncObjectsToRealm:realm descriptions:@[@"child-1", @"child-2", @"child-3"]];
-        [self waitForUploadsForRealm:realm];
-        return;
-    }
-    RLMRunChildAndWait();
-
-    RLMRealmConfiguration *config = [user configurationWithURL:url fullSynchronization:YES];
-    config.readOnly = true;
-    @autoreleasepool {
-        (void)[self asyncOpenRealmWithConfiguration:config];
-    }
-
-    RLMObjectSchema *objectSchema = [RLMObjectSchema schemaForObjectClass:SyncObject.class];
-    objectSchema.properties = [RLMObjectSchema schemaForObjectClass:HugeSyncObject.class].properties;
-    config.customSchema = [[RLMSchema alloc] init];
-    config.customSchema.objectSchema = @[objectSchema];
-
-    RLMAssertThrowsWithReason([RLMRealm realmWithConfiguration:config error:nil],
-                              @"Property 'SyncObject.dataProp' has been added.");
-
-    @autoreleasepool {
-        NSError *error = [self asyncOpenErrorWithConfiguration:config];
-        XCTAssertNotEqual([error.localizedDescription rangeOfString:@"Property 'SyncObject.dataProp' has been added."].location,
-                          NSNotFound);
-    }
-}
-
-- (void)testAddPropertyToReadOnlyRealmWithAsyncOpen {
-    NSURL *url = REALM_URL();
-    RLMSyncUser *user = [self userForTest:_cmd];
-
-    if (!self.isParent) {
-        RLMRealm *realm = [self openRealmForURL:url user:user];
-        [self addSyncObjectsToRealm:realm descriptions:@[@"child-1", @"child-2", @"child-3"]];
-        [self waitForUploadsForRealm:realm];
-        return;
-    }
-    RLMRunChildAndWait();
-
-    RLMRealmConfiguration *config = [user configurationWithURL:url fullSynchronization:YES];
-    config.readOnly = true;
-
-    RLMObjectSchema *objectSchema = [RLMObjectSchema schemaForObjectClass:SyncObject.class];
-    objectSchema.properties = [RLMObjectSchema schemaForObjectClass:HugeSyncObject.class].properties;
-    config.customSchema = [[RLMSchema alloc] init];
-    config.customSchema.objectSchema = @[objectSchema];
-
-    @autoreleasepool {
-        NSError *error = [self asyncOpenErrorWithConfiguration:config];
-        XCTAssertNotEqual([error.localizedDescription rangeOfString:@"Property 'SyncObject.dataProp' has been added."].location,
-                          NSNotFound);
-    }
-}
-
-@end

+ 0 - 1095
Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/RLMPermissionsAPITests.m

@@ -1,1095 +0,0 @@
-////////////////////////////////////////////////////////////////////////////
-//
-// Copyright 2017 Realm Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////
-
-#import <XCTest/XCTest.h>
-
-#import "RLMSyncTestCase.h"
-
-#import "RLMTestUtils.h"
-
-@interface RLMSyncPermission ()
-- (RLMSyncPermission *)tildeExpandedSyncPermissionForUser:(RLMSyncUser *)user;
-@end
-@interface RLMSyncUser ()
-- (void)invalidate;
-@end
-
-#define APPLY_PERMISSION(ma_permission, ma_user) \
-    APPLY_PERMISSION_WITH_MESSAGE(ma_permission, ma_user, ma_user, @"Setting a permission should work")
-
-
-#define APPLY_PERMISSION_WITH_MESSAGE(ma_permission, ma_user, ma_target_user, ma_message) do {                         \
-    APPLY_PERMISSION_UNCHECKED(ma_permission, ma_user, ma_message);                                                    \
-    CHECK_PERMISSION_PRESENT([self getPermissionResultsFor:ma_target_user], ma_permission, ma_user);                   \
-} while (0)
-
-#define APPLY_PERMISSION_UNCHECKED(ma_permission, ma_user, ma_message) do {                                            \
-    XCTestExpectation *ex = [self expectationWithDescription:ma_message];                                              \
-    [ma_user applyPermission:ma_permission callback:^(NSError *err) {                                                  \
-        XCTAssertNil(err, @"Received an error when applying permission: %@", err);                                     \
-        [ex fulfill];                                                                                                  \
-    }];                                                                                                                \
-    [self waitForExpectations:@[ex] timeout:2.0];                                                                      \
-} while (0)
-
-#define REVOKE_PERMISSION(ma_permission, ma_user) do {                                                                 \
-    XCTestExpectation *ex = [self expectationWithDescription:@"revoke permission"];                                    \
-    [ma_user applyPermission:ma_permission callback:^(NSError *err) {                                                  \
-        XCTAssertNil(err, @"Received an error when applying permission: %@", err);                                     \
-        [ex fulfill];                                                                                                  \
-    }];                                                                                                                \
-    [self waitForExpectations:@[ex] timeout:2.0];                                                                      \
-    CHECK_PERMISSION_ABSENT([self getPermissionResultsFor:ma_user], ma_permission, ma_user);                           \
-} while (0)
-
-#define CHECK_COUNT_PENDING_DOWNLOAD(expected_count, m_type, m_realm) \
-    CHECK_COUNT_PENDING_DOWNLOAD_CUSTOM_EXPECTATION(expected_count, m_type, m_realm, nil)
-
-/// This macro tries ten times to wait for downloads and then check for object count.
-/// If the object count does not match, it waits 0.1 second before trying again.
-/// It is most useful in cases where the test ROS might be expected to take some
-/// non-negligible amount of time performing an operation whose completion is required
-/// for the test on the client side to proceed.
-#define CHECK_COUNT_PENDING_DOWNLOAD_CUSTOM_EXPECTATION(expected_count, m_type, m_realm, m_exp) do {                   \
-    RLMSyncConfiguration *m_config = m_realm.configuration.syncConfiguration;                                          \
-    XCTAssertNotNil(m_config, @"Realm passed to CHECK_COUNT_PENDING_DOWNLOAD() doesn't have a sync config!");          \
-    RLMSyncUser *m_user = m_config.user;                                                                               \
-    NSURL *m_url = m_config.realmURL;                                                                                  \
-    for (int i=0; i<10; i++) {                                                                                         \
-        [self waitForDownloadsForUser:m_user url:m_url expectation:m_exp error:nil];                                   \
-        if (expected_count == [m_type allObjectsInRealm:m_realm].count) { break; }                                     \
-        [[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];                           \
-    }                                                                                                                  \
-    CHECK_COUNT(expected_count, m_type, m_realm);                                                                      \
-} while (0)
-
-
-static NSURL *makeTestURL(NSString *name, RLMSyncUser *owner) {
-    NSString *userID = [owner identity] ?: @"~";
-    return [[NSURL alloc] initWithString:[NSString stringWithFormat:@"realm://127.0.0.1:9080/%@/%@", userID, name]];
-}
-
-static NSURL *makeTestGlobalURL(NSString *name) {
-    return [[NSURL alloc] initWithString:[NSString stringWithFormat:@"realm://127.0.0.1:9080/%@", name]];
-}
-
-static NSURL *makeTildeSubstitutedURL(NSURL *url, RLMSyncUser *user) {
-    return [NSURL URLWithString:[[url absoluteString] stringByReplacingOccurrencesOfString:@"~" withString:user.identity]];
-}
-
-@interface RLMPermissionsAPITests : RLMSyncTestCase
-
-@property (nonatomic, strong) NSString *currentUsernameBase;
-
-@property (nonatomic, strong) RLMSyncUser *userA;
-@property (nonatomic, strong) RLMSyncUser *userB;
-@property (nonatomic, strong) RLMSyncUser *userC;
-
-@property (nonatomic, strong) NSString *userBUsername;
-
-@end
-
-@implementation RLMPermissionsAPITests
-
-- (void)setUp {
-    [super setUp];
-    NSString *accountNameBase = [[NSUUID UUID] UUIDString];
-    self.currentUsernameBase = accountNameBase;
-    NSString *userNameA = [accountNameBase stringByAppendingString:@"a"];
-    self.userA = [self logInUserForCredentials:[RLMSyncTestCase basicCredentialsWithName:userNameA register:YES]
-                                        server:[RLMSyncTestCase authServerURL]];
-
-    NSString *userNameB = [accountNameBase stringByAppendingString:@"b"];
-    self.userBUsername = userNameB;
-    self.userB = [self logInUserForCredentials:[RLMSyncTestCase basicCredentialsWithName:userNameB register:YES]
-                                        server:[RLMSyncTestCase authServerURL]];
-
-    NSString *userNameC = [accountNameBase stringByAppendingString:@"c"];
-    self.userC = [self logInUserForCredentials:[RLMSyncTestCase basicCredentialsWithName:userNameC register:YES]
-                                        server:[RLMSyncTestCase authServerURL]];
-
-    RLMSyncManager.sharedManager.errorHandler = ^(NSError *error, __unused RLMSyncSession *session) {
-        XCTFail(@"Error handler should not be called unless explicitly expected. Error: %@", error);
-    };
-}
-
-- (void)tearDown {
-    self.currentUsernameBase = nil;
-    [self.userA logOut];
-    [self.userB logOut];
-    [self.userC logOut];
-    self.userBUsername = nil;
-    [super tearDown];
-}
-
-#pragma mark - Permission validation methods
-
-#define CHECK_PERMISSION_PRESENT(ma_results, ma_permission, ma_user) \
-    XCTAssertNotEqual([ma_results indexOfObject:[ma_permission tildeExpandedSyncPermissionForUser:ma_user]], NSNotFound)
-
-#define CHECK_PERMISSION_ABSENT(ma_results, ma_permission, ma_user) \
-    XCTAssertEqual([ma_results indexOfObject:[ma_permission tildeExpandedSyncPermissionForUser:ma_user]], NSNotFound)
-
-#define CHECK_PERMISSION_COUNT_AT_LEAST(ma_results, ma_count) \
-    XCTAssertGreaterThanOrEqual(ma_results.count, ma_count)
-
-#define CHECK_PERMISSION_COUNT(ma_results, ma_count) \
-    XCTAssertEqual(ma_results.count, ma_count)
-
-#pragma mark - Helper methods
-
-- (NSArray<RLMSyncPermission *> *)getPermissionResultsFor:(RLMSyncUser *)user {
-    return [self getPermissionResultsFor:user message:@"Get permission results"];
-}
-
-- (NSArray<RLMSyncPermission *> *)getPermissionResultsFor:(RLMSyncUser *)user message:(NSString *)message {
-    // Get a reference to the permission results.
-    XCTestExpectation *ex = [self expectationWithDescription:message];
-    __block NSArray<RLMSyncPermission *> *results = nil;
-    [user retrievePermissionsWithCallback:^(NSArray<RLMSyncPermission *> *r, NSError *error) {
-        XCTAssertNil(error);
-        XCTAssertNotNil(r);
-        results = r;
-        [ex fulfill];
-    }];
-    [self waitForExpectationsWithTimeout:2.0 handler:nil];
-    XCTAssertNotNil(results, @"getPermissionResultsFor: failed for user %@. No results.", user.identity);
-    return results;
-}
-
-- (void)testErrorHandlingForInvalidUser {
-    [self.userA invalidate];
-    RLMSyncPermission *p;
-    NSURL *url;
-
-    __block bool called = false;
-    void (^checkError)(NSError *) = ^(NSError *err) {
-        XCTAssertNotNil(err);
-        XCTAssertEqual(err.code, RLMSyncAuthErrorInvalidParameters);
-        called = true;
-    };
-
-    [self.userA retrievePermissionsWithCallback:^(id permissions, NSError *err) {
-        XCTAssertNil(permissions);
-        checkError(err);
-    }];
-    XCTAssertTrue(called);
-
-    called = false;
-    [self.userA applyPermission:p callback:^(NSError *err) {
-        checkError(err);
-    }];
-    XCTAssertTrue(called);
-
-    called = false;
-    [self.userA createOfferForRealmAtURL:url accessLevel:RLMSyncAccessLevelWrite expiration:nil callback:^(NSString *token, NSError *err) {
-        XCTAssertNil(token);
-        checkError(err);
-    }];
-    XCTAssertTrue(called);
-
-    called = false;
-    [self.userA acceptOfferForToken:@"" callback:^(NSURL *url, NSError *err) {
-        XCTAssertNil(url);
-        checkError(err);
-    }];
-    XCTAssertTrue(called);
-
-    called = false;
-    [self.userA invalidateOfferForToken:@"" callback:^(NSError *err) {
-        checkError(err);
-    }];
-    XCTAssertTrue(called);
-}
-
-#pragma mark - Permissions
-
-/// If user A grants user B read access to a Realm, user B should be able to read from it.
-- (void)testReadAccess {
-    NSString *testName = NSStringFromSelector(_cmd);
-    // Open a Realm for user A.
-    NSURL *userAURL = makeTestURL(testName, nil);
-    RLMRealm *userARealm = [self openRealmForURL:userAURL user:self.userA];
-
-    // Have user A add some items to the Realm.
-    [self addSyncObjectsToRealm:userARealm descriptions:@[@"child-1", @"child-2", @"child-3"]];
-    [self waitForUploadsForRealm:userARealm];
-    CHECK_COUNT(3, SyncObject, userARealm);
-
-    // Give user B read permissions to that Realm.
-    RLMSyncPermission *p = [[RLMSyncPermission alloc] initWithRealmPath:[userAURL path]
-                                                               identity:self.userB.identity
-                                                            accessLevel:RLMSyncAccessLevelRead];
-    // Set the read permission.
-    APPLY_PERMISSION(p, self.userA);
-
-    // Open the same Realm for user B.
-    NSURL *userBURL = makeTestURL(testName, self.userA);
-    RLMRealmConfiguration *userBConfig = [self.userB configurationWithURL:userBURL fullSynchronization:YES];
-    __block RLMRealm *userBRealm = nil;
-    XCTestExpectation *asyncOpenEx = [self expectationWithDescription:@"Should asynchronously open a Realm"];
-    [RLMRealm asyncOpenWithConfiguration:userBConfig
-                           callbackQueue:dispatch_get_main_queue()
-                                callback:^(RLMRealm *realm, NSError *err){
-                                    XCTAssertNil(err);
-                                    XCTAssertNotNil(realm);
-                                    userBRealm = realm;
-                                    [asyncOpenEx fulfill];
-    }];
-    [self waitForExpectationsWithTimeout:10.0 handler:nil];
-    CHECK_COUNT(3, SyncObject, userBRealm);
-
-    // Ensure user B can't actually write to the Realm.
-    // Run this portion of the test on a background queue, since the error handler is dispatched onto the main queue.
-    XCTestExpectation *deniedEx = [self expectationWithDescription:@"Expect a permission denied error."];
-    RLMSyncManager.sharedManager.errorHandler = ^(NSError *err, __unused RLMSyncSession *session) {
-        // Expect an error from the global error handler.
-        XCTAssertNotNil(err);
-        XCTAssertEqual(err.code, RLMSyncErrorPermissionDeniedError);
-        [deniedEx fulfill];
-    };
-    [self addSyncObjectsToRealm:userBRealm descriptions:@[@"child-4", @"child-5", @"child-6"]];
-    [self waitForExpectations:@[deniedEx] timeout:20.0];
-
-    // TODO: if we can get the session itself we can check to see if it's been errored out (as expected).
-
-    // Perhaps obviously, there should be no new objects.
-    CHECK_COUNT_PENDING_DOWNLOAD(3, SyncObject, userARealm);
-
-    // Administering the Realm should fail.
-    RLMSyncPermission *p2 = [[RLMSyncPermission alloc] initWithRealmPath:[userBURL path]
-                                                                identity:self.userC.identity
-                                                             accessLevel:RLMSyncAccessLevelRead];
-    XCTestExpectation *manageEx = [self expectationWithDescription:@"Managing a Realm you can't manage should fail."];
-    [self.userB applyPermission:p2 callback:^(NSError *error) {
-        XCTAssertNotNil(error);
-        [manageEx fulfill];
-    }];
-    [self waitForExpectationsWithTimeout:2.0 handler:nil];
-}
-
-/// If user A grants user B write access to a Realm, user B should be able to write to it.
-- (void)testWriteAccess {
-    NSString *testName = NSStringFromSelector(_cmd);
-    // Open a Realm for user A.
-    NSURL *userAURL = makeTestURL(testName, nil);
-    RLMRealm *userARealm = [self openRealmForURL:userAURL user:self.userA];
-
-    // Have user A add some items to the Realm.
-    [self addSyncObjectsToRealm:userARealm descriptions:@[@"child-1", @"child-2", @"child-3"]];
-    [self waitForUploadsForRealm:userARealm];
-    CHECK_COUNT(3, SyncObject, userARealm);
-
-    // Give user B write permissions to that Realm.
-    RLMSyncPermission *p = [[RLMSyncPermission alloc] initWithRealmPath:[userAURL path]
-                                                               identity:self.userB.identity
-                                                            accessLevel:RLMSyncAccessLevelWrite];
-    // Set the permission.
-    APPLY_PERMISSION(p, self.userA);
-
-    // Open the Realm for user B. Since user B has write privileges, they should be able to open it 'normally'.
-    NSURL *userBURL = makeTestURL(testName, self.userA);
-    RLMRealm *userBRealm = [self openRealmForURL:userBURL user:self.userB];
-    CHECK_COUNT_PENDING_DOWNLOAD(3, SyncObject, userBRealm);
-
-    // Add some objects using user B.
-    [self addSyncObjectsToRealm:userBRealm descriptions:@[@"child-4", @"child-5"]];
-    [self waitForUploadsForRealm:userBRealm];
-    CHECK_COUNT(5, SyncObject, userBRealm);
-    CHECK_COUNT_PENDING_DOWNLOAD(5, SyncObject, userARealm);
-
-    // Administering the Realm should fail.
-    RLMSyncPermission *p2 = [[RLMSyncPermission alloc] initWithRealmPath:[userBURL path]
-                                                                identity:self.userC.identity
-                                                             accessLevel:RLMSyncAccessLevelRead];
-    XCTestExpectation *manageEx = [self expectationWithDescription:@"Managing a Realm you can't manage should fail."];
-    [self.userB applyPermission:p2 callback:^(NSError *error) {
-        XCTAssertNotNil(error);
-        [manageEx fulfill];
-    }];
-    [self waitForExpectationsWithTimeout:2.0 handler:nil];
-}
-
-/// If user A grants user B manage access to a Realm, user B should be able to set a permission for user C.
-- (void)testManageAccess {
-    NSString *testName = NSStringFromSelector(_cmd);
-    // Unresolved URL: ~/testManageAccess
-    NSURL *userAURLUnresolved = makeTestURL(testName, nil);
-    // Resolved URL: <User A ID>/testManageAccess
-    NSURL *userAURLResolved = makeTestURL(testName, self.userA);
-
-    // Open a Realm for user A.
-    RLMRealm *userARealm = [self openRealmForURL:userAURLUnresolved user:self.userA];
-
-    // Have user A add some items to the Realm.
-    [self addSyncObjectsToRealm:userARealm descriptions:@[@"child-1", @"child-2", @"child-3"]];
-    [self waitForUploadsForRealm:userARealm];
-    CHECK_COUNT(3, SyncObject, userARealm);
-
-    // Give user B admin permissions to that Realm.
-    RLMSyncPermission *p = [[RLMSyncPermission alloc] initWithRealmPath:[userAURLUnresolved path]
-                                                               identity:self.userB.identity
-                                                            accessLevel:RLMSyncAccessLevelAdmin];
-    // Set the permission.
-    APPLY_PERMISSION(p, self.userA);
-
-    // Open the Realm for user B. Since user B has admin privileges, they should be able to open it 'normally'.
-    RLMRealm *userBRealm = [self openRealmForURL:userAURLResolved user:self.userB];
-    CHECK_COUNT_PENDING_DOWNLOAD(3, SyncObject, userBRealm);
-
-    // Add some objects using user B.
-    [self addSyncObjectsToRealm:userBRealm descriptions:@[@"child-4", @"child-5"]];
-    [self waitForUploadsForRealm:userBRealm];
-    CHECK_COUNT(5, SyncObject, userBRealm);
-    CHECK_COUNT_PENDING_DOWNLOAD(5, SyncObject, userARealm);
-
-    // User B should be able to give user C write permissions to user A's Realm.
-    RLMSyncPermission *p2 = [[RLMSyncPermission alloc] initWithRealmPath:[userAURLResolved path]
-                                                                identity:self.userC.identity
-                                                             accessLevel:RLMSyncAccessLevelWrite];
-    APPLY_PERMISSION_WITH_MESSAGE(p2, self.userB, self.userC,
-                                  @"User B should be able to give C write permissions to A's Realm.");
-
-    // User C should be able to write to the Realm.
-    RLMRealm *userCRealm = [self openRealmForURL:userAURLResolved user:self.userC];
-    CHECK_COUNT_PENDING_DOWNLOAD(5, SyncObject, userCRealm);
-    [self addSyncObjectsToRealm:userCRealm descriptions:@[@"child-6", @"child-7", @"child-8"]];
-    [self waitForUploadsForRealm:userCRealm];
-    CHECK_COUNT(8, SyncObject, userCRealm);
-    CHECK_COUNT_PENDING_DOWNLOAD(8, SyncObject, userARealm);
-    CHECK_COUNT_PENDING_DOWNLOAD(8, SyncObject, userBRealm);
-}
-
-/// If user A grants user B write access to a Realm via username, user B should be able to write to it.
-- (void)testWriteAccessViaUsername {
-    NSString *testName = NSStringFromSelector(_cmd);
-    // Open a Realm for user A.
-    NSURL *userAURL = makeTestURL(testName, nil);
-    RLMRealm *userARealm = [self openRealmForURL:userAURL user:self.userA];
-
-    // Have user A add some items to the Realm.
-    [self addSyncObjectsToRealm:userARealm descriptions:@[@"child-1", @"child-2", @"child-3"]];
-    [self waitForUploadsForRealm:userARealm];
-    CHECK_COUNT(3, SyncObject, userARealm);
-
-    // Give user B write permissions to that Realm via user B's username.
-    NSString *userAFullPath = [makeTildeSubstitutedURL(userAURL, self.userA) path];
-    RLMSyncPermission *p = [[RLMSyncPermission alloc] initWithRealmPath:userAURL.path
-                                                               username:self.userBUsername
-                                                            accessLevel:RLMSyncAccessLevelWrite];
-    // Set the permission.
-    APPLY_PERMISSION_UNCHECKED(p, self.userA, @"Grant permission via email");
-
-    RLMSyncPermission *expected = [[RLMSyncPermission alloc] initWithRealmPath:userAFullPath
-                                                                      identity:self.userB.identity
-                                                                   accessLevel:RLMSyncAccessLevelWrite];
-    CHECK_PERMISSION_PRESENT([self getPermissionResultsFor:self.userB], expected, self.userB);
-
-    // Open the Realm for user B. Since user B has write privileges, they should be able to open it 'normally'.
-    NSURL *userBURL = makeTestURL(testName, self.userA);
-    RLMRealm *userBRealm = [self openRealmForURL:userBURL user:self.userB];
-    CHECK_COUNT_PENDING_DOWNLOAD(3, SyncObject, userBRealm);
-
-    // Add some objects using user B.
-    [self addSyncObjectsToRealm:userBRealm descriptions:@[@"child-4", @"child-5"]];
-    [self waitForUploadsForRealm:userBRealm];
-    CHECK_COUNT(5, SyncObject, userBRealm);
-    CHECK_COUNT_PENDING_DOWNLOAD(5, SyncObject, userARealm);
-}
-
-/// Setting a permission for all users should work.
-- (void)testWildcardWriteAccess {
-    // Open a Realm for user A.
-    NSString *testName = NSStringFromSelector(_cmd);
-    NSURL *ownerURL = makeTestURL(testName, nil);
-    NSURL *guestURL = makeTestURL(testName, self.userA);
-    RLMRealm *userARealm = [self openRealmForURL:ownerURL user:self.userA];
-
-    // Give all users write permissions to that Realm.
-    RLMSyncPermission *p = [[RLMSyncPermission alloc] initWithRealmPath:[ownerURL path]
-                                                               identity:@"*"
-                                                            accessLevel:RLMSyncAccessLevelWrite];
-
-    // Set the permission.
-    APPLY_PERMISSION(p, self.userA);
-
-    // Have user A write a few objects first.
-    [self addSyncObjectsToRealm:userARealm descriptions:@[@"child-1", @"child-2", @"child-3"]];
-    [self waitForUploadsForRealm:userARealm];
-    CHECK_COUNT(3, SyncObject, userARealm);
-
-    // User B should be able to write to the Realm.
-    RLMRealm *userBRealm = [self openRealmForURL:guestURL user:self.userB];
-    CHECK_COUNT_PENDING_DOWNLOAD(3, SyncObject, userBRealm);
-    [self addSyncObjectsToRealm:userBRealm descriptions:@[@"child-4", @"child-5"]];
-    [self waitForUploadsForRealm:userBRealm];
-    CHECK_COUNT(5, SyncObject, userBRealm);
-
-    // User C should be able to write to the Realm.
-    RLMRealm *userCRealm = [self openRealmForURL:guestURL user:self.userC];
-    CHECK_COUNT_PENDING_DOWNLOAD(5, SyncObject, userCRealm);
-    [self addSyncObjectsToRealm:userCRealm descriptions:@[@"child-6", @"child-7", @"child-8", @"child-9"]];
-    [self waitForUploadsForRealm:userCRealm];
-    CHECK_COUNT(9, SyncObject, userCRealm);
-
-    p = [[RLMSyncPermission alloc] initWithRealmPath:[ownerURL path]
-                                            identity:@"*"
-                                         accessLevel:RLMSyncAccessLevelNone];
-    REVOKE_PERMISSION(p, self.userA);
-}
-
-/// It should be possible to grant read-only access to a global Realm.
-- (void)testWildcardGlobalRealmReadAccess {
-    RLMSyncUser *admin = [self createAdminUserForURL:[RLMSyncTestCase authServerURL]
-                                            username:[[NSUUID UUID] UUIDString]];
-
-    // Open a Realm for the admin user.
-    NSString *testName = NSStringFromSelector(_cmd);
-    NSURL *globalRealmURL = makeTestGlobalURL(testName);
-    RLMRealm *adminUserRealm = [self openRealmForURL:globalRealmURL user:admin];
-
-    // Give all users read permissions to that Realm.
-    RLMSyncPermission *p = [[RLMSyncPermission alloc] initWithRealmPath:[globalRealmURL path]
-                                                               identity:@"*"
-                                                            accessLevel:RLMSyncAccessLevelRead];
-
-    // Set the permission.
-    APPLY_PERMISSION_WITH_MESSAGE(p, admin, self.userA, @"Setting wildcard permission should work.");
-
-    // Have the admin user write a few objects first.
-    [self addSyncObjectsToRealm:adminUserRealm descriptions:@[@"child-1", @"child-2", @"child-3"]];
-    [self waitForUploadsForRealm:adminUserRealm];
-    CHECK_COUNT(3, SyncObject, adminUserRealm);
-
-    // User B should be able to read from the Realm.
-    __block RLMRealm *userBRealm = nil;
-    RLMRealmConfiguration *userBConfig = [self.userB configurationWithURL:globalRealmURL fullSynchronization:YES];
-    XCTestExpectation *asyncOpenEx = [self expectationWithDescription:@"Should asynchronously open a Realm"];
-    [RLMRealm asyncOpenWithConfiguration:userBConfig
-                           callbackQueue:dispatch_get_main_queue()
-                                callback:^(RLMRealm *realm, NSError *err){
-                                    XCTAssertNil(err);
-                                    XCTAssertNotNil(realm);
-                                    userBRealm = realm;
-                                    [asyncOpenEx fulfill];
-                                }];
-    [self waitForExpectationsWithTimeout:10.0 handler:nil];
-    CHECK_COUNT(3, SyncObject, userBRealm);
-
-    // User C should be able to read from the Realm.
-    __block RLMRealm *userCRealm = nil;
-    RLMRealmConfiguration *userCConfig = [self.userC configurationWithURL:globalRealmURL fullSynchronization:YES];
-    XCTestExpectation *asyncOpenEx2 = [self expectationWithDescription:@"Should asynchronously open a Realm"];
-    [RLMRealm asyncOpenWithConfiguration:userCConfig
-                           callbackQueue:dispatch_get_main_queue()
-                                callback:^(RLMRealm *realm, NSError *err){
-                                    XCTAssertNil(err);
-                                    XCTAssertNotNil(realm);
-                                    userCRealm = realm;
-                                    [asyncOpenEx2 fulfill];
-                                }];
-    [self waitForExpectationsWithTimeout:10.0 handler:nil];
-    CHECK_COUNT(3, SyncObject, userCRealm);
-
-    p = [[RLMSyncPermission alloc] initWithRealmPath:[globalRealmURL path]
-                                            identity:@"*"
-                                         accessLevel:RLMSyncAccessLevelNone];
-    REVOKE_PERMISSION(p, admin);
-}
-
-/// Setting a permission for all users on a global Realm (no `~`) should work.
-- (void)testWildcardGlobalRealmWriteAccess {
-    RLMSyncUser *admin = [self createAdminUserForURL:[RLMSyncTestCase authServerURL]
-                                            username:[[NSUUID UUID] UUIDString]];
-
-    // Open a Realm for the admin user.
-    NSString *testName = NSStringFromSelector(_cmd);
-    NSURL *globalRealmURL = makeTestGlobalURL(testName);
-    RLMRealm *adminUserRealm = [self openRealmForURL:globalRealmURL user:admin];
-
-    // Give all users write permissions to that Realm.
-    RLMSyncPermission *p = [[RLMSyncPermission alloc] initWithRealmPath:[globalRealmURL path]
-                                                               identity:@"*"
-                                                            accessLevel:RLMSyncAccessLevelWrite];
-
-    // Set the permission.
-    APPLY_PERMISSION_WITH_MESSAGE(p, admin, self.userA, @"Should grant access to all users");
-
-    // Have the admin user write a few objects first.
-    [self addSyncObjectsToRealm:adminUserRealm descriptions:@[@"child-1", @"child-2", @"child-3"]];
-    [self waitForUploadsForRealm:adminUserRealm];
-    CHECK_COUNT(3, SyncObject, adminUserRealm);
-
-    // User B should be able to write to the Realm.
-    RLMRealm *userBRealm = [self openRealmForURL:globalRealmURL user:self.userB];
-    CHECK_COUNT_PENDING_DOWNLOAD(3, SyncObject, userBRealm);
-    [self addSyncObjectsToRealm:userBRealm descriptions:@[@"child-4", @"child-5"]];
-    [self waitForUploadsForRealm:userBRealm];
-    CHECK_COUNT(5, SyncObject, userBRealm);
-
-    // User C should be able to write to the Realm.
-    RLMRealm *userCRealm = [self openRealmForURL:globalRealmURL user:self.userC];
-    CHECK_COUNT_PENDING_DOWNLOAD(5, SyncObject, userCRealm);
-    [self addSyncObjectsToRealm:userCRealm descriptions:@[@"child-6", @"child-7", @"child-8", @"child-9"]];
-    [self waitForUploadsForRealm:userCRealm];
-    CHECK_COUNT(9, SyncObject, userCRealm);
-
-    p = [[RLMSyncPermission alloc] initWithRealmPath:[globalRealmURL path]
-                                            identity:@"*"
-                                         accessLevel:RLMSyncAccessLevelNone];
-    REVOKE_PERMISSION(p, admin);
-}
-
-- (void)testReadAccessWithClassSuperset {
-    NSString *testName = NSStringFromSelector(_cmd);
-
-    // Create a Realm with only a single object type
-    NSURL *userAURL = makeTestURL(testName, nil);
-    RLMRealmConfiguration *userAConfig = [self.userA configurationWithURL:userAURL fullSynchronization:YES];
-    userAConfig.objectClasses = @[SyncObject.self];
-    RLMRealm *userARealm = [self asyncOpenRealmWithConfiguration:userAConfig];
-    [self addSyncObjectsToRealm:userARealm descriptions:@[@"child-1", @"child-2", @"child-3"]];
-    [self waitForUploadsForRealm:userARealm];
-    CHECK_COUNT(3, SyncObject, userARealm);
-
-    // Give user B read-only permissions to that Realm so that it can't add new object types
-    RLMSyncPermission *p = [[RLMSyncPermission alloc] initWithRealmPath:[userAURL path]
-                                                               identity:self.userB.identity
-                                                            accessLevel:RLMSyncAccessLevelRead];
-    APPLY_PERMISSION(p, self.userA);
-
-    // Open the same Realm s user B without limiting the set of object classes
-    NSURL *userBURL = makeTestURL(testName, self.userA);
-    RLMRealmConfiguration *userBConfig = [self.userB configurationWithURL:userBURL fullSynchronization:YES];
-    userBConfig.readOnly = YES;
-    RLMRealm *userBRealm = [self asyncOpenRealmWithConfiguration:userBConfig];
-    CHECK_COUNT(3, SyncObject, userBRealm);
-
-    // Verify that syncing is actually working and new objects written by A show up in B's Realm
-    [self addSyncObjectsToRealm:userARealm descriptions:@[@"child-4"]];
-    CHECK_COUNT_PENDING_DOWNLOAD(4, SyncObject, userBRealm);
-}
-
-#pragma mark - Permission change API
-
-/// Setting a permission should work, and then that permission should be able to be retrieved.
-- (void)testSettingPermission {
-    // First, there should be no permissions.
-    NSArray<RLMSyncPermission *> *results = [self getPermissionResultsFor:self.userA];
-    CHECK_PERMISSION_COUNT(results, 0);
-
-    // Open a Realm for user A.
-    NSURL *url = REALM_URL();
-    [self openRealmForURL:url user:self.userA];
-
-    // Give user B read permissions to that Realm.
-    RLMSyncPermission *p = [[RLMSyncPermission alloc] initWithRealmPath:[makeTildeSubstitutedURL(url, self.userA) path]
-                                                               identity:self.userB.identity
-                                                            accessLevel:RLMSyncAccessLevelRead];
-
-    // Set the permission.
-    APPLY_PERMISSION(p, self.userA);
-    
-    // Now retrieve the permissions again and make sure the new permission is properly set.
-    results = [self getPermissionResultsFor:self.userB message:@"One permission after setting the permission."];
-
-    // Expected permission: applies to user B, but for user A's Realm.
-    CHECK_PERMISSION_PRESENT(results, p, self.userA);
-
-    // Check getting permission by its index.
-    NSUInteger index = [results indexOfObject:p];
-    XCTAssertNotEqual(index, NSNotFound);
-    XCTAssertEqualObjects(p, [results objectAtIndex:index]);
-}
-
-/// Deleting a permission should work.
-- (void)testDeletingPermission {
-    // Open a Realm for user A.
-    NSURL *url = REALM_URL();
-    [self openRealmForURL:url user:self.userA];
-
-    // Give user B read permissions to that Realm.
-    RLMSyncPermission *p = [[RLMSyncPermission alloc] initWithRealmPath:[makeTildeSubstitutedURL(url, self.userA) path]
-                                                               identity:self.userB.identity
-                                                            accessLevel:RLMSyncAccessLevelRead];
-
-    // Set the permission.
-    APPLY_PERMISSION(p, self.userA);
-
-    // Now retrieve the permissions again and make sure the new permission is properly set.
-    NSArray<RLMSyncPermission *> *results = [self getPermissionResultsFor:self.userB
-                                                                  message:@"Setting new permission."];
-    CHECK_PERMISSION_PRESENT(results, p, self.userA);
-
-    // Delete the permission.
-    RLMSyncPermission *p2 = [[RLMSyncPermission alloc] initWithRealmPath:url.path
-                                                                identity:self.userB.identity
-                                                             accessLevel:RLMSyncAccessLevelNone];
-    REVOKE_PERMISSION(p2, self.userA);
-
-    // Make sure the permission deletion is properly reflected.
-    results = [self getPermissionResultsFor:self.userB message:@"Setting new permission."];
-    CHECK_PERMISSION_COUNT(results, 0);
-}
-
-/// KVC getting and setting should work properly for `NSArray<RLMSyncPermission>`.
-- (void)testKVCWithPermissionsResults {
-    NSURL *url1 = CUSTOM_REALM_URL(@"r1");
-    NSURL *url2 = CUSTOM_REALM_URL(@"r2");
-    __attribute__((objc_precise_lifetime)) RLMRealm *r1 = [self openRealmForURL:url1 user:self.userA];
-    __attribute__((objc_precise_lifetime)) RLMRealm *r2 = [self openRealmForURL:url2 user:self.userA];
-    NSString *uB = self.userB.identity;
-
-    // Give user B read permissions to r1 and r2.
-    NSString *path1 = [makeTildeSubstitutedURL(url1, self.userA) path];
-    id p1 = [[RLMSyncPermission alloc] initWithRealmPath:path1
-                                                identity:uB
-                                             accessLevel:RLMSyncAccessLevelRead];
-    APPLY_PERMISSION_WITH_MESSAGE(p1, self.userA, self.userA, @"Setting r1 permission for user B should work.");
-    NSString *path2 = [makeTildeSubstitutedURL(url2, self.userA) path];
-    id p2 = [[RLMSyncPermission alloc] initWithRealmPath:path2
-                                                identity:uB
-                                             accessLevel:RLMSyncAccessLevelRead];
-    APPLY_PERMISSION_WITH_MESSAGE(p2, self.userA, self.userA, @"Setting r2 permission for user B should work.");
-
-    // Wait for all the permissions to show up.
-    NSArray<RLMSyncPermission *> *results = [self getPermissionResultsFor:self.userB];
-    CHECK_PERMISSION_PRESENT(results, p1, self.userA);
-    CHECK_PERMISSION_PRESENT(results, p2, self.userA);
-
-    // Now use `valueForKey`
-    NSArray *selfValues = [results valueForKey:@"self"];
-    XCTAssert(selfValues.count == results.count);
-    for (id object in selfValues) {
-        XCTAssert([object isKindOfClass:[RLMSyncPermission class]]);
-    }
-
-    NSArray *identityValues = [results valueForKey:@"path"];
-    XCTAssert(identityValues.count == results.count);
-    XCTAssert([identityValues containsObject:path1]);
-    XCTAssert([identityValues containsObject:path2]);
-
-    // Since `RLMSyncPermission`s are read-only, KVC setting should fail.
-    RLMAssertThrows([results setValue:@"foobar" forKey:@"path"]);
-}
-
-/// Filtering permissions results should work.
-- (void)testFilteringPermissions {
-    // Open two Realms
-    NSURL *url1 = CUSTOM_REALM_URL(@"r1");
-    NSURL *url2 = CUSTOM_REALM_URL(@"r2");
-    NSURL *url3 = CUSTOM_REALM_URL(@"r3");
-    __attribute__((objc_precise_lifetime)) RLMRealm *r1 = [self openRealmForURL:url1 user:self.userA];
-    __attribute__((objc_precise_lifetime)) RLMRealm *r2 = [self openRealmForURL:url2 user:self.userA];
-    __attribute__((objc_precise_lifetime)) RLMRealm *r3 = [self openRealmForURL:url3 user:self.userA];
-    NSString *uB = self.userB.identity;
-
-    // Give user B permissions to realms r1, r2, and r3.
-    id p1 = [[RLMSyncPermission alloc] initWithRealmPath:url1.path
-                                                identity:uB
-                                             accessLevel:RLMSyncAccessLevelRead];
-    APPLY_PERMISSION_WITH_MESSAGE(p1, self.userA, self.userA, @"Setting r1 permission for user B should work.");
-    NSString *finalPath = [makeTildeSubstitutedURL(url2, self.userA) path];
-    id p2 = [[RLMSyncPermission alloc] initWithRealmPath:finalPath
-                                                identity:uB
-                                             accessLevel:RLMSyncAccessLevelRead];
-    APPLY_PERMISSION_WITH_MESSAGE(p2, self.userA, self.userA, @"Setting r2 permission for user B should work.");
-    id p3 = [[RLMSyncPermission alloc] initWithRealmPath:url3.path
-                                                identity:uB
-                                             accessLevel:RLMSyncAccessLevelRead];
-    APPLY_PERMISSION_WITH_MESSAGE(p3, self.userA, self.userA, @"Setting r3 permission for user B should work.");
-
-    // Wait for all the permissions to show up.
-    NSArray<RLMSyncPermission *> *results = [self getPermissionResultsFor:self.userB];
-    CHECK_PERMISSION_PRESENT(results, p1, self.userA);
-    CHECK_PERMISSION_PRESENT(results, p2, self.userA);
-    CHECK_PERMISSION_PRESENT(results, p3, self.userA);
-
-    // Now make a filter.
-    NSArray<RLMSyncPermission *> *filtered = [results filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"path == %@", finalPath]];
-    CHECK_PERMISSION_ABSENT(filtered, p1, self.userA);
-    CHECK_PERMISSION_PRESENT(filtered, p2, self.userA);
-    CHECK_PERMISSION_ABSENT(filtered, p3, self.userA);
-}
-
-- (void)testSortingPermissionsOnUserID {
-    NSURL *url = REALM_URL();
-    __attribute__((objc_precise_lifetime)) RLMRealm *r = [self openRealmForURL:url user:self.userA];
-
-    // Give users B and C access to my Realm.
-    id p1 = [[RLMSyncPermission alloc] initWithRealmPath:[makeTildeSubstitutedURL(url, self.userA) path]
-                                                identity:self.userB.identity
-                                             accessLevel:RLMSyncAccessLevelRead];
-    APPLY_PERMISSION_WITH_MESSAGE(p1, self.userA, self.userA, @"Setting r permission for user B should work.");
-    id p2 = [[RLMSyncPermission alloc] initWithRealmPath:[makeTildeSubstitutedURL(url, self.userA) path]
-                                                identity:self.userC.identity
-                                             accessLevel:RLMSyncAccessLevelRead];
-    APPLY_PERMISSION_WITH_MESSAGE(p2, self.userA, self.userA, @"Setting r permission for user C should work.");
-
-    // Now sort on user ID.
-    NSArray<RLMSyncPermission *> *results = [self getPermissionResultsFor:self.userA];
-    NSArray<RLMSyncPermission *> *sorted = [results sortedArrayUsingDescriptors:@[[NSSortDescriptor sortDescriptorWithKey:@"identity" ascending:YES]]];
-    CHECK_PERMISSION_COUNT(sorted, 3);
-    NSArray *sortedIDs = [sorted valueForKey:@"identity"];
-    // Make sure the IDs in sortedIDs are actually sorted.
-    for (NSUInteger i = 0; i < sorted.count - 1; i++) {
-        XCTAssertEqual([sortedIDs[i] compare:sortedIDs[i + 1]], NSOrderedAscending);
-    }
-    // Make sure the IDs in sortedIDs contain all 3 users' IDs.
-    NSSet *sortedIDSet = [NSSet setWithArray:sortedIDs];
-    XCTAssertTrue([sortedIDSet containsObject:self.userA.identity]);
-    XCTAssertTrue([sortedIDSet containsObject:self.userB.identity]);
-    XCTAssertTrue([sortedIDSet containsObject:self.userC.identity]);
-}
-
-- (void)testPermissionResultsIndexOfObject {
-    NSString *uB = self.userB.identity;
-
-    // Have A open a Realm and grant a permission to B.
-    NSURL *url = REALM_URL();
-    NSString *tildeSubstitutedPath = [makeTildeSubstitutedURL(url, self.userA) path];
-    __attribute__((objc_precise_lifetime)) RLMRealm *r = [self openRealmForURL:url user:self.userA];
-    id p1 = [[RLMSyncPermission alloc] initWithRealmPath:tildeSubstitutedPath
-                                                identity:uB
-                                             accessLevel:RLMSyncAccessLevelRead];
-    APPLY_PERMISSION_WITH_MESSAGE(p1, self.userA, self.userA,
-                                  @"Setting read permission for user B should work.");
-
-    // Wait for the permission to show up.
-    NSArray<RLMSyncPermission *> *results = [self getPermissionResultsFor:self.userB];
-    CHECK_PERMISSION_COUNT(results, 1);
-    // Should be able to get the permission based on the actual permission.
-    XCTAssertEqual(((NSInteger)[results indexOfObject:p1]), 0);
-
-    // A permission with a differing access level should not match.
-    id p2 = [[RLMSyncPermission alloc] initWithRealmPath:tildeSubstitutedPath
-                                                identity:uB
-                                             accessLevel:RLMSyncAccessLevelAdmin];
-    XCTAssertEqual([results indexOfObject:p2], NSNotFound);
-
-    // A permission with a differing identity should not match.
-    id p3 = [[RLMSyncPermission alloc] initWithRealmPath:tildeSubstitutedPath
-                                                identity:self.userA.identity
-                                             accessLevel:RLMSyncAccessLevelRead];
-    XCTAssertEqual([results indexOfObject:p3], NSNotFound);
-
-    // A permission with a differing path should not match.
-    id p4 = [[RLMSyncPermission alloc] initWithRealmPath:[makeTildeSubstitutedURL(url, self.userB) path]
-                                                identity:uB
-                                             accessLevel:RLMSyncAccessLevelRead];
-    XCTAssertEqual([results indexOfObject:p4], NSNotFound);
-}
-
-/// User should not be able to change a permission for a Realm they don't own.
-- (void)testSettingUnownedRealmPermission {
-    // Open a Realm for user A.
-    NSURL *url = REALM_URL();
-    [self openRealmForURL:url user:self.userA];
-
-    // Try to have user B give user C permissions to that Realm.
-    RLMSyncPermission *p = [[RLMSyncPermission alloc] initWithRealmPath:[makeTildeSubstitutedURL(url, self.userA) path]
-                                                               identity:self.userC.identity
-                                                            accessLevel:RLMSyncAccessLevelRead];
-
-    // Set the permission.
-    XCTestExpectation *ex2 = [self expectationWithDescription:@"Setting an invalid permission should fail."];
-    [self.userB applyPermission:p callback:^(NSError *error) {
-        XCTAssertNotNil(error);
-        XCTAssertEqual(error.domain, RLMSyncAuthErrorDomain);
-        XCTAssertEqual(error.code, RLMSyncAuthErrorAccessDeniedOrInvalidPath);
-        [ex2 fulfill];
-    }];
-    [self waitForExpectationsWithTimeout:2.0 handler:nil];
-
-    // Now retrieve the permissions again and make sure the new permission was not set.
-    NSArray<RLMSyncPermission *> *results = [self getPermissionResultsFor:self.userB
-                                                                  message:@"Retrieving the results should work."];
-    CHECK_PERMISSION_ABSENT(results, p, self.userA);
-}
-
-#pragma mark - Permission offer/response
-
-- (NSString *)createOfferForRealmAtURL:(NSURL *)url
-                                  user:(RLMSyncUser *)user
-                           accessLevel:(RLMSyncAccessLevel)level
-                            expiration:(NSDate *)expiration {
-    __block NSString *token;
-    XCTestExpectation *ex = [self expectationWithDescription:@"Should get a token when making an offer."];
-    [user createOfferForRealmAtURL:url
-                       accessLevel:level
-                        expiration:expiration
-                          callback:^(NSString *t, NSError *error) {
-        XCTAssertNil(error);
-        token = t;
-        XCTAssertNotNil(token);
-        XCTAssertGreaterThan(token.length, 0);
-        [ex fulfill];
-    }];
-    [self waitForExpectations:@[ex] timeout:10.0];
-    return token;
-}
-
-/// Get a token which can be used to offer the permissions as defined
-- (void)testPermissionOffer {
-    NSURL *url = REALM_URL();
-    [self openRealmForURL:url user:self.userA];
-    [self createOfferForRealmAtURL:url user:self.userA accessLevel:RLMSyncAccessLevelWrite expiration:nil];
-}
-
-/// Failed to process a permission offer object due to the offer expired
-- (void)testPermissionOfferIsExpired {
-    NSURL *url = REALM_URL();
-    // Create the Realm
-    [self openRealmForURL:url user:self.userA];
-
-    XCTestExpectation *ex = [self expectationWithDescription:@"Server should process the permission offer."];
-    [self.userA createOfferForRealmAtURL:url
-                             accessLevel:RLMSyncAccessLevelWrite
-                              expiration:[NSDate dateWithTimeIntervalSinceNow:-30 * 24 * 60 * 60]
-                                callback:^(NSString *token, NSError *error) {
-        XCTAssertNotNil(error);
-        XCTAssertNil(token);
-        XCTAssertEqual(error.code, RLMSyncAuthErrorExpiredPermissionOffer);
-        XCTAssertEqualObjects(error.userInfo[NSLocalizedDescriptionKey], @"The permission offer is expired.");
-        [ex fulfill];
-    }];
-    [self waitForExpectations:@[ex] timeout:10.0];
-}
-
-/// Get a permission offer token, then permission offer response will be processed, then open another user's Realm file
-- (void)testPermissionOfferResponse {
-    NSURL *url = REALM_URL();
-    // Create the Realm
-    [self openRealmForURL:url user:self.userA];
-
-    NSString *token = [self createOfferForRealmAtURL:url user:self.userA
-                                         accessLevel:RLMSyncAccessLevelWrite expiration:nil];
-
-    // Accept the offer.
-    __block NSURL *realmURL = nil;
-    XCTestExpectation *ex = [self expectationWithDescription:@"Server should process offer acceptance."];
-    [self.userB acceptOfferForToken:token callback:^(NSURL *returnedURL, NSError *error) {
-        XCTAssertNil(error);
-        XCTAssertNotNil(returnedURL);
-        realmURL = returnedURL;
-        [ex fulfill];
-    }];
-    [self waitForExpectations:@[ex] timeout:20.0];
-    XCTAssertEqualObjects([realmURL path], [makeTildeSubstitutedURL(url, self.userA) path]);
-
-    // Open the Realm.
-    XCTAssertNotNil([self openRealmForURL:realmURL user:self.userB]);
-}
-
-/// Failed to process a permission offer response object due to `token` is invalid
-- (void)testPermissionOfferResponseInvalidToken {
-    NSString *badToken = @"invalid token";
-
-    // Expect an error.
-    __block NSError *error = nil;
-    XCTestExpectation *ex = [self expectationWithDescription:@"Server should process offer acceptance."];
-    [self.userA acceptOfferForToken:badToken callback:^(NSURL *returnedURL, NSError *err) {
-        XCTAssertNil(returnedURL);
-        XCTAssertNotNil(err);
-        error = err;
-        [ex fulfill];
-    }];
-    [self waitForExpectations:@[ex] timeout:20.0];
-    XCTAssertEqual(error.code, RLMSyncAuthErrorInvalidParameters);
-    XCTAssertEqualObjects(error.userInfo[NSLocalizedDescriptionKey],
-                          @"Your request parameters did not validate. token: Invalid parameter 'token'!;");
-}
-
-/// Failed to process a permission offer response object due to `token` represents a Realm that does not exist
-- (void)testPermissionOfferResponseTokenNotExist {
-    NSString *fakeToken = @"00000000000000000000000000000000:00000000-0000-0000-0000-000000000000";
-
-    // Expect an error.
-    __block NSError *error = nil;
-    XCTestExpectation *ex = [self expectationWithDescription:@"Server should process offer acceptance."];
-    [self.userA acceptOfferForToken:fakeToken callback:^(NSURL *returnedURL, NSError *err) {
-        XCTAssertNil(returnedURL);
-        XCTAssertNotNil(err);
-        error = err;
-        [ex fulfill];
-    }];
-    [self waitForExpectations:@[ex] timeout:20.0];
-    XCTAssertEqual(error.code, RLMSyncAuthErrorInvalidParameters);
-    XCTAssertEqualObjects(error.userInfo[NSLocalizedDescriptionKey],
-                          @"Your request parameters did not validate. token: Invalid parameter 'token'!;");
-}
-
-- (void)testInvalidatePermissionOffer {
-    NSURL *url = REALM_URL();
-    // Create the Realm
-    [self openRealmForURL:url user:self.userA];
-
-    // Create an offer
-    NSString *token = [self createOfferForRealmAtURL:url user:self.userA
-                                         accessLevel:RLMSyncAccessLevelWrite expiration:nil];
-
-    // Invalidate it
-    XCTestExpectation *ex2 = [self expectationWithDescription:@"Should invalidate a offer token."];
-    [self.userA invalidateOfferForToken:token callback:^(NSError *error) {
-        XCTAssertNil(error);
-        [ex2 fulfill];
-    }];
-    [self waitForExpectations:@[ex2] timeout:10.0];
-
-    // Fail to accept the offer
-    XCTestExpectation *ex3 = [self expectationWithDescription:@"Server should reject invalidated offer"];
-    [self.userB acceptOfferForToken:token callback:^(NSURL *returnedURL, NSError *error) {
-        XCTAssertNil(returnedURL);
-        XCTAssertNotNil(error);
-        XCTAssertEqual(error.code, RLMSyncAuthErrorExpiredPermissionOffer);
-        XCTAssertEqualObjects(error.userInfo[NSLocalizedDescriptionKey], @"The permission offer is expired.");
-        [ex3 fulfill];
-    }];
-    [self waitForExpectations:@[ex3] timeout:20.0];
-}
-
-- (void)testRetrievePermissionOffers {
-    NSURL *url = REALM_URL();
-    NSURL *expandedURL = makeTildeSubstitutedURL(url, self.userA);
-    // Create the Realm
-    [self openRealmForURL:url user:self.userA];
-
-    NSDate *createdAt = [NSDate date];
-    NSDate *expiresAt = [NSDate dateWithTimeIntervalSinceNow:100.0];
-    // Create two offers
-    NSString *token1 = [self createOfferForRealmAtURL:url user:self.userA
-                                          accessLevel:RLMSyncAccessLevelRead expiration:expiresAt];
-    NSString *token2 = [self createOfferForRealmAtURL:url user:self.userA
-                                          accessLevel:RLMSyncAccessLevelWrite expiration:nil];
-
-    id ex1 = [self expectationWithDescription:@"Retrieve offers"];
-    [self.userA retrievePermissionOffersWithCallback:^(NSArray<RLMSyncPermissionOffer *> *offers, NSError *error) {
-        XCTAssertNil(error);
-        XCTAssertEqual(offers.count, 2U);
-        for (RLMSyncPermissionOffer *offer in offers) {
-            bool isFirst = [offer.token isEqualToString:token1];
-            XCTAssertEqualObjects(offer.realmPath, expandedURL.path);
-            XCTAssertGreaterThan(offer.createdAt.timeIntervalSince1970, createdAt.timeIntervalSince1970);
-            if (isFirst) {
-                XCTAssertEqualObjects(offer.token, token1);
-                // May be up to a half ms off due to rounding
-                XCTAssertLessThan(fabs([offer.expiresAt timeIntervalSinceDate:expiresAt]), 0.001);
-                XCTAssertEqual(offer.accessLevel, RLMSyncAccessLevelRead);
-            }
-            else {
-                XCTAssertEqualObjects(offer.token, token2);
-                XCTAssertNil(offer.expiresAt);
-                XCTAssertEqual(offer.accessLevel, RLMSyncAccessLevelWrite);
-            }
-        }
-        [ex1 fulfill];
-    }];
-    [self waitForExpectations:@[ex1] timeout:10.0];
-
-    // Invalidate one of the offers
-    XCTestExpectation *ex2 = [self expectationWithDescription:@"Should invalidate a offer token."];
-    [self.userA invalidateOfferForToken:token1 callback:^(NSError *error) {
-        XCTAssertNil(error);
-        [ex2 fulfill];
-    }];
-    [self waitForExpectations:@[ex2] timeout:10.0];
-
-    // Verify that we only get non-invalidated offers
-    id ex3 = [self expectationWithDescription:@"Retrieve offers"];
-    [self.userA retrievePermissionOffersWithCallback:^(NSArray<RLMSyncPermissionOffer *> *offers, NSError *error) {
-        XCTAssertNil(error);
-        XCTAssertEqual(offers.count, 1U);
-        RLMSyncPermissionOffer *offer = offers[0];
-        XCTAssertEqualObjects(offer.realmPath, expandedURL.path);
-        XCTAssertGreaterThan(offer.createdAt.timeIntervalSince1970, createdAt.timeIntervalSince1970);
-        XCTAssertEqualObjects(offer.token, token2);
-        XCTAssertNil(offer.expiresAt);
-        XCTAssertEqual(offer.accessLevel, RLMSyncAccessLevelWrite);
-        [ex3 fulfill];
-    }];
-    [self waitForExpectations:@[ex3] timeout:10.0];
-}
-
-#pragma mark - Delete Realm upon permission denied
-
-/// A Realm which is opened improperly should report an error allowing the app to recover.
-- (void)testDeleteRealmUponPermissionDenied {
-    NSString *testName = NSStringFromSelector(_cmd);
-    // Open a Realm for user A.
-    NSURL *userAURL = makeTestURL(testName, nil);
-    RLMRealm *userARealm = [self openRealmForURL:userAURL user:self.userA];
-
-    // Have user A add some items to the Realm.
-    [self addSyncObjectsToRealm:userARealm descriptions:@[@"child-1", @"child-2", @"child-3"]];
-    [self waitForUploadsForRealm:userARealm];
-    CHECK_COUNT(3, SyncObject, userARealm);
-
-    // Give user B read permissions to that Realm.
-    RLMSyncPermission *p = [[RLMSyncPermission alloc] initWithRealmPath:[userAURL path]
-                                                               identity:self.userB.identity
-                                                            accessLevel:RLMSyncAccessLevelRead];
-    // Set the read permission.
-    APPLY_PERMISSION(p, self.userA);
-
-    NSURL *userBURL = makeTestURL(testName, self.userA);
-    RLMRealmConfiguration *userBConfig = [self.userB configurationWithURL:userBURL fullSynchronization:YES];
-    __block NSError *theError = nil;
-
-    // Incorrectly open the Realm for user B.
-    NSURL *onDiskPath;
-    @autoreleasepool {
-        NSString *sessionName = NSStringFromSelector(_cmd);
-        XCTestExpectation *ex2 = [self expectationWithDescription:@"We should get a permission denied error."];
-        RLMSyncManager.sharedManager.errorHandler = ^(NSError *err, RLMSyncSession *session) {
-            // Make sure we're actually looking at the right session.
-            XCTAssertTrue([[session.realmURL absoluteString] rangeOfString:sessionName].location != NSNotFound);
-            theError = err;
-            [ex2 fulfill];
-        };
-        __attribute__((objc_precise_lifetime)) RLMRealm *bad = [RLMRealm realmWithConfiguration:userBConfig error:nil];
-        [self waitForExpectationsWithTimeout:10.0 handler:nil];
-        onDiskPath = [RLMSyncTestCase onDiskPathForSyncedRealm:bad];
-    }
-    XCTAssertNotNil(onDiskPath);
-    XCTAssertTrue([[NSFileManager defaultManager] fileExistsAtPath:[onDiskPath path]]);
-
-    // Check the error and perform the Realm deletion.
-    XCTAssertNotNil(theError);
-    RLMSyncErrorActionToken *errorToken = [theError rlmSync_errorActionToken];
-    XCTAssertNotNil(errorToken);
-    [RLMSyncSession immediatelyHandleError:errorToken];
-
-    // Ensure the file is no longer on disk.
-    XCTAssertFalse([[NSFileManager defaultManager] fileExistsAtPath:[onDiskPath path]]);
-
-    // Correctly open the same Realm for user B.
-    __block RLMRealm *userBRealm = nil;
-    XCTestExpectation *asyncOpenEx = [self expectationWithDescription:@"Should asynchronously open a Realm"];
-    [RLMRealm asyncOpenWithConfiguration:userBConfig
-                           callbackQueue:dispatch_get_main_queue()
-                                callback:^(RLMRealm *realm, NSError *err){
-                                    XCTAssertNil(err);
-                                    XCTAssertNotNil(realm);
-                                    userBRealm = realm;
-                                    [asyncOpenEx fulfill];
-                                }];
-    [self waitForExpectationsWithTimeout:10.0 handler:nil];
-    CHECK_COUNT(3, SyncObject, userBRealm);
-}
-
-@end

+ 0 - 618
Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/RLMPermissionsTests.mm

@@ -1,618 +0,0 @@
-////////////////////////////////////////////////////////////////////////////
-//
-// Copyright 2018 Realm Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////
-
-#import <XCTest/XCTest.h>
-
-#import "RLMSyncTestCase.h"
-
-#import "RLMTestUtils.h"
-
-#define APPLY_PERMISSION(ma_permission, ma_user) do { \
-    XCTestExpectation *ex = [self expectationWithDescription:@"apply permission"]; \
-    [ma_user applyPermission:ma_permission callback:^(NSError *err) {              \
-        XCTAssertNil(err, @"Received an error when applying permission: %@", err); \
-        [ex fulfill];                                                              \
-    }];                                                                            \
-    [self waitForExpectationsWithTimeout:10.0 handler:nil];                        \
-} while (0)                                                                        \
-
-@interface ObjectWithPermissions : RLMObject
-@property (nonatomic) int value;
-@property (nonatomic) RLMArray<RLMPermission *><RLMPermission> *permissions;
-@end
-@implementation ObjectWithPermissions
-@end
-
-@interface LinkToObjectWithPermissions : RLMObject
-@property (nonatomic) int value;
-@property (nonatomic) ObjectWithPermissions *link;
-@property (nonatomic) RLMArray<RLMPermission *><RLMPermission> *permissions;
-@end
-@implementation LinkToObjectWithPermissions
-@end
-
-@interface RLMPermissionsTests : RLMSyncTestCase
-@property (nonatomic, strong) RLMSyncUser *userA;
-@property (nonatomic, strong) RLMSyncUser *userB;
-@property (nonatomic, strong) RLMSyncUser *userC;
-
-@property (nonatomic, strong) void (^errorBlock)(NSError *);
-@end
-
-@implementation RLMPermissionsTests
-
-- (void)setUp {
-    [super setUp];
-    NSString *accountNameBase = [[NSUUID UUID] UUIDString];
-    NSString *userNameA = [accountNameBase stringByAppendingString:@"a"];
-    self.userA = [self logInUserForCredentials:[RLMSyncTestCase basicCredentialsWithName:userNameA register:YES]
-                                        server:[RLMSyncTestCase authServerURL]];
-
-    NSString *userNameB = [accountNameBase stringByAppendingString:@"b"];
-    self.userB = [self logInUserForCredentials:[RLMSyncTestCase basicCredentialsWithName:userNameB register:YES]
-                                        server:[RLMSyncTestCase authServerURL]];
-
-    NSString *userNameC = [accountNameBase stringByAppendingString:@"c"];
-    self.userC = [self logInUserForCredentials:[RLMSyncTestCase basicCredentialsWithName:userNameC register:YES]
-                                        server:[RLMSyncTestCase authServerURL]];
-
-    RLMSyncManager.sharedManager.errorHandler = ^(NSError *error, __unused RLMSyncSession *session) {
-        if (self.errorBlock) {
-            self.errorBlock(error);
-            self.errorBlock = nil;
-        } else {
-            XCTFail(@"Error handler should not be called unless explicitly expected. Error: %@", error);
-        }
-    };
-}
-
-- (void)tearDown {
-    [self.userA logOut];
-    [self.userB logOut];
-    [self.userC logOut];
-    RLMSyncManager.sharedManager.errorHandler = nil;
-    [super tearDown];
-}
-
-#pragma mark - Helper methods
-
-- (BOOL)isPartial {
-    return YES;
-}
-
-- (NSError *)subscribeToRealm:(RLMRealm *)realm type:(Class)cls where:(NSString *)pred {
-    RLMSyncSubscription *sub = [[cls objectsInRealm:realm where:pred] subscribe];
-    id ex = [[XCTKVOExpectation alloc] initWithKeyPath:@"state" object:sub expectedValue:@(RLMSyncSubscriptionStateComplete)];
-    [self waitForExpectations:@[ex] timeout:20.0];
-    return sub.error;
-}
-
-- (NSURL *)createRealmWithName:(SEL)sel permissions:(void (^)(RLMRealm *realm))block {
-    // Create a new Realm with an admin user
-    RLMSyncUser *admin = [self createAdminUserForURL:[RLMSyncTestCase authServerURL]
-                                            username:[[NSUUID UUID] UUIDString]];
-
-    auto url = [[NSURL alloc] initWithString:[NSString stringWithFormat:@"realm://127.0.0.1:9080/%@", NSStringFromSelector(sel)]];
-    RLMRealm *adminRealm = [self openRealmForURL:url user:admin];
-    [self addSyncObjectsToRealm:adminRealm descriptions:@[@"child-1", @"child-2", @"child-3"]];
-    CHECK_COUNT(3, SyncObject, adminRealm);
-    [self waitForUploadsForRealm:adminRealm error:nil];
-    [self waitForDownloadsForRealm:adminRealm error:nil];
-
-    // FIXME: we currently need to add a subscription to get the permissions types sent to us
-    [adminRealm refresh];
-    CHECK_COUNT(0, SyncObject, adminRealm);
-    [self subscribeToRealm:adminRealm type:[SyncObject class] where:@"TRUEPREDICATE"];
-    CHECK_COUNT(3, SyncObject, adminRealm);
-
-    // Set up permissions on the Realm
-    [adminRealm transactionWithBlock:^{ block(adminRealm); }];
-
-    // FIXME: we currently need to also add the old realm-level permissions
-    RLMSyncPermission *p = [[RLMSyncPermission alloc] initWithRealmPath:[url path]
-                                                               identity:self.userA.identity
-                                                            accessLevel:RLMSyncAccessLevelRead];
-    APPLY_PERMISSION(p, admin);
-    p = [[RLMSyncPermission alloc] initWithRealmPath:[url path] identity:self.userB.identity
-                                         accessLevel:RLMSyncAccessLevelRead];
-    APPLY_PERMISSION(p, admin);
-    p = [[RLMSyncPermission alloc] initWithRealmPath:[url path] identity:self.userC.identity
-                                         accessLevel:RLMSyncAccessLevelRead];
-    APPLY_PERMISSION(p, admin);
-    [self waitForSync:adminRealm];
-
-    return url;
-}
-
-- (void)waitForSync:(RLMRealm *)realm {
-    [self waitForUploadsForRealm:realm error:nil];
-    [self waitForDownloadsForRealm:realm error:nil];
-    [realm refresh];
-}
-
-#pragma mark - Permissions
-
-static RLMPermissionRole *getRole(RLMRealm *realm, NSString *roleName) {
-    return [RLMPermissionRole createOrUpdateInRealm:realm withValue:@{@"name": roleName}];
-}
-
-static void addUserToRole(RLMRealm *realm, NSString *roleName, NSString *user) {
-    [getRole(realm, roleName).users addObject:[RLMPermissionUser userInRealm:realm withIdentity:user]];
-}
-
-static void createPermissions(RLMArray<RLMPermission> *permissions) {
-    auto permission = [RLMPermission permissionForRoleNamed:@"everyone" inArray:permissions];
-    permission.canCreate = false;
-    permission.canRead = false;
-    permission.canQuery = false;
-    permission.canDelete = false;
-    permission.canUpdate = false;
-    permission.canModifySchema = false;
-    permission.canSetPermissions = false;
-
-    permission = [RLMPermission permissionForRoleNamed:@"reader" inArray:permissions];
-    permission.canRead = true;
-    permission.canQuery = true;
-
-    permission = [RLMPermission permissionForRoleNamed:@"writer" inArray:permissions];
-    permission.canUpdate = true;
-    permission.canCreate = true;
-    permission.canDelete = true;
-
-    permission = [RLMPermission permissionForRoleNamed:@"admin" inArray:permissions];
-    permission.canSetPermissions = true;
-}
-
-#define CHECK_REALM_PRIVILEGE(realm, ...) do { \
-    RLMRealmPrivileges expected{__VA_ARGS__}; \
-    auto actual = [realm privilegesForRealm]; \
-    XCTAssertEqual(expected.read, actual.read); \
-    XCTAssertEqual(expected.update, actual.update); \
-    XCTAssertEqual(expected.setPermissions, actual.setPermissions); \
-    XCTAssertEqual(expected.modifySchema, actual.modifySchema); \
-} while (0)
-
-#define CHECK_CLASS_PRIVILEGE(realm, ...) do { \
-    RLMClassPrivileges expected{__VA_ARGS__}; \
-    auto actual = [realm privilegesForClass:SyncObject.class]; \
-    XCTAssertEqual(expected.read, actual.read); \
-    XCTAssertEqual(expected.create, actual.create); \
-    XCTAssertEqual(expected.update, actual.update); \
-    XCTAssertEqual(expected.subscribe, actual.subscribe); \
-    XCTAssertEqual(expected.setPermissions, actual.setPermissions); \
-} while (0)
-
-#define CHECK_OBJECT_PRIVILEGE(realm, ...) do { \
-    RLMObjectPrivileges expected{__VA_ARGS__}; \
-    auto actual = [realm privilegesForObject:[SyncObject allObjectsInRealm:realm].firstObject]; \
-    XCTAssertEqual(expected.read, actual.read); \
-    XCTAssertEqual(expected.del, actual.del); \
-    XCTAssertEqual(expected.update, actual.update); \
-    XCTAssertEqual(expected.setPermissions, actual.setPermissions); \
-} while (0)
-
-- (void)testRealmReadAccess {
-    NSURL *url = [self createRealmWithName:_cmd permissions:^(RLMRealm *realm) {
-        createPermissions([RLMRealmPermission objectInRealm:realm].permissions);
-        addUserToRole(realm, @"reader", self.userA.identity);
-    }];
-
-    // userA should now be able to open the Realm and see objects
-    RLMRealm *userARealm = [self openRealmForURL:url user:self.userA];
-    [self subscribeToRealm:userARealm type:[SyncObject class] where:@"TRUEPREDICATE"];
-    CHECK_REALM_PRIVILEGE(userARealm, .read = true);
-    CHECK_CLASS_PRIVILEGE(userARealm, .read = true, .subscribe = true);
-    CHECK_OBJECT_PRIVILEGE(userARealm, .read = true);
-
-    // userA should not be able to create new objects
-    CHECK_COUNT(3, SyncObject, userARealm);
-    [self addSyncObjectsToRealm:userARealm descriptions:@[@"child-4", @"child-5", @"child-6"]];
-    CHECK_COUNT(6, SyncObject, userARealm);
-    [self waitForSync:userARealm];
-    CHECK_COUNT(3, SyncObject, userARealm);
-
-    // userB should not be able to read any objects
-    RLMRealm *userBRealm = [self openRealmForURL:url user:self.userB];
-    [self subscribeToRealm:userBRealm type:[SyncObject class] where:@"TRUEPREDICATE"];
-    CHECK_REALM_PRIVILEGE(userBRealm, .read = false);
-    CHECK_CLASS_PRIVILEGE(userBRealm, .read = false);
-    CHECK_COUNT(0, SyncObject, userBRealm);
-}
-
-- (void)testRealmWriteAccess {
-    NSURL *url = [self createRealmWithName:_cmd permissions:^(RLMRealm *realm) {
-        createPermissions([RLMRealmPermission objectInRealm:realm].permissions);
-
-        addUserToRole(realm, @"reader", self.userA.identity);
-        addUserToRole(realm, @"writer", self.userA.identity);
-
-        addUserToRole(realm, @"reader", self.userB.identity);
-    }];
-
-    // userA should be able to add objects
-    RLMRealm *userARealm = [self openRealmForURL:url user:self.userA];
-    [self subscribeToRealm:userARealm type:[SyncObject class] where:@"TRUEPREDICATE"];
-    CHECK_REALM_PRIVILEGE(userARealm, .read = true, .update = true);
-    CHECK_CLASS_PRIVILEGE(userARealm, .read = true, .subscribe = true,
-                          .update = true, .create = true, .setPermissions = true);
-    CHECK_OBJECT_PRIVILEGE(userARealm, .read = true, .update = true, .del = true, .setPermissions = true);
-
-    CHECK_COUNT(3, SyncObject, userARealm);
-    [self addSyncObjectsToRealm:userARealm descriptions:@[@"child-4", @"child-5", @"child-6"]];
-    CHECK_COUNT(6, SyncObject, userARealm);
-    [self waitForSync:userARealm];
-    CHECK_COUNT(6, SyncObject, userARealm);
-
-    // userB's insertions should be reverted
-    RLMRealm *userBRealm = [self openRealmForURL:url user:self.userB];
-    [self subscribeToRealm:userBRealm type:[SyncObject class] where:@"TRUEPREDICATE"];
-    CHECK_REALM_PRIVILEGE(userBRealm, .read = true);
-    CHECK_CLASS_PRIVILEGE(userBRealm, .read = true, .subscribe = true);
-    CHECK_OBJECT_PRIVILEGE(userBRealm, .read = true);
-
-    CHECK_COUNT(6, SyncObject, userBRealm);
-    [self addSyncObjectsToRealm:userBRealm descriptions:@[@"child-4", @"child-5", @"child-6"]];
-    CHECK_COUNT(9, SyncObject, userBRealm);
-    [self waitForSync:userBRealm];
-    CHECK_COUNT(6, SyncObject, userBRealm);
-}
-
-- (void)testRealmManagePermissions {
-    // FIXME: this test is wrong; setPermission doesn't govern adding users to roles
-#if 0
-    NSURL *url = [self createRealmWithName:_cmd permissions:^(RLMRealm *realm) {
-        createPermissions([RLMRealmPermission objectInRealm:realm].permissions);
-
-        addUserToRole(realm, @"reader", self.userA.identity);
-        addUserToRole(realm, @"writer", self.userA.identity);
-        addUserToRole(realm, @"admin", self.userA.identity);
-
-        addUserToRole(realm, @"reader", self.userB.identity);
-        addUserToRole(realm, @"writer", self.userB.identity);
-
-        addUserToRole(realm, @"reader", self.userC.identity);
-    }];
-
-    RLMRealm *userARealm = [self openRealmForURL:url user:self.userA];
-    RLMRealm *userBRealm = [self openRealmForURL:url user:self.userB];
-    RLMRealm *userCRealm = [self openRealmForURL:url user:self.userC];
-
-    // userC should initially not be able to write to the Realm
-    [self subscribeToRealm:userCRealm type:[SyncObject class] where:@"TRUEPREDICATE"];
-    CHECK_REALM_PRIVILEGE(userCRealm, .read = true);
-    CHECK_CLASS_PRIVILEGE(userCRealm, .read = true, .subscribe = true);
-    CHECK_OBJECT_PRIVILEGE(userCRealm, .read = true);
-
-    [self addSyncObjectsToRealm:userCRealm descriptions:@[@"child-4", @"child-5", @"child-6"]];
-    [self waitForSync:userCRealm];
-    CHECK_COUNT(3, SyncObject, userCRealm);
-
-    // userB should not be able to grant write permissions to userC
-    [userBRealm transactionWithBlock:^{
-        addUserToRole(userBRealm, @"writer", self.userC.identity);
-    }];
-    [self waitForSync:userBRealm];
-    [self waitForSync:userCRealm];
-
-    CHECK_REALM_PRIVILEGE(userCRealm, .read = true);
-    CHECK_CLASS_PRIVILEGE(userCRealm, .read = true, .subscribe = true);
-    CHECK_OBJECT_PRIVILEGE(userCRealm, .read = true);
-    [self addSyncObjectsToRealm:userCRealm descriptions:@[@"child-4", @"child-5", @"child-6"]];
-    [self waitForSync:userCRealm];
-    CHECK_COUNT(3, SyncObject, userCRealm);
-
-    // userA should be able to grant write permissions to userC
-    [userARealm transactionWithBlock:^{
-        addUserToRole(userARealm, @"writer", self.userC.identity);
-    }];
-    [self waitForSync:userARealm];
-    [self waitForSync:userCRealm];
-
-    CHECK_REALM_PRIVILEGE(userCRealm, .read = true, .update = true);
-    CHECK_CLASS_PRIVILEGE(userCRealm, .read = true, .subscribe = true, .update = true, .create = true);
-    CHECK_OBJECT_PRIVILEGE(userCRealm, .read = true, .update = true, .del = true);
-    [self addSyncObjectsToRealm:userCRealm descriptions:@[@"child-4", @"child-5", @"child-6"]];
-    [self waitForSync:userCRealm];
-    CHECK_COUNT(6, SyncObject, userCRealm);
-#endif
-}
-
-- (void)testRealmModifySchema {
-    // awkward to test due to that reverts will normally crash
-    // probably need to spawn a child process?
-}
-
-- (void)testClassRead {
-    NSURL *url = [self createRealmWithName:_cmd permissions:^(RLMRealm *realm) {
-        createPermissions([RLMClassPermission objectInRealm:realm forClass:SyncObject.class].permissions);
-        addUserToRole(realm, @"reader", self.userA.identity);
-    }];
-
-    // userA should now be able to open the Realm and see objects
-    RLMRealm *userARealm = [self openRealmForURL:url user:self.userA];
-    [self subscribeToRealm:userARealm type:[SyncObject class] where:@"TRUEPREDICATE"];
-    CHECK_REALM_PRIVILEGE(userARealm, .read = true, .update = true, .setPermissions = true, .modifySchema = true);
-    CHECK_CLASS_PRIVILEGE(userARealm, .read = true, .subscribe = true);
-    CHECK_OBJECT_PRIVILEGE(userARealm, .read = true);
-    CHECK_COUNT(3, SyncObject, userARealm);
-
-    // userA should not be able to create new objects
-    [self addSyncObjectsToRealm:userARealm descriptions:@[@"child-4", @"child-5", @"child-6"]];
-    CHECK_COUNT(6, SyncObject, userARealm);
-    [self waitForSync:userARealm];
-    CHECK_COUNT(3, SyncObject, userARealm);
-
-    // userB should not be able to read any objects
-    RLMRealm *userBRealm = [self openRealmForURL:url user:self.userB];
-    [self subscribeToRealm:userBRealm type:[SyncObject class] where:@"TRUEPREDICATE"];
-    CHECK_REALM_PRIVILEGE(userBRealm, .read = true, .update = true, .setPermissions = true, .modifySchema = true);
-    CHECK_CLASS_PRIVILEGE(userBRealm, .read = false);
-    CHECK_COUNT(0, SyncObject, userBRealm);
-}
-
-- (void)testClassUpdate {
-    NSURL *url = [self createRealmWithName:_cmd permissions:^(RLMRealm *realm) {
-        createPermissions([RLMClassPermission objectInRealm:realm forClass:SyncObject.class].permissions);
-
-        addUserToRole(realm, @"reader", self.userA.identity);
-        addUserToRole(realm, @"writer", self.userA.identity);
-
-        addUserToRole(realm, @"reader", self.userB.identity);
-    }];
-
-    // userA should be able to mutate objects
-    RLMRealm *userARealm = [self openRealmForURL:url user:self.userA];
-    [self subscribeToRealm:userARealm type:[SyncObject class] where:@"TRUEPREDICATE"];
-    CHECK_REALM_PRIVILEGE(userARealm, .read = true, .update = true, .setPermissions = true, .modifySchema = true);
-    CHECK_CLASS_PRIVILEGE(userARealm, .read = true, .subscribe = true, .update = true, .create = true);
-    CHECK_OBJECT_PRIVILEGE(userARealm, .read = true, .update = true, .del = true, .setPermissions = true);
-
-    SyncObject *objA = [SyncObject allObjectsInRealm:userARealm].firstObject;
-    [userARealm transactionWithBlock:^{
-        objA.stringProp = @"new value";
-    }];
-    [self waitForSync:userARealm];
-    XCTAssertEqualObjects(objA.stringProp, @"new value");
-
-    // userB's mutations should be reverted
-    RLMRealm *userBRealm = [self openRealmForURL:url user:self.userB];
-    [self subscribeToRealm:userBRealm type:[SyncObject class] where:@"TRUEPREDICATE"];
-    CHECK_REALM_PRIVILEGE(userBRealm, .read = true, .update = true, .setPermissions = true, .modifySchema = true);
-    CHECK_CLASS_PRIVILEGE(userBRealm, .read = true, .subscribe = true);
-    CHECK_OBJECT_PRIVILEGE(userBRealm, .read = true);
-
-    SyncObject *objB = [SyncObject allObjectsInRealm:userBRealm].firstObject;
-    [userBRealm transactionWithBlock:^{
-        objB.stringProp = @"new value 2";
-    }];
-    XCTAssertEqualObjects(objB.stringProp, @"new value 2");
-    [self waitForSync:userBRealm];
-    XCTAssertEqualObjects(objB.stringProp, @"new value");
-}
-
-- (void)testClassCreate {
-    NSURL *url = [self createRealmWithName:_cmd permissions:^(RLMRealm *realm) {
-        createPermissions([RLMClassPermission objectInRealm:realm forClass:SyncObject.class].permissions);
-
-        addUserToRole(realm, @"reader", self.userA.identity);
-        addUserToRole(realm, @"writer", self.userA.identity);
-
-        addUserToRole(realm, @"reader", self.userB.identity);
-    }];
-
-    // userA should be able to add objects
-    RLMRealm *userARealm = [self openRealmForURL:url user:self.userA];
-    [self subscribeToRealm:userARealm type:[SyncObject class] where:@"TRUEPREDICATE"];
-    CHECK_REALM_PRIVILEGE(userARealm, .read = true, .update = true, .setPermissions = true, .modifySchema = true);
-    CHECK_CLASS_PRIVILEGE(userARealm, .read = true, .subscribe = true, .update = true, .create = true);
-    CHECK_OBJECT_PRIVILEGE(userARealm, .read = true, .update = true, .del = true, .setPermissions = true);
-
-    CHECK_COUNT(3, SyncObject, userARealm);
-    [self addSyncObjectsToRealm:userARealm descriptions:@[@"child-4", @"child-5", @"child-6"]];
-    CHECK_COUNT(6, SyncObject, userARealm);
-    [self waitForSync:userARealm];
-    CHECK_COUNT(6, SyncObject, userARealm);
-
-    // userB's insertions should be reverted
-    RLMRealm *userBRealm = [self openRealmForURL:url user:self.userB];
-    [self subscribeToRealm:userBRealm type:[SyncObject class] where:@"TRUEPREDICATE"];
-    CHECK_REALM_PRIVILEGE(userBRealm, .read = true, .update = true, .setPermissions = true, .modifySchema = true);
-    CHECK_CLASS_PRIVILEGE(userBRealm, .read = true, .subscribe = true);
-    CHECK_OBJECT_PRIVILEGE(userBRealm, .read = true);
-
-    CHECK_COUNT(6, SyncObject, userBRealm);
-    [self addSyncObjectsToRealm:userBRealm descriptions:@[@"child-4", @"child-5", @"child-6"]];
-    CHECK_COUNT(9, SyncObject, userBRealm);
-    [self waitForSync:userBRealm];
-    CHECK_COUNT(6, SyncObject, userBRealm);
-}
-
-- (void)testClassSetPermissions {
-    NSURL *url = [self createRealmWithName:_cmd permissions:^(RLMRealm *realm) {
-        createPermissions([RLMClassPermission objectInRealm:realm forClass:SyncObject.class].permissions);
-
-        addUserToRole(realm, @"reader", self.userA.identity);
-        addUserToRole(realm, @"writer", self.userA.identity);
-        addUserToRole(realm, @"admin", self.userA.identity);
-
-        addUserToRole(realm, @"reader", self.userB.identity);
-        addUserToRole(realm, @"writer", self.userB.identity);
-
-        addUserToRole(realm, @"reader", self.userC.identity);
-    }];
-
-    // Despite having write access userB should not be able to add "update" access to "reader"
-    RLMRealm *userBRealm = [self openRealmForURL:url user:self.userB];
-    [self subscribeToRealm:userBRealm type:[SyncObject class] where:@"TRUEPREDICATE"];
-    [userBRealm transactionWithBlock:^{
-        auto permission = [RLMPermission permissionForRoleNamed:@"reader" onClass:SyncObject.class realm:userBRealm];
-        permission.canCreate = true;
-        permission.canUpdate = true;
-
-    }];
-    [self waitForSync:userBRealm];
-
-    // userC should be unable to create objects
-    RLMRealm *userCRealm = [self openRealmForURL:url user:self.userC];
-    [self subscribeToRealm:userCRealm type:[SyncObject class] where:@"TRUEPREDICATE"];
-    CHECK_REALM_PRIVILEGE(userCRealm, .read = true, .update = true, .setPermissions = true, .modifySchema = true);
-    CHECK_CLASS_PRIVILEGE(userCRealm, .read = true, .subscribe = true);
-    CHECK_OBJECT_PRIVILEGE(userCRealm, .read = true);
-
-    [self addSyncObjectsToRealm:userCRealm descriptions:@[@"child-4", @"child-5", @"child-6"]];
-    CHECK_COUNT(6, SyncObject, userCRealm);
-    [self waitForSync:userCRealm];
-    CHECK_COUNT(3, SyncObject, userCRealm);
-
-    // userA should able to add "update" access to "reader"
-    RLMRealm *userARealm = [self openRealmForURL:url user:self.userA];
-    [self subscribeToRealm:userARealm type:[SyncObject class] where:@"TRUEPREDICATE"];
-    [userARealm transactionWithBlock:^{
-        auto permission = [RLMPermission permissionForRoleNamed:@"reader" onClass:SyncObject.class realm:userARealm];
-        permission.canCreate = true;
-        permission.canUpdate = true;
-    }];
-    [self waitForSync:userARealm];
-
-    // userC should now be able to create objects
-    [self waitForSync:userCRealm];
-    CHECK_CLASS_PRIVILEGE(userCRealm, .read = true, .subscribe = true, .update = true, .create = true);
-    CHECK_OBJECT_PRIVILEGE(userCRealm, .read = true, .update = true, .del = true, .setPermissions = true);
-
-    [self addSyncObjectsToRealm:userCRealm descriptions:@[@"child-4", @"child-5", @"child-6"]];
-    CHECK_COUNT(6, SyncObject, userCRealm);
-    [self waitForSync:userCRealm];
-    CHECK_COUNT(6, SyncObject, userCRealm);
-}
-
-- (void)testObjectRead {
-    NSURL *url = [self createRealmWithName:_cmd permissions:^(RLMRealm *realm) {
-        addUserToRole(realm, @"reader", self.userA.identity);
-        auto obj1 = [ObjectWithPermissions createInRealm:realm withValue:@[@1]];
-        createPermissions(obj1.permissions);
-        [ObjectWithPermissions createInRealm:realm withValue:@[@2]];
-    }];
-
-    // userA should be able to see both objects
-    RLMRealm *userARealm = [self openRealmForURL:url user:self.userA];
-    [self subscribeToRealm:userARealm type:[ObjectWithPermissions class] where:@"TRUEPREDICATE"];
-    CHECK_COUNT(1, ObjectWithPermissions, userARealm);
-
-    // userB should not be able to read any objects
-    RLMRealm *userBRealm = [self openRealmForURL:url user:self.userB];
-    [self subscribeToRealm:userBRealm type:[ObjectWithPermissions class] where:@"TRUEPREDICATE"];
-    CHECK_COUNT(0, ObjectWithPermissions, userBRealm);
-}
-
-- (void)testObjectTransitiveRead {
-}
-
-- (void)testObjectUpdate {
-    NSURL *url = [self createRealmWithName:_cmd permissions:^(RLMRealm *realm) {
-        addUserToRole(realm, @"reader", self.userA.identity);
-        addUserToRole(realm, @"reader", self.userB.identity);
-        addUserToRole(realm, @"writer", self.userB.identity);
-        auto obj1 = [ObjectWithPermissions createInRealm:realm withValue:@[@1]];
-        createPermissions(obj1.permissions);
-    }];
-
-    RLMRealm *userARealm = [self openRealmForURL:url user:self.userA];
-    [self subscribeToRealm:userARealm type:[ObjectWithPermissions class] where:@"TRUEPREDICATE"];
-    ObjectWithPermissions *objA = [ObjectWithPermissions allObjectsInRealm:userARealm].firstObject;
-    [userARealm transactionWithBlock:^{
-        objA.value = 3;
-    }];
-    [self waitForSync:userARealm];
-    XCTAssertEqual(objA.value, 1);
-
-    RLMRealm *userBRealm = [self openRealmForURL:url user:self.userB];
-    [self subscribeToRealm:userBRealm type:[ObjectWithPermissions class] where:@"TRUEPREDICATE"];
-    ObjectWithPermissions *objB = [ObjectWithPermissions allObjectsInRealm:userBRealm].firstObject;
-    [userBRealm transactionWithBlock:^{
-        objB.value = 3;
-    }];
-    [self waitForSync:userBRealm];
-    [self waitForSync:userARealm];
-
-    XCTAssertEqual(objA.value, 3);
-    XCTAssertEqual(objB.value, 3);
-}
-
-- (void)testObjectDelete {
-    NSURL *url = [self createRealmWithName:_cmd permissions:^(RLMRealm *realm) {
-        addUserToRole(realm, @"reader", self.userA.identity);
-        addUserToRole(realm, @"reader", self.userB.identity);
-        addUserToRole(realm, @"writer", self.userB.identity);
-        auto obj1 = [ObjectWithPermissions createInRealm:realm withValue:@[@1]];
-        createPermissions(obj1.permissions);
-    }];
-
-    RLMRealm *userARealm = [self openRealmForURL:url user:self.userA];
-    [self subscribeToRealm:userARealm type:[ObjectWithPermissions class] where:@"TRUEPREDICATE"];
-    ObjectWithPermissions *objA = [ObjectWithPermissions allObjectsInRealm:userARealm].firstObject;
-    [userARealm transactionWithBlock:^{
-        [userARealm deleteObject:objA];
-    }];
-    CHECK_COUNT(0, ObjectWithPermissions, userARealm);
-    [self waitForSync:userARealm];
-    CHECK_COUNT(1, ObjectWithPermissions, userARealm);
-    objA = [ObjectWithPermissions allObjectsInRealm:userARealm].firstObject;
-
-    RLMRealm *userBRealm = [self openRealmForURL:url user:self.userB];
-    [self subscribeToRealm:userBRealm type:[ObjectWithPermissions class] where:@"TRUEPREDICATE"];
-    ObjectWithPermissions *objB = [ObjectWithPermissions allObjectsInRealm:userBRealm].firstObject;
-    [userBRealm transactionWithBlock:^{
-        [userBRealm deleteObject:objB];
-    }];
-    [self waitForSync:userBRealm];
-    [self waitForSync:userARealm];
-
-    CHECK_COUNT(0, ObjectWithPermissions, userARealm);
-    CHECK_COUNT(0, ObjectWithPermissions, userBRealm);
-    XCTAssertTrue(objA.invalidated);
-    XCTAssertTrue(objB.invalidated);
-}
-
-- (void)testObjectSetPermissions {
-    NSURL *url = [self createRealmWithName:_cmd permissions:^(RLMRealm *) {}];
-
-    RLMRealm *userARealm = [self openRealmForURL:url user:self.userA];
-    [self subscribeToRealm:userARealm type:[ObjectWithPermissions class] where:@"TRUEPREDICATE"];
-    [userARealm transactionWithBlock:^{
-        auto obj = [ObjectWithPermissions createInRealm:userARealm withValue:@[@1]];
-        auto permissions = [RLMPermission permissionForRoleNamed:@"foo" onObject:obj];
-        permissions.canRead = true;
-        addUserToRole(userARealm, @"foo", self.userB.identity);
-    }];
-
-    CHECK_COUNT(1, ObjectWithPermissions, userARealm);
-    [self waitForSync:userARealm];
-    CHECK_COUNT(0, ObjectWithPermissions, userARealm);
-
-    RLMRealm *userBRealm = [self openRealmForURL:url user:self.userB];
-    [self subscribeToRealm:userBRealm type:[ObjectWithPermissions class] where:@"TRUEPREDICATE"];
-    CHECK_COUNT(1, ObjectWithPermissions, userBRealm);
-}
-
-- (void)testRetrieveClassPermissionsForRenamedClass {
-    [self createRealmWithName:_cmd permissions:^(RLMRealm *realm) {
-        XCTAssertNotNil([RLMClassPermission objectInRealm:realm forClass:RLMPermissionRole.class]);
-    }];
-}
-
-@end

+ 0 - 25
Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/RLMSyncSessionRefreshHandle+ObjectServerTests.h

@@ -1,25 +0,0 @@
-////////////////////////////////////////////////////////////////////////////
-//
-// Copyright 2017 Realm Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////
-
-#import "RLMSyncSessionRefreshHandle.h"
-
-@interface RLMSyncSessionRefreshHandle (ObjectServerTests)
-
-+ (void)calculateFireDateUsingTestLogic:(BOOL)forTest blockOnRefreshCompletion:(void(^)(BOOL))block;
-
-@end

+ 0 - 66
Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/RLMSyncSessionRefreshHandle+ObjectServerTests.m

@@ -1,66 +0,0 @@
-////////////////////////////////////////////////////////////////////////////
-//
-// Copyright 2017 Realm Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////
-
-#import "RLMSyncSessionRefreshHandle+ObjectServerTests.h"
-
-#import "RLMTestUtils.h"
-
-static BOOL s_calculateFireDatesWithTestLogic = NO;
-static void(^s_onRefreshCompletedOrErrored)(BOOL) = nil;
-
-@interface RLMSyncSessionRefreshHandle ()
-+ (NSDate *)fireDateForTokenExpirationDate:(NSDate *)date nowDate:(NSDate *)date;
-- (BOOL)_onRefreshCompletionWithError:(NSError *)error json:(NSDictionary *)json;
-@end
-
-@implementation RLMSyncSessionRefreshHandle (ObjectServerTests)
-
-+ (void)calculateFireDateUsingTestLogic:(BOOL)forTest blockOnRefreshCompletion:(void(^)(BOOL))block {
-    s_onRefreshCompletedOrErrored = block;
-    s_calculateFireDatesWithTestLogic = forTest;
-}
-
-+ (void)load {
-    RLMSwapOutClassMethod(self,
-                          @selector(fireDateForTokenExpirationDate:nowDate:),
-                          @selector(ost_fireDateForTokenExpirationDate:nowDate:));
-    RLMSwapOutInstanceMethod(self,
-                             @selector(_onRefreshCompletionWithError:json:),
-                             @selector(ost_onRefreshCompletionWithError:json:));
-}
-
-+ (NSDate *)ost_fireDateForTokenExpirationDate:(NSDate *)date nowDate:(NSDate *)nowDate {
-    if (s_calculateFireDatesWithTestLogic) {
-        // Force the refresh to take place one second later.
-        return [NSDate dateWithTimeIntervalSinceNow:1];
-    } else {
-        // Use the original logic.
-        return [self ost_fireDateForTokenExpirationDate:date nowDate:nowDate];
-    }
-}
-
-- (BOOL)ost_onRefreshCompletionWithError:(NSError *)error json:(NSDictionary *)json {
-    BOOL status = [self ost_onRefreshCompletionWithError:error json:json];
-    // For the sake of testing, call a callback afterwards to let the test update its state.
-    if (s_onRefreshCompletedOrErrored) {
-        s_onRefreshCompletedOrErrored(status);
-    }
-    return status;
-}
-
-@end

+ 0 - 152
Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/RLMSyncTestCase.h

@@ -1,152 +0,0 @@
-////////////////////////////////////////////////////////////////////////////
-//
-// Copyright 2016 Realm Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////
-
-#import "RLMMultiProcessTestCase.h"
-#import "RLMSyncConfiguration_Private.h"
-
-typedef void(^RLMSyncBasicErrorReportingBlock)(NSError * _Nullable);
-
-NS_ASSUME_NONNULL_BEGIN
-
-@interface RLMSyncManager ()
-- (void)setSessionCompletionNotifier:(nullable RLMSyncBasicErrorReportingBlock)sessionCompletionNotifier;
-@end
-
-@interface SyncObject : RLMObject
-@property NSString *stringProp;
-@end
-
-@interface HugeSyncObject : RLMObject
-@property NSData *dataProp;
-+ (instancetype)object;
-@end
-
-@interface RLMSyncTestCase : RLMMultiProcessTestCase
-
-+ (NSURL *)authServerURL;
-+ (NSURL *)secureAuthServerURL;
-
-+ (RLMSyncCredentials *)basicCredentialsWithName:(NSString *)name register:(BOOL)shouldRegister;
-
-+ (NSURL *)onDiskPathForSyncedRealm:(RLMRealm *)realm;
-
-/// Retrieve the administrator token.
-- (NSString *)adminToken;
-
-/// Read and delete the last email sent by ROS to the given address.
-/// Returns nil if none has been sent to that address.
-- (nullable NSString *)emailForAddress:(NSString *)email;
-
-/// Synchronously open a synced Realm and wait until the binding process has completed or failed.
-- (RLMRealm *)openRealmForURL:(NSURL *)url user:(RLMSyncUser *)user;
-
-/// Synchronously open a synced Realm and wait until the binding process has completed or failed.
-- (RLMRealm *)openRealmWithConfiguration:(RLMRealmConfiguration *)configuration;
-
-/// Synchronously open a synced Realm via asyncOpen and return the Realm.
-- (RLMRealm *)asyncOpenRealmWithConfiguration:(RLMRealmConfiguration *)configuration;
-
-/// Synchronously open a synced Realm via asyncOpen and return the expected error.
-- (NSError *)asyncOpenErrorWithConfiguration:(RLMRealmConfiguration *)configuration;
-
-/// Synchronously open a synced Realm. Also run a block right after the Realm is created.
-- (RLMRealm *)openRealmForURL:(NSURL *)url
-                         user:(RLMSyncUser *)user
-             immediatelyBlock:(nullable void(^)(void))block;
-
-/// Synchronously open a synced Realm with encryption key and stop policy.
-/// Also run a block right after the Realm is created.
-- (RLMRealm *)openRealmForURL:(NSURL *)url
-                         user:(RLMSyncUser *)user
-                encryptionKey:(nullable NSData *)encryptionKey
-                   stopPolicy:(RLMSyncStopPolicy)stopPolicy
-             immediatelyBlock:(nullable void(^)(void))block;
-
-/// Synchronously open a synced Realm and wait until the binding process has completed or failed.
-/// Also run a block right after the Realm is created.
-- (RLMRealm *)openRealmWithConfiguration:(RLMRealmConfiguration *)configuration
-                        immediatelyBlock:(nullable void(^)(void))block;
-;
-
-/// Immediately open a synced Realm.
-- (RLMRealm *)immediatelyOpenRealmForURL:(NSURL *)url user:(RLMSyncUser *)user;
-
-/// Immediately open a synced Realm with encryption key and stop policy.
-- (RLMRealm *)immediatelyOpenRealmForURL:(NSURL *)url
-                                    user:(RLMSyncUser *)user
-                           encryptionKey:(nullable NSData *)encryptionKey
-                              stopPolicy:(RLMSyncStopPolicy)stopPolicy;
-
-/// Synchronously create, log in, and return a user.
-- (RLMSyncUser *)logInUserForCredentials:(RLMSyncCredentials *)credentials
-                                  server:(NSURL *)url;
-
-/// Create and log in an admin user.
-- (RLMSyncUser *)createAdminUserForURL:(NSURL *)url username:(NSString *)username;
-
-/// Add a number of objects to a Realm.
-- (void)addSyncObjectsToRealm:(RLMRealm *)realm descriptions:(NSArray<NSString *> *)descriptions;
-
-/// Synchronously wait for downloads to complete for any number of Realms, and then check their `SyncObject` counts.
-- (void)waitForDownloadsForUser:(RLMSyncUser *)user
-                         realms:(NSArray<RLMRealm *> *)realms
-                      realmURLs:(NSArray<NSURL *> *)realmURLs
-                 expectedCounts:(NSArray<NSNumber *> *)counts;
-
-/// "Prime" the sync manager to signal the given semaphore the next time a session is bound. This method should be
-/// called right before a Realm is opened if that Realm's session is the one to be monitored.
-- (void)primeSyncManagerWithSemaphore:(nullable dispatch_semaphore_t)semaphore;
-
-/// Wait for downloads to complete; drop any error.
-- (void)waitForDownloadsForRealm:(RLMRealm *)realm;
-- (void)waitForDownloadsForRealm:(RLMRealm *)realm error:(NSError **)error;
-
-/// Wait for uploads to complete; drop any error.
-- (void)waitForUploadsForRealm:(RLMRealm *)realm;
-- (void)waitForUploadsForRealm:(RLMRealm *)realm error:(NSError **)error;
-
-/// Wait for downloads to complete while spinning the runloop. This method uses expectations.
-- (void)waitForDownloadsForUser:(RLMSyncUser *)user
-                            url:(NSURL *)url
-                    expectation:(nullable XCTestExpectation *)expectation
-                          error:(NSError **)error;
-
-/// Manually set the refresh token for a user. Used for testing invalid token conditions.
-- (void)manuallySetRefreshTokenForUser:(RLMSyncUser *)user value:(NSString *)tokenValue;
-
-- (void)setupSyncManager;
-- (void)resetSyncManager;
-
-@end
-
-NS_ASSUME_NONNULL_END
-
-#define WAIT_FOR_SEMAPHORE(macro_semaphore, macro_timeout) \
-{                                                                                                                      \
-    int64_t delay_in_ns = (int64_t)(macro_timeout * NSEC_PER_SEC);                                                     \
-    BOOL sema_success = dispatch_semaphore_wait(macro_semaphore, dispatch_time(DISPATCH_TIME_NOW, delay_in_ns)) == 0;  \
-    XCTAssertTrue(sema_success, @"Semaphore timed out.");                                                              \
-}
-
-#define CHECK_COUNT(d_count, macro_object_type, macro_realm) \
-{                                                                                                       \
-    [macro_realm refresh];                                                                              \
-    NSInteger c = [macro_object_type allObjectsInRealm:macro_realm].count;                              \
-    NSString *w = self.isParent ? @"parent" : @"child";                                                 \
-    XCTAssert(d_count == c, @"Expected %@ items, but actually got %@ (%@)", @(d_count), @(c), w);       \
-}

+ 0 - 594
Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/RLMSyncTestCase.mm

@@ -1,594 +0,0 @@
-////////////////////////////////////////////////////////////////////////////
-//
-// Copyright 2016 Realm Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////
-
-#import "RLMSyncTestCase.h"
-
-#import <XCTest/XCTest.h>
-#import <Realm/Realm.h>
-
-#import "RLMRealm_Dynamic.h"
-#import "RLMRealm_Private.hpp"
-#import "RLMRealmConfiguration_Private.h"
-#import "RLMSyncManager_Private.h"
-#import "RLMSyncSessionRefreshHandle+ObjectServerTests.h"
-#import "RLMSyncConfiguration_Private.h"
-#import "RLMUtil.hpp"
-
-#import "sync/sync_manager.hpp"
-#import "sync/sync_session.hpp"
-#import "sync/sync_user.hpp"
-
-// Set this to 1 if you want the test ROS instance to log its debug messages to console.
-#define LOG_ROS_OUTPUT 0
-
-#if !TARGET_OS_MAC
-#error These tests can only be run on a macOS host.
-#endif
-
-static NSString *nodePath() {
-    static NSString *path = [] {
-        NSDictionary *environment = NSProcessInfo.processInfo.environment;
-        if (NSString *path = environment[@"REALM_NODE_PATH"]) {
-            return path;
-        }
-        return @"/usr/local/bin/node";
-    }();
-    return path;
-}
-
-@interface RLMSyncManager ()
-+ (void)_setCustomBundleID:(NSString *)customBundleID;
-- (void)configureWithRootDirectory:(NSURL *)rootDirectory;
-- (NSArray<RLMSyncUser *> *)_allUsers;
-@end
-
-@interface RLMSyncTestCase ()
-@property (nonatomic) NSTask *task;
-@end
-
-@interface RLMSyncCredentials ()
-+ (instancetype)credentialsWithDebugUserID:(NSString *)userID isAdmin:(BOOL)isAdmin;
-@end
-
-@interface RLMSyncSession ()
-- (BOOL)waitForUploadCompletionOnQueue:(dispatch_queue_t)queue callback:(void(^)(NSError *))callback;
-- (BOOL)waitForDownloadCompletionOnQueue:(dispatch_queue_t)queue callback:(void(^)(NSError *))callback;
-@end
-
-@interface RLMSyncUser()
-- (std::shared_ptr<realm::SyncUser>)_syncUser;
-@end
-
-@implementation SyncObject
-@end
-
-@implementation HugeSyncObject
-
-+ (instancetype)object  {
-    const NSInteger fakeDataSize = 1000000;
-    HugeSyncObject *object = [[self alloc] init];
-    char fakeData[fakeDataSize];
-    memset(fakeData, 16, sizeof(fakeData));
-    object.dataProp = [NSData dataWithBytes:fakeData length:sizeof(fakeData)];
-    return object;
-}
-
-@end
-
-static NSTask *s_task;
-
-static NSURL *syncDirectoryForChildProcess() {
-    NSString *path = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES)[0];
-    NSBundle *bundle = [NSBundle mainBundle];
-    NSString *bundleIdentifier = bundle.bundleIdentifier ?: bundle.executablePath.lastPathComponent;
-    path = [path stringByAppendingPathComponent:[NSString stringWithFormat:@"%@-child", bundleIdentifier]];
-    return [NSURL fileURLWithPath:path isDirectory:YES];
-}
-
-@interface RealmObjectServer : NSObject
-@property (nonatomic, readonly) NSURL *serverDataRoot;
-
-+ (instancetype)sharedServer;
-
-- (void)launch;
-@end
-
-@implementation RealmObjectServer {
-    NSTask *_task;
-    NSURL *_serverDataRoot;
-}
-+ (instancetype)sharedServer {
-    static RealmObjectServer *instance = [RealmObjectServer new];
-    return instance;
-}
-
-- (instancetype)init {
-    if (self = [super init]) {
-        _serverDataRoot = [NSURL fileURLWithPath:[NSTemporaryDirectory() stringByAppendingPathComponent:@"test-ros-data"]];
-    }
-    return self;
-}
-
-- (void)launch {
-    if (_task) {
-        return;
-    }
-    // Clean up any old state from the server
-    [[NSTask launchedTaskWithLaunchPath:@"/usr/bin/pkill"
-                              arguments:@[@"-f", @"node.*test-ros-server.js"]] waitUntilExit];
-    NSError *error;
-    [NSFileManager.defaultManager removeItemAtURL:self.serverDataRoot error:&error];
-    if (error && error.code != NSFileNoSuchFileError) {
-        NSLog(@"Failed to delete old test state: %@", error);
-        abort();
-    }
-    error = nil;
-    [NSFileManager.defaultManager createDirectoryAtURL:self.serverDataRoot
-                           withIntermediateDirectories:YES attributes:nil error:&error];
-    if (error) {
-        NSLog(@"Failed to create scratch directory: %@", error);
-        abort();
-    }
-
-    // Install ROS if it isn't already present
-    [self downloadObjectServer];
-
-    // Set up the actual ROS task
-    NSPipe *pipe = [NSPipe pipe];
-    _task = [[NSTask alloc] init];
-    _task.currentDirectoryPath = self.serverDataRoot.path;
-    _task.launchPath = nodePath();
-    NSString *directory = [@(__FILE__) stringByDeletingLastPathComponent];
-    _task.arguments = @[[directory stringByAppendingPathComponent:@"test-ros-server.js"],
-                        self.serverDataRoot.path];
-    _task.standardOutput = pipe;
-    [_task launch];
-
-    NSData *childStdout = pipe.fileHandleForReading.readDataToEndOfFile;
-    if (![childStdout isEqual:[@"started\n" dataUsingEncoding:NSUTF8StringEncoding]]) {
-        abort();
-    }
-
-    atexit([] {
-        auto self = RealmObjectServer.sharedServer;
-        [self->_task terminate];
-        [self->_task waitUntilExit];
-        [NSFileManager.defaultManager removeItemAtURL:self->_serverDataRoot error:nil];
-    });
-}
-
-- (NSString *)desiredObjectServerVersion {
-    auto path = [[[[@(__FILE__) stringByDeletingLastPathComponent] // RLMSyncTestCase.mm
-                 stringByDeletingLastPathComponent] // ObjectServerTests
-                 stringByDeletingLastPathComponent] // Realm
-                 stringByAppendingPathComponent:@"dependencies.list"];
-    auto file = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil];
-    if (!file) {
-        NSLog(@"Failed to read dependencies.list");
-        abort();
-    }
-
-    auto regex = [NSRegularExpression regularExpressionWithPattern:@"^REALM_OBJECT_SERVER_VERSION=(.*)$"
-                                                           options:NSRegularExpressionAnchorsMatchLines error:nil];
-    auto match = [regex firstMatchInString:file options:0 range:{0, file.length}];
-    if (!match) {
-        NSLog(@"Failed to read REALM_OBJECT_SERVER_VERSION from dependencies.list");
-        abort();
-    }
-    return [file substringWithRange:[match rangeAtIndex:1]];
-}
-
-- (NSString *)currentObjectServerVersion {
-    auto path = [[[[@(__FILE__) stringByDeletingLastPathComponent] // RLMSyncTestCase.mm
-                 stringByAppendingPathComponent:@"node_modules"]
-                 stringByAppendingPathComponent:@"realm-object-server"]
-                 stringByAppendingPathComponent:@"package.json"];
-    auto file = [NSData dataWithContentsOfFile:path];
-    if (!file) {
-        return nil;
-    }
-
-    NSError *error;
-    NSDictionary *json = [NSJSONSerialization JSONObjectWithData:file options:0 error:&error];
-    if (!json) {
-        NSLog(@"Error reading version from installed ROS: %@", error);
-        abort();
-    }
-
-    return json[@"version"];
-}
-
-- (void)downloadObjectServer {
-    NSString *desiredVersion = [self desiredObjectServerVersion];
-    NSString *currentVersion = [self currentObjectServerVersion];
-    if ([currentVersion isEqualToString:desiredVersion]) {
-        return;
-    }
-
-    NSLog(@"Installing Realm Object Server %@", desiredVersion);
-    NSTask *task = [[NSTask alloc] init];
-    task.currentDirectoryPath = [@(__FILE__) stringByDeletingLastPathComponent];
-    task.launchPath = nodePath();
-    task.arguments = @[[[nodePath() stringByDeletingLastPathComponent] stringByAppendingPathComponent:@"npm"],
-                       @"--scripts-prepend-node-path=auto",
-                       @"--no-color",
-                       @"--no-progress",
-                       @"--no-save",
-                       @"--no-package-lock",
-                       @"install",
-                       [@"realm-object-server@" stringByAppendingString:desiredVersion]
-                       ];
-    [task launch];
-    [task waitUntilExit];
-}
-@end
-
-@implementation RLMSyncTestCase
-
-#pragma mark - Helper methods
-
-- (BOOL)isPartial {
-    return NO;
-}
-
-+ (NSURL *)authServerURL {
-    return [NSURL URLWithString:@"http://127.0.0.1:9080"];
-}
-
-+ (NSURL *)secureAuthServerURL {
-    return [NSURL URLWithString:@"https://localhost:9443"];
-}
-
-+ (RLMSyncCredentials *)basicCredentialsWithName:(NSString *)name register:(BOOL)shouldRegister {
-    return [RLMSyncCredentials credentialsWithUsername:name
-                                              password:@"a"
-                                              register:shouldRegister];
-}
-
-+ (NSURL *)onDiskPathForSyncedRealm:(RLMRealm *)realm {
-    return [NSURL fileURLWithPath:@(realm->_realm->config().path.data())];
-}
-
-- (void)addSyncObjectsToRealm:(RLMRealm *)realm descriptions:(NSArray<NSString *> *)descriptions {
-    [realm beginWriteTransaction];
-    for (NSString *desc in descriptions) {
-        [SyncObject createInRealm:realm withValue:@[desc]];
-    }
-    [realm commitWriteTransaction];
-}
-
-- (void)waitForDownloadsForUser:(RLMSyncUser *)user
-                         realms:(NSArray<RLMRealm *> *)realms
-                      realmURLs:(NSArray<NSURL *> *)realmURLs
-                 expectedCounts:(NSArray<NSNumber *> *)counts {
-    NSAssert(realms.count == counts.count && realms.count == realmURLs.count,
-             @"Test logic error: all array arguments must be the same size.");
-    for (NSUInteger i = 0; i < realms.count; i++) {
-        [self waitForDownloadsForUser:user url:realmURLs[i] expectation:nil error:nil];
-        [realms[i] refresh];
-        CHECK_COUNT([counts[i] integerValue], SyncObject, realms[i]);
-    }
-}
-
-- (RLMRealm *)openRealmForURL:(NSURL *)url user:(RLMSyncUser *)user {
-    return [self openRealmForURL:url user:user immediatelyBlock:nil];
-}
-
-- (RLMRealm *)openRealmForURL:(NSURL *)url user:(RLMSyncUser *)user immediatelyBlock:(void(^)(void))block {
-    return [self openRealmForURL:url
-                            user:user
-                   encryptionKey:nil
-                      stopPolicy:RLMSyncStopPolicyAfterChangesUploaded
-                immediatelyBlock:block];
-}
-
-- (RLMRealm *)openRealmForURL:(NSURL *)url
-                         user:(RLMSyncUser *)user
-                encryptionKey:(nullable NSData *)encryptionKey
-                   stopPolicy:(RLMSyncStopPolicy)stopPolicy
-             immediatelyBlock:(nullable void(^)(void))block {
-    const NSTimeInterval timeout = 4;
-    dispatch_semaphore_t sema = dispatch_semaphore_create(0);
-    RLMSyncManager.sharedManager.sessionCompletionNotifier = ^(NSError *error) {
-        if (error) {
-            XCTFail(@"Received an asynchronous error when trying to open Realm at '%@' for user '%@': %@ (process: %@)",
-                    url, user.identity, error, self.isParent ? @"parent" : @"child");
-        }
-        dispatch_semaphore_signal(sema);
-    };
-
-    RLMRealm *realm = [self immediatelyOpenRealmForURL:url user:user encryptionKey:encryptionKey stopPolicy:stopPolicy];
-    if (block) {
-        block();
-    }
-    // Wait for login to succeed or fail.
-    XCTAssert(dispatch_semaphore_wait(sema, dispatch_time(DISPATCH_TIME_NOW, (int64_t)(timeout * NSEC_PER_SEC))) == 0,
-              @"Timed out while trying to asynchronously open Realm for URL: %@", url);
-    RLMSyncManager.sharedManager.sessionCompletionNotifier = nil;
-    return realm;
-}
-
-- (RLMRealm *)openRealmWithConfiguration:(RLMRealmConfiguration *)configuration {
-    return [self openRealmWithConfiguration:configuration immediatelyBlock:nullptr];
-}
-
-- (RLMRealm *)openRealmWithConfiguration:(RLMRealmConfiguration *)configuration
-             immediatelyBlock:(nullable void(^)(void))block {
-    const NSTimeInterval timeout = 4;
-    dispatch_semaphore_t sema = dispatch_semaphore_create(0);
-    RLMSyncConfiguration *syncConfig = configuration.syncConfiguration;
-    RLMSyncManager.sharedManager.sessionCompletionNotifier = ^(NSError *error) {
-        if (error) {
-            XCTFail(@"Received an asynchronous error when trying to open Realm at '%@' for user '%@': %@ (process: %@)",
-                    syncConfig.realmURL, syncConfig.user.identity, error, self.isParent ? @"parent" : @"child");
-        }
-        dispatch_semaphore_signal(sema);
-    };
-
-    RLMRealm *realm = [RLMRealm realmWithConfiguration:configuration error:nullptr];
-    if (block) {
-        block();
-    }
-    // Wait for login to succeed or fail.
-    XCTAssert(dispatch_semaphore_wait(sema, dispatch_time(DISPATCH_TIME_NOW, (int64_t)(timeout * NSEC_PER_SEC))) == 0,
-              @"Timed out while trying to asynchronously open Realm for URL: %@", syncConfig.realmURL);
-    return realm;
-}
-
-- (RLMRealm *)asyncOpenRealmWithConfiguration:(RLMRealmConfiguration *)config {
-    __block RLMRealm *realm = nil;
-    XCTestExpectation *ex = [self expectationWithDescription:@"Should asynchronously open a Realm"];
-    [RLMRealm asyncOpenWithConfiguration:config
-                           callbackQueue:dispatch_get_main_queue()
-                                callback:^(RLMRealm *r, NSError *err){
-        XCTAssertNil(err);
-        XCTAssertNotNil(r);
-        realm = r;
-        [ex fulfill];
-    }];
-    [self waitForExpectationsWithTimeout:10.0 handler:nil];
-    return realm;
-}
-
-- (NSError *)asyncOpenErrorWithConfiguration:(RLMRealmConfiguration *)config {
-    __block NSError *error = nil;
-    XCTestExpectation *ex = [self expectationWithDescription:@"Should fail to asynchronously open a Realm"];
-    [RLMRealm asyncOpenWithConfiguration:config
-                           callbackQueue:dispatch_get_main_queue()
-                                callback:^(RLMRealm *r, NSError *err){
-        XCTAssertNotNil(err);
-        XCTAssertNil(r);
-        error = err;
-        [ex fulfill];
-    }];
-    [self waitForExpectationsWithTimeout:10.0 handler:nil];
-    return error;
-}
-
-- (RLMRealm *)immediatelyOpenRealmForURL:(NSURL *)url user:(RLMSyncUser *)user {
-    return [self immediatelyOpenRealmForURL:url
-                                       user:user
-                              encryptionKey:nil
-                                 stopPolicy:RLMSyncStopPolicyAfterChangesUploaded];
-}
-
-- (RLMRealm *)immediatelyOpenRealmForURL:(NSURL *)url
-                                    user:(RLMSyncUser *)user
-                           encryptionKey:(NSData *)encryptionKey
-                              stopPolicy:(RLMSyncStopPolicy)stopPolicy {
-    auto c = [user configurationWithURL:url fullSynchronization:!self.isPartial];
-    c.encryptionKey = encryptionKey;
-    RLMSyncConfiguration *syncConfig = c.syncConfiguration;
-    syncConfig.stopPolicy = stopPolicy;
-    c.syncConfiguration = syncConfig;
-    return [RLMRealm realmWithConfiguration:c error:nil];
-}
-
-- (RLMSyncUser *)logInUserForCredentials:(RLMSyncCredentials *)credentials
-                                  server:(NSURL *)url {
-    NSString *process = self.isParent ? @"parent" : @"child";
-    __block RLMSyncUser *theUser = nil;
-    XCTestExpectation *expectation = [self expectationWithDescription:@"Should log in the user properly"];
-    [RLMSyncUser logInWithCredentials:credentials
-                        authServerURL:url
-                         onCompletion:^(RLMSyncUser *user, NSError *error) {
-                             XCTAssertTrue(NSThread.isMainThread);
-                             XCTAssertNil(error,
-                                          @"Error when trying to log in a user: %@ (process: %@)",
-                                          error, process);
-                             XCTAssertNotNil(user);
-                             theUser = user;
-                             [expectation fulfill];
-                         }];
-    [self waitForExpectationsWithTimeout:4.0 handler:nil];
-    XCTAssertTrue(theUser.state == RLMSyncUserStateActive,
-                  @"User should have been valid, but wasn't. (process: %@)", process);
-    return theUser;
-}
-
-- (RLMSyncUser *)createAdminUserForURL:(NSURL *)url username:(NSString *)username {
-    return [self logInUserForCredentials:[RLMSyncCredentials credentialsWithDebugUserID:username isAdmin:YES]
-                                  server:url];
-}
-
-- (NSString *)adminToken {
-    NSURL *target = [RealmObjectServer.sharedServer.serverDataRoot
-                     URLByAppendingPathComponent:@"/keys/admin.json"];
-    if (![[NSFileManager defaultManager] fileExistsAtPath:[target path]]) {
-        XCTFail(@"Could not find the JSON file containing the admin token.");
-        return nil;
-    }
-    NSData *raw = [NSData dataWithContentsOfURL:target];
-    NSDictionary *json = [NSJSONSerialization JSONObjectWithData:raw options:0 error:nil];
-    NSString *token = json[@"ADMIN_TOKEN"];
-    if ([token length] == 0) {
-        XCTFail(@"Could not successfully extract the token.");
-    }
-    return token;
-}
-
-- (NSString *)emailForAddress:(NSString *)email {
-    NSURL *target = [[RealmObjectServer.sharedServer.serverDataRoot
-                     URLByAppendingPathComponent:@"/email"]
-                     URLByAppendingPathComponent:email];
-    NSString *body = [NSString stringWithContentsOfURL:target encoding:NSUTF8StringEncoding error:nil];
-    if (body) {
-        [NSFileManager.defaultManager removeItemAtURL:target error:nil];
-    }
-    return body;
-}
-
-- (void)waitForDownloadsForRealm:(RLMRealm *)realm {
-    [self waitForDownloadsForRealm:realm error:nil];
-}
-
-- (void)waitForUploadsForRealm:(RLMRealm *)realm {
-    [self waitForUploadsForRealm:realm error:nil];
-}
-
-- (void)waitForDownloadsForUser:(RLMSyncUser *)user
-                            url:(NSURL *)url
-                    expectation:(XCTestExpectation *)expectation
-                          error:(NSError **)error {
-    RLMSyncSession *session = [user sessionForURL:url];
-    NSAssert(session, @"Cannot call with invalid URL");
-    XCTestExpectation *ex = expectation ?: [self expectationWithDescription:@"Wait for download completion"];
-    __block NSError *theError = nil;
-    BOOL queued = [session waitForDownloadCompletionOnQueue:nil callback:^(NSError *err) {
-        theError = err;
-        [ex fulfill];
-    }];
-    if (!queued) {
-        XCTFail(@"Download waiter did not queue; session was invalid or errored out.");
-        return;
-    }
-    [self waitForExpectations:@[ex] timeout:20.0];
-    if (error) {
-        *error = theError;
-    }
-}
-
-- (void)waitForUploadsForRealm:(RLMRealm *)realm error:(NSError **)error {
-    RLMSyncSession *session = realm.syncSession;
-    NSAssert(session, @"Cannot call with invalid Realm");
-    XCTestExpectation *ex = [self expectationWithDescription:@"Wait for upload completion"];
-    __block NSError *completionError;
-    BOOL queued = [session waitForUploadCompletionOnQueue:nil callback:^(NSError *error) {
-        completionError = error;
-        [ex fulfill];
-    }];
-    if (!queued) {
-        XCTFail(@"Upload waiter did not queue; session was invalid or errored out.");
-        return;
-    }
-    [self waitForExpectations:@[ex] timeout:20.0];
-    if (error)
-        *error = completionError;
-}
-
-- (void)waitForDownloadsForRealm:(RLMRealm *)realm error:(NSError **)error {
-    RLMSyncSession *session = realm.syncSession;
-    NSAssert(session, @"Cannot call with invalid Realm");
-    XCTestExpectation *ex = [self expectationWithDescription:@"Wait for download completion"];
-    __block NSError *completionError;
-    BOOL queued = [session waitForDownloadCompletionOnQueue:nil callback:^(NSError *error) {
-        completionError = error;
-        [ex fulfill];
-    }];
-    if (!queued) {
-        XCTFail(@"Download waiter did not queue; session was invalid or errored out.");
-        return;
-    }
-    [self waitForExpectations:@[ex] timeout:20.0];
-    if (error)
-        *error = completionError;
-}
-
-- (void)manuallySetRefreshTokenForUser:(RLMSyncUser *)user value:(NSString *)tokenValue {
-    [user _syncUser]->update_refresh_token(tokenValue.UTF8String);
-}
-
-// FIXME: remove this API once the new token system is implemented.
-- (void)primeSyncManagerWithSemaphore:(dispatch_semaphore_t)semaphore {
-    if (semaphore == nil) {
-        [[RLMSyncManager sharedManager] setSessionCompletionNotifier:^(__unused NSError *error){ }];
-        return;
-    }
-    [[RLMSyncManager sharedManager] setSessionCompletionNotifier:^(NSError *error) {
-        XCTAssertNil(error, @"Session completion block returned with an error: %@", error);
-        dispatch_semaphore_signal(semaphore);
-    }];
-}
-
-#pragma mark - XCUnitTest Lifecycle
-
-- (void)setUp {
-    [super setUp];
-    self.continueAfterFailure = NO;
-
-    REALM_ASSERT(RLMSyncManager.sharedManager._allUsers.count == 0);
-    [RLMSyncManager resetForTesting];
-
-    [self setupSyncManager];
-}
-
-- (void)tearDown {
-    [self resetSyncManager];
-    [super tearDown];
-}
-
-- (void)setupSyncManager {
-    NSURL *clientDataRoot;
-    if (self.isParent) {
-        [RealmObjectServer.sharedServer launch];
-        clientDataRoot = [NSURL fileURLWithPath:RLMDefaultDirectoryForBundleIdentifier(nil)];
-    }
-    else {
-        clientDataRoot = syncDirectoryForChildProcess();
-    }
-
-    NSError *error;
-    [NSFileManager.defaultManager removeItemAtURL:clientDataRoot error:&error];
-    [NSFileManager.defaultManager createDirectoryAtURL:clientDataRoot
-                           withIntermediateDirectories:YES attributes:nil error:&error];
-    RLMSyncManager *syncManager = RLMSyncManager.sharedManager;
-    [syncManager configureWithRootDirectory:clientDataRoot];
-    syncManager.logLevel = RLMSyncLogLevelOff;
-    syncManager.userAgent = self.name;
-}
-
-- (void)resetSyncManager {
-    NSMutableArray *expectations = [NSMutableArray new];
-    for (RLMSyncUser *user in RLMSyncManager.sharedManager._allUsers) {
-        [user logOut];
-        // Sessions are removed from the user asynchronously after a logout.
-        // We need to wait for this to happen before calling resetForTesting as
-        // that expects all sessions to be cleaned up first. This doesn't apply
-        // to admin token users, which don't logout at all (and don't have an
-        // auth server).
-        if (user.authenticationServer && user.allSessions.count) {
-            [expectations addObject:[self expectationForPredicate:[NSPredicate predicateWithFormat:@"allSessions.@count == 0"]
-                                              evaluatedWithObject:user handler:nil]];
-        }
-    }
-    [self waitForExpectations:expectations timeout:5.0];
-    [RLMSyncManager resetForTesting];
-    [RLMSyncSessionRefreshHandle calculateFireDateUsingTestLogic:NO blockOnRefreshCompletion:nil];
-}
-
-@end

+ 0 - 32
Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/RLMSyncUser+ObjectServerTests.h

@@ -1,32 +0,0 @@
-////////////////////////////////////////////////////////////////////////////
-//
-// Copyright 2016 Realm Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////
-
-#import <Realm/Realm.h>
-
-NS_ASSUME_NONNULL_BEGIN
-
-@interface RLMSyncUser (ObjectServerTests)
-
-- (BOOL)waitForUploadToFinish:(NSURL *)url;
-- (BOOL)waitForDownloadToFinish:(NSURL *)url;
-
-- (void)simulateClientResetErrorForSession:(NSURL *)url;
-
-@end
-
-NS_ASSUME_NONNULL_END

+ 0 - 72
Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/RLMSyncUser+ObjectServerTests.mm

@@ -1,72 +0,0 @@
-////////////////////////////////////////////////////////////////////////////
-//
-// Copyright 2016 Realm Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////
-
-#import "RLMSyncUser+ObjectServerTests.h"
-
-#import "RLMSyncSession_Private.hpp"
-#import "RLMRealmUtil.hpp"
-
-#import "sync/sync_session.hpp"
-
-using namespace realm;
-
-@implementation RLMSyncUser (ObjectServerTests)
-
-- (BOOL)waitForUploadToFinish:(NSURL *)url {
-    const NSTimeInterval timeout = 20;
-    dispatch_semaphore_t sema = dispatch_semaphore_create(0);
-    RLMSyncSession *session = [self sessionForURL:url];
-    NSAssert(session, @"Cannot call with invalid URL");
-    BOOL couldWait = [session waitForUploadCompletionOnQueue:dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0)
-                                                    callback:^(NSError *){
-                                                        dispatch_semaphore_signal(sema);
-                                                    }];
-    if (!couldWait) {
-        return NO;
-    }
-    return dispatch_semaphore_wait(sema, dispatch_time(DISPATCH_TIME_NOW, (int64_t)(timeout * NSEC_PER_SEC))) == 0;
-}
-
-- (BOOL)waitForDownloadToFinish:(NSURL *)url {
-    const NSTimeInterval timeout = 20;
-    dispatch_semaphore_t sema = dispatch_semaphore_create(0);
-    RLMSyncSession *session = [self sessionForURL:url];
-    NSAssert(session, @"Cannot call with invalid URL");
-    BOOL couldWait = [session waitForDownloadCompletionOnQueue:dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0)
-                                                      callback:^(NSError *){
-                                                          dispatch_semaphore_signal(sema);
-                                                      }];
-    if (!couldWait) {
-        return NO;
-    }
-    return dispatch_semaphore_wait(sema, dispatch_time(DISPATCH_TIME_NOW, (int64_t)(timeout * NSEC_PER_SEC))) == 0;
-}
-
-- (void)simulateClientResetErrorForSession:(NSURL *)url {
-    RLMSyncSession *session = [self sessionForURL:url];
-    NSAssert(session, @"Cannot call with invalid URL");
-
-    std::shared_ptr<SyncSession> raw_session = session->_session.lock();
-    std::error_code code = std::error_code{
-        static_cast<int>(realm::sync::ProtocolError::bad_client_file_ident),
-        realm::sync::protocol_error_category()
-    };
-    SyncSession::OnlyForTesting::handle_error(*raw_session, {code, "Not a real error message", false});
-}
-
-@end

+ 0 - 26
Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/RLMTestUtils.h

@@ -1,26 +0,0 @@
-////////////////////////////////////////////////////////////////////////////
-//
-// Copyright 2016 Realm Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////
-
-void RLMSwapOutClassMethod(id classObject, SEL original, SEL swizzled);
-void RLMSwapOutInstanceMethod(id classObject, SEL original, SEL swizzled);
-
-#ifndef CUSTOM_REALM_URL
-#define CUSTOM_REALM_URL(realm_identifier) \
-[NSURL URLWithString:[NSString stringWithFormat:@"realm://127.0.0.1:9080/~/%@%@", NSStringFromSelector(_cmd), realm_identifier]]
-#define REALM_URL() CUSTOM_REALM_URL(@"")
-#endif

+ 0 - 53
Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/RLMTestUtils.m

@@ -1,53 +0,0 @@
-////////////////////////////////////////////////////////////////////////////
-//
-// Copyright 2016 Realm Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////
-
-#import <Foundation/Foundation.h>
-
-#import "RLMTestUtils.h"
-
-#import <objc/runtime.h>
-
-static void RLMSwapOutMethod(Class class,
-                             SEL original, Method originalMethod,
-                             SEL swizzled, Method swizzledMethod) {
-    if (class_addMethod(class,
-                        original,
-                        method_getImplementation(swizzledMethod),
-                        method_getTypeEncoding(swizzledMethod))) {
-        class_replaceMethod(class,
-                            swizzled,
-                            method_getImplementation(originalMethod),
-                            method_getTypeEncoding(originalMethod));
-    } else {
-        method_exchangeImplementations(originalMethod, swizzledMethod);
-    }
-}
-
-void RLMSwapOutClassMethod(id classObject, SEL original, SEL swizzled) {
-    Class class = object_getClass((id)classObject);
-    RLMSwapOutMethod(class,
-                     original, class_getClassMethod(class, original),
-                     swizzled, class_getClassMethod(class, swizzled));
-}
-
-void RLMSwapOutInstanceMethod(id classObject, SEL original, SEL swizzled) {
-    Class class = [classObject class];
-    RLMSwapOutMethod(class,
-                     original, class_getInstanceMethod(class, original),
-                     swizzled, class_getInstanceMethod(class, swizzled));
-}

+ 0 - 587
Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/SwiftObjectServerTests.swift

@@ -1,587 +0,0 @@
-////////////////////////////////////////////////////////////////////////////
-//
-// Copyright 2016 Realm Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////
-
-import XCTest
-import RealmSwift
-
-// Used by testOfflineClientReset
-// The naming here is nonstandard as the sync-1.x.realm test file comes from the .NET unit tests.
-// swiftlint:disable identifier_name
-@objc(Person)
-class Person: Object {
-    @objc dynamic var FirstName: String?
-    @objc dynamic var LastName: String?
-
-    override class func shouldIncludeInDefaultSchema() -> Bool { return false }
-}
-
-class SwiftObjectServerTests: SwiftSyncTestCase {
-
-    /// It should be possible to successfully open a Realm configured for sync.
-    func testBasicSwiftSync() {
-        let url = URL(string: "realm://127.0.0.1:9080/~/testBasicSync")!
-        do {
-            let user = try synchronouslyLogInUser(for: basicCredentials(register: true), server: authURL)
-            let realm = try synchronouslyOpenRealm(url: url, user: user)
-            XCTAssert(realm.isEmpty, "Freshly synced Realm was not empty...")
-        } catch {
-            XCTFail("Got an error: \(error)")
-        }
-    }
-
-    /// If client B adds objects to a Realm, client A should see those new objects.
-    func testSwiftAddObjects() {
-        do {
-            let user = try synchronouslyLogInUser(for: basicCredentials(register: isParent), server: authURL)
-            let realm = try synchronouslyOpenRealm(url: realmURL, user: user)
-            if isParent {
-                waitForDownloads(for: realm)
-                checkCount(expected: 0, realm, SwiftSyncObject.self)
-                executeChild()
-                waitForDownloads(for: realm)
-                checkCount(expected: 3, realm, SwiftSyncObject.self)
-            } else {
-                // Add objects
-                try realm.write {
-                    realm.add(SwiftSyncObject(value: ["child-1"]))
-                    realm.add(SwiftSyncObject(value: ["child-2"]))
-                    realm.add(SwiftSyncObject(value: ["child-3"]))
-                }
-                waitForUploads(for: realm)
-                checkCount(expected: 3, realm, SwiftSyncObject.self)
-            }
-        } catch {
-            XCTFail("Got an error: \(error) (process: \(isParent ? "parent" : "child"))")
-        }
-    }
-
-    /// If client B removes objects from a Realm, client A should see those changes.
-    func testSwiftDeleteObjects() {
-        do {
-            let user = try synchronouslyLogInUser(for: basicCredentials(register: isParent), server: authURL)
-            let realm = try synchronouslyOpenRealm(url: realmURL, user: user)
-            if isParent {
-                try realm.write {
-                    realm.add(SwiftSyncObject(value: ["child-1"]))
-                    realm.add(SwiftSyncObject(value: ["child-2"]))
-                    realm.add(SwiftSyncObject(value: ["child-3"]))
-                }
-                waitForUploads(for: realm)
-                checkCount(expected: 3, realm, SwiftSyncObject.self)
-                executeChild()
-                waitForDownloads(for: realm)
-                checkCount(expected: 0, realm, SwiftSyncObject.self)
-            } else {
-                try realm.write {
-                    realm.deleteAll()
-                }
-                waitForUploads(for: realm)
-                checkCount(expected: 0, realm, SwiftSyncObject.self)
-            }
-        } catch {
-            XCTFail("Got an error: \(error) (process: \(isParent ? "parent" : "child"))")
-        }
-    }
-
-    func testConnectionState() {
-        let user = try! synchronouslyLogInUser(for: basicCredentials(register: true), server: authURL)
-        let realm = try! synchronouslyOpenRealm(url: realmURL, user: user)
-        let session = realm.syncSession!
-
-        func wait(forState desiredState: SyncSession.ConnectionState) {
-            let ex = expectation(description: "Wait for connection state: \(desiredState)")
-            let token = session.observe(\SyncSession.connectionState, options: .initial) { s, _ in
-                if s.connectionState == desiredState {
-                    ex.fulfill()
-                }
-            }
-            waitForExpectations(timeout: 2.0)
-            token.invalidate()
-        }
-
-        wait(forState: .connected)
-
-        session.suspend()
-        wait(forState: .disconnected)
-
-        session.resume()
-        wait(forState: .connecting)
-        wait(forState: .connected)
-    }
-
-    // MARK: - Client reset
-
-    func testClientReset() {
-        do {
-            let user = try synchronouslyLogInUser(for: basicCredentials(register: isParent), server: authURL)
-            let realm = try synchronouslyOpenRealm(url: realmURL, user: user)
-
-            var theError: SyncError?
-            let ex = expectation(description: "Waiting for error handler to be called...")
-            SyncManager.shared.errorHandler = { (error, session) in
-                if let error = error as? SyncError {
-                    theError = error
-                } else {
-                    XCTFail("Error \(error) was not a sync error. Something is wrong.")
-                }
-                ex.fulfill()
-            }
-            user.simulateClientResetError(forSession: realmURL)
-            waitForExpectations(timeout: 10, handler: nil)
-            XCTAssertNotNil(theError)
-            XCTAssertTrue(theError!.code == SyncError.Code.clientResetError)
-            let resetInfo = theError!.clientResetInfo()
-            XCTAssertNotNil(resetInfo)
-            XCTAssertTrue(resetInfo!.0.contains("io.realm.object-server-recovered-realms/recovered_realm"))
-            XCTAssertNotNil(realm)
-        } catch {
-            XCTFail("Got an error: \(error) (process: \(isParent ? "parent" : "child"))")
-        }
-    }
-
-    func testClientResetManualInitiation() {
-        do {
-            let user = try synchronouslyLogInUser(for: basicCredentials(register: isParent), server: authURL)
-            var theError: SyncError?
-
-            try autoreleasepool {
-                let realm = try synchronouslyOpenRealm(url: realmURL, user: user)
-                let ex = expectation(description: "Waiting for error handler to be called...")
-                SyncManager.shared.errorHandler = { (error, session) in
-                    if let error = error as? SyncError {
-                        theError = error
-                    } else {
-                        XCTFail("Error \(error) was not a sync error. Something is wrong.")
-                    }
-                    ex.fulfill()
-                }
-                user.simulateClientResetError(forSession: realmURL)
-                waitForExpectations(timeout: 10, handler: nil)
-                XCTAssertNotNil(theError)
-                XCTAssertNotNil(realm)
-            }
-            let (path, errorToken) = theError!.clientResetInfo()!
-            XCTAssertFalse(FileManager.default.fileExists(atPath: path))
-            SyncSession.immediatelyHandleError(errorToken)
-            XCTAssertTrue(FileManager.default.fileExists(atPath: path))
-        } catch {
-            XCTFail("Got an error: \(error) (process: \(isParent ? "parent" : "child"))")
-        }
-    }
-
-    // MARK: - Progress notifiers
-
-    let bigObjectCount = 2
-
-    func populateRealm(user: SyncUser, url: URL) {
-        let realm = try! synchronouslyOpenRealm(url: realmURL, user: user)
-        try! realm.write {
-            for _ in 0..<bigObjectCount {
-                realm.add(SwiftHugeSyncObject())
-            }
-        }
-        waitForUploads(for: realm)
-        checkCount(expected: bigObjectCount, realm, SwiftHugeSyncObject.self)
-    }
-
-    func testStreamingDownloadNotifier() {
-        let user = try! synchronouslyLogInUser(for: basicCredentials(register: isParent), server: authURL)
-        if !isParent {
-            populateRealm(user: user, url: realmURL)
-            return
-        }
-
-        var callCount = 0
-        var transferred = 0
-        var transferrable = 0
-        let realm = try! synchronouslyOpenRealm(url: realmURL, user: user)
-
-        let session = realm.syncSession
-        XCTAssertNotNil(session)
-        let ex = expectation(description: "streaming-downloads-expectation")
-        var hasBeenFulfilled = false
-        let token = session!.addProgressNotification(for: .download, mode: .reportIndefinitely) { p in
-            callCount += 1
-            XCTAssert(p.transferredBytes >= transferred)
-            XCTAssert(p.transferrableBytes >= transferrable)
-            transferred = p.transferredBytes
-            transferrable = p.transferrableBytes
-            if p.transferredBytes > 0 && p.isTransferComplete && !hasBeenFulfilled {
-                ex.fulfill()
-                hasBeenFulfilled = true
-            }
-        }
-
-        // Wait for the child process to upload all the data.
-        executeChild()
-
-        waitForExpectations(timeout: 10.0, handler: nil)
-        token!.invalidate()
-        XCTAssert(callCount > 1)
-        XCTAssert(transferred >= transferrable)
-    }
-
-    func testStreamingUploadNotifier() {
-        do {
-            var transferred = 0
-            var transferrable = 0
-            let user = try synchronouslyLogInUser(for: basicCredentials(register: isParent), server: authURL)
-            let realm = try synchronouslyOpenRealm(url: realmURL, user: user)
-            let session = realm.syncSession
-            XCTAssertNotNil(session)
-            var ex = expectation(description: "initial upload")
-            let token = session!.addProgressNotification(for: .upload, mode: .reportIndefinitely) { p in
-                XCTAssert(p.transferredBytes >= transferred)
-                XCTAssert(p.transferrableBytes >= transferrable)
-                transferred = p.transferredBytes
-                transferrable = p.transferrableBytes
-                if p.transferredBytes > 0 && p.isTransferComplete {
-                    ex.fulfill()
-                }
-            }
-            waitForExpectations(timeout: 10.0, handler: nil)
-            ex = expectation(description: "write transaction upload")
-            try realm.write {
-                for _ in 0..<bigObjectCount {
-                    realm.add(SwiftHugeSyncObject())
-                }
-            }
-            waitForExpectations(timeout: 10.0, handler: nil)
-            token!.invalidate()
-            XCTAssert(transferred >= transferrable)
-        } catch {
-            XCTFail("Got an error: \(error) (process: \(isParent ? "parent" : "child"))")
-        }
-    }
-
-    // MARK: - Download Realm
-
-    func testDownloadRealm() {
-        let user = try! synchronouslyLogInUser(for: basicCredentials(register: isParent), server: authURL)
-        if !isParent {
-            populateRealm(user: user, url: realmURL)
-            return
-        }
-
-        // Wait for the child process to upload everything.
-        executeChild()
-
-        let ex = expectation(description: "download-realm")
-        let config = user.configuration(realmURL: realmURL, fullSynchronization: true)
-        let pathOnDisk = ObjectiveCSupport.convert(object: config).pathOnDisk
-        XCTAssertFalse(FileManager.default.fileExists(atPath: pathOnDisk))
-        Realm.asyncOpen(configuration: config) { realm, error in
-            XCTAssertNil(error)
-            self.checkCount(expected: self.bigObjectCount, realm!, SwiftHugeSyncObject.self)
-            ex.fulfill()
-        }
-        func fileSize(path: String) -> Int {
-            if let attr = try? FileManager.default.attributesOfItem(atPath: path) {
-                return attr[.size] as! Int
-            }
-            return 0
-        }
-        XCTAssertFalse(RLMHasCachedRealmForPath(pathOnDisk))
-        waitForExpectations(timeout: 10.0, handler: nil)
-        XCTAssertGreaterThan(fileSize(path: pathOnDisk), 0)
-        XCTAssertFalse(RLMHasCachedRealmForPath(pathOnDisk))
-    }
-
-    func testDownloadRealmToCustomPath() {
-        let user = try! synchronouslyLogInUser(for: basicCredentials(register: isParent), server: authURL)
-        if !isParent {
-            populateRealm(user: user, url: realmURL)
-            return
-        }
-
-        // Wait for the child process to upload everything.
-        executeChild()
-
-        let ex = expectation(description: "download-realm")
-        let customFileURL = realmURLForFile("copy")
-        var config = user.configuration(realmURL: realmURL, fullSynchronization: true)
-        config.fileURL = customFileURL
-        let pathOnDisk = ObjectiveCSupport.convert(object: config).pathOnDisk
-        XCTAssertEqual(pathOnDisk, customFileURL.path)
-        XCTAssertFalse(FileManager.default.fileExists(atPath: pathOnDisk))
-        Realm.asyncOpen(configuration: config) { realm, error in
-            XCTAssertNil(error)
-            self.checkCount(expected: self.bigObjectCount, realm!, SwiftHugeSyncObject.self)
-            ex.fulfill()
-        }
-        func fileSize(path: String) -> Int {
-            if let attr = try? FileManager.default.attributesOfItem(atPath: path) {
-                return attr[.size] as! Int
-            }
-            return 0
-        }
-        XCTAssertFalse(RLMHasCachedRealmForPath(pathOnDisk))
-        waitForExpectations(timeout: 10.0, handler: nil)
-        XCTAssertGreaterThan(fileSize(path: pathOnDisk), 0)
-        XCTAssertFalse(RLMHasCachedRealmForPath(pathOnDisk))
-    }
-
-
-    func testCancelDownloadRealm() {
-        let user = try! synchronouslyLogInUser(for: basicCredentials(register: isParent), server: authURL)
-        if !isParent {
-            populateRealm(user: user, url: realmURL)
-            return
-        }
-
-        // Wait for the child process to upload everything.
-        executeChild()
-
-        // Use a serial queue for asyncOpen to ensure that the first one adds
-        // the completion block before the second one cancels it
-        RLMSetAsyncOpenQueue(DispatchQueue(label: "io.realm.asyncOpen"))
-
-        let ex = expectation(description: "async open")
-        let config = user.configuration(realmURL: realmURL, fullSynchronization: true)
-        Realm.asyncOpen(configuration: config) { _, error in
-            XCTAssertNotNil(error)
-            ex.fulfill()
-        }
-        let task = Realm.asyncOpen(configuration: config) { _, _ in
-            XCTFail("Cancelled completion handler was called")
-        }
-        task.cancel()
-        waitForExpectations(timeout: 10.0, handler: nil)
-    }
-
-    func testAsyncOpenProgress() {
-        let user = try! synchronouslyLogInUser(for: basicCredentials(register: isParent), server: authURL)
-        if !isParent {
-            populateRealm(user: user, url: realmURL)
-            return
-        }
-
-        // Wait for the child process to upload everything.
-        executeChild()
-
-        let ex1 = expectation(description: "async open")
-        let ex2 = expectation(description: "download progress")
-        let config = user.configuration(realmURL: realmURL, fullSynchronization: true)
-        let task = Realm.asyncOpen(configuration: config) { _, error in
-            XCTAssertNil(error)
-            ex1.fulfill()
-        }
-        task.addProgressNotification { progress in
-            if progress.isTransferComplete {
-                ex2.fulfill()
-            }
-        }
-        waitForExpectations(timeout: 10.0, handler: nil)
-    }
-
-    func testAsyncOpenTimeout() {
-        let syncTimeoutOptions = SyncTimeoutOptions()
-        syncTimeoutOptions.connectTimeout = 3000
-        SyncManager.shared.timeoutOptions = syncTimeoutOptions
-
-        // The server proxy adds a 2 second delay, so a 3 second timeout should succeed
-        autoreleasepool {
-            let user = try! synchronouslyLogInUser(for: basicCredentials(register: true), server: slowConnectAuthURL)
-            let config = user.configuration(cancelAsyncOpenOnNonFatalErrors: true)
-            let ex = expectation(description: "async open")
-            Realm.asyncOpen(configuration: config) { _, error in
-                XCTAssertNil(error)
-                ex.fulfill()
-            }
-            waitForExpectations(timeout: 10.0, handler: nil)
-            user.logOut()
-        }
-
-        self.resetSyncManager()
-        self.setupSyncManager()
-
-        // and a 1 second timeout should fail
-        autoreleasepool {
-            let user = try! synchronouslyLogInUser(for: basicCredentials(register: true), server: slowConnectAuthURL)
-            let config = user.configuration(cancelAsyncOpenOnNonFatalErrors: true)
-
-            syncTimeoutOptions.connectTimeout = 1000
-            SyncManager.shared.timeoutOptions = syncTimeoutOptions
-
-            let ex = expectation(description: "async open")
-            Realm.asyncOpen(configuration: config) { _, error in
-                XCTAssertNotNil(error)
-                if let error = error as NSError? {
-                    XCTAssertEqual(error.code, Int(ETIMEDOUT))
-                    XCTAssertEqual(error.domain, NSPOSIXErrorDomain)
-                }
-                ex.fulfill()
-            }
-            waitForExpectations(timeout: 4.0, handler: nil)
-        }
-    }
-
-    // MARK: - Administration
-
-    func testRetrieveUserInfo() {
-        let adminUsername = "jyaku.swift"
-        let nonAdminUsername = "meela.swift@realm.example.org"
-        let password = "p"
-        let server = SwiftObjectServerTests.authServerURL()
-
-        // Create a non-admin user.
-        _ = logInUser(for: .init(username: nonAdminUsername, password: password, register: true),
-                      server: server)
-        // Create an admin user.
-        let adminUser = createAdminUser(for: server, username: adminUsername)
-
-        // Look up information about the non-admin user from the admin user.
-        let ex = expectation(description: "Should be able to look up user information")
-        adminUser.retrieveInfo(forUser: nonAdminUsername, identityProvider: .usernamePassword) { (userInfo, err) in
-            XCTAssertNil(err)
-            XCTAssertNotNil(userInfo)
-            guard let userInfo = userInfo else {
-                return
-            }
-            let account = userInfo.accounts.first!
-            XCTAssertEqual(account.providerUserIdentity, nonAdminUsername)
-            XCTAssertEqual(account.provider, Provider.usernamePassword)
-            XCTAssertFalse(userInfo.isAdmin)
-            ex.fulfill()
-        }
-        waitForExpectations(timeout: 10.0, handler: nil)
-    }
-
-    // MARK: - Authentication
-
-    func testInvalidCredentials() {
-        do {
-            let username = "testInvalidCredentialsUsername"
-            let credentials = SyncCredentials.usernamePassword(username: username,
-                                                               password: "THIS_IS_A_PASSWORD",
-                                                               register: true)
-            _ = try synchronouslyLogInUser(for: credentials, server: authURL)
-            // Now log in the same user, but with a bad password.
-            let ex = expectation(description: "wait for user login")
-            let credentials2 = SyncCredentials.usernamePassword(username: username, password: "NOT_A_VALID_PASSWORD")
-            SyncUser.logIn(with: credentials2, server: authURL) { user, error in
-                XCTAssertNil(user)
-                XCTAssertTrue(error is SyncAuthError)
-                let castError = error as! SyncAuthError
-                XCTAssertEqual(castError.code, SyncAuthError.invalidCredential)
-                ex.fulfill()
-            }
-            waitForExpectations(timeout: 2.0, handler: nil)
-        } catch {
-            XCTFail("Got an error: \(error) (process: \(isParent ? "parent" : "child"))")
-        }
-    }
-
-    // MARK: - User-specific functionality
-
-    func testUserExpirationCallback() {
-        do {
-            let user = try synchronouslyLogInUser(for: basicCredentials(), server: authURL)
-
-            // Set a callback on the user
-            var blockCalled = false
-            let ex = expectation(description: "Error callback should fire upon receiving an error")
-            user.errorHandler = { (u, error) in
-                XCTAssertEqual(u.identity, user.identity)
-                XCTAssertEqual(error.code, .accessDeniedOrInvalidPath)
-                blockCalled = true
-                ex.fulfill()
-            }
-
-            // Screw up the token on the user.
-            manuallySetRefreshToken(for: user, value: "not-a-real-token")
-
-            // Try to open a Realm with the user; this will cause our errorHandler block defined above to be fired.
-            XCTAssertFalse(blockCalled)
-            _ = try immediatelyOpenRealm(url: realmURL, user: user)
-            waitForExpectations(timeout: 10.0, handler: nil)
-            XCTAssertEqual(user.state, .loggedOut)
-        } catch {
-            XCTFail("Got an error: \(error) (process: \(isParent ? "parent" : "child"))")
-        }
-    }
-
-    // MARK: - Certificate Pinning
-
-    func testSecureConnectionToLocalhostWithDefaultSecurity() {
-        let user = try! synchronouslyLogInUser(for: basicCredentials(), server: authURL)
-        let config = user.configuration(realmURL: URL(string: "realms://localhost:9443/~/default"),
-                                        serverValidationPolicy: .system)
-
-        let ex = expectation(description: "Waiting for error handler to be called")
-        SyncManager.shared.errorHandler = { (error, session) in
-            ex.fulfill()
-        }
-
-        _ = try! Realm(configuration: config)
-        self.waitForExpectations(timeout: 4.0)
-    }
-
-    func testSecureConnectionToLocalhostWithValidationDisabled() {
-        let user = try! synchronouslyLogInUser(for: basicCredentials(), server: authURL)
-        let config = user.configuration(realmURL: URL(string: "realms://localhost:9443/~/default"),
-                                        serverValidationPolicy: .none)
-        SyncManager.shared.errorHandler = { (error, session) in
-            XCTFail("Unexpected connection failure: \(error)")
-        }
-
-        let realm = try! Realm(configuration: config)
-        self.waitForUploads(for: realm)
-    }
-
-    func testSecureConnectionToLocalhostWithPinnedCertificate() {
-        let user = try! synchronouslyLogInUser(for: basicCredentials(), server: authURL)
-        let certURL = URL(string: #file)!
-            .deletingLastPathComponent()
-            .appendingPathComponent("certificates")
-            .appendingPathComponent("localhost.cer")
-
-        let config = user.configuration(realmURL: URL(string: "realms://localhost:9443/~/default"),
-                                        serverValidationPolicy: .pinCertificate(path: certURL))
-        SyncManager.shared.errorHandler = { (error, session) in
-            XCTFail("Unexpected connection failure: \(error)")
-        }
-
-        let realm = try! Realm(configuration: config)
-        self.waitForUploads(for: realm)
-    }
-
-    func testSecureConnectionToLocalhostWithIncorrectPinnedCertificate() {
-        let user = try! synchronouslyLogInUser(for: basicCredentials(), server: authURL)
-        let certURL = URL(string: #file)!
-            .deletingLastPathComponent()
-            .appendingPathComponent("certificates")
-            .appendingPathComponent("localhost-other.cer")
-        let config = user.configuration(realmURL: URL(string: "realms://localhost:9443/~/default"),
-                                        serverValidationPolicy: .pinCertificate(path: certURL))
-
-        let ex = expectation(description: "Waiting for error handler to be called")
-        SyncManager.shared.errorHandler = { (error, session) in
-            ex.fulfill()
-        }
-
-        _ = try! Realm(configuration: config)
-        self.waitForExpectations(timeout: 4.0)
-    }
-
-    private func realmURLForFile(_ fileName: String) -> URL {
-        let testDir = RLMRealmPathForFile("realm-object-server")
-        let directory = URL(fileURLWithPath: testDir, isDirectory: true)
-        return directory.appendingPathComponent(fileName, isDirectory: false)
-    }
-}

+ 0 - 227
Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/SwiftPermissionsAPITests.swift

@@ -1,227 +0,0 @@
-////////////////////////////////////////////////////////////////////////////
-//
-// Copyright 2017 Realm Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////
-
-import XCTest
-import RealmSwift
-
-class SwiftRealmPermissionsAPITests: SwiftSyncTestCase {
-    var userA: SyncUser!
-    var userB: SyncUser!
-    var userC: SyncUser!
-
-    override func setUp() {
-        super.setUp()
-        let baseName = UUID().uuidString
-        userA = try! synchronouslyLogInUser(for: .usernamePassword(username: baseName + "a", password: "a", register: true),
-                                            server: SwiftSyncTestCase.authServerURL())
-        userB = try! synchronouslyLogInUser(for: .usernamePassword(username: baseName + "b", password: "a", register: true),
-                                            server: SwiftSyncTestCase.authServerURL())
-        userC = try! synchronouslyLogInUser(for: .usernamePassword(username: baseName + "c", password: "a", register: true),
-                                            server: SwiftSyncTestCase.authServerURL())
-    }
-
-    override func tearDown() {
-        userA.logOut()
-        userB.logOut()
-        userC.logOut()
-        super.tearDown()
-    }
-
-    /// Ensure the absence of a permission from a results after an elapsed time interval.
-    /// This method is intended to be used to check that a permission never becomes
-    /// present within a results to begin with.
-    private func ensureAbsence(of permission: SyncPermission,
-                               from results: SyncPermissionResults,
-                               after wait: Double = 0.5,
-                               file: StaticString = #file,
-                               line: UInt = #line) {
-    }
-
-    private func tildeSubstitutedURL(for url: URL, user: SyncUser) -> URL {
-        XCTAssertNotNil(user.identity)
-        let identity = user.identity!
-        return URL(string: url.absoluteString.replacingOccurrences(of: "~", with: identity))!
-    }
-
-    /// Setting a permission should work, and then that permission should be able to be retrieved.
-    func testSettingPermissions() {
-        // First, there should be no permissions.
-        let ex = expectation(description: "No permissions for newly created user.")
-        userB.retrievePermissions { (r, error) in
-            XCTAssertNil(error)
-            XCTAssertNotNil(r)
-            XCTAssertEqual(r!.count, 0)
-            ex.fulfill()
-        }
-        waitForExpectations(timeout: 2.0, handler: nil)
-
-        // Open a Realm for user A.
-        let uuid = UUID().uuidString
-        let url = SwiftSyncTestCase.uniqueRealmURL(customName: uuid)
-        _ = try! synchronouslyOpenRealm(url: url, user: userA)
-
-        // Give user B read permissions to that Realm.
-        let p = SyncPermission(realmPath: tildeSubstitutedURL(for: url, user: userA).path,
-                               identity: userB.identity!,
-                               accessLevel: .read)
-
-        // Set the permission.
-        let ex2 = expectation(description: "Setting a permission should work.")
-        userA.apply(p) { (error) in
-            XCTAssertNil(error)
-            ex2.fulfill()
-        }
-        waitForExpectations(timeout: 2.0, handler: nil)
-
-        // Now retrieve the permissions again and make sure the new permission is properly set.
-        let ex3 = expectation(description: "One permission in results after setting the permission.")
-        userB.retrievePermissions { (r, error) in
-            XCTAssertNil(error)
-            XCTAssertNotNil(r)
-            guard let r = r else { return }
-
-            XCTAssertTrue(r.contains(p))
-            // Check getting permission by its index.
-            let index = r.index(of: p)
-            XCTAssertNotNil(index)
-            XCTAssertTrue(p == r[index!])
-
-            ex3.fulfill()
-        }
-        waitForExpectations(timeout: 2.0, handler: nil)
-    }
-
-    /// Observing permission changes should work.
-    func testObservingPermissions() {
-        // Open a Realm for user A.
-        let uuid = UUID().uuidString
-        let url = SwiftSyncTestCase.uniqueRealmURL(customName: uuid)
-        _ = try! synchronouslyOpenRealm(url: url, user: userA)
-
-        // Give user B read permissions to that Realm.
-        let p = SyncPermission(realmPath: tildeSubstitutedURL(for: url, user: userA).path,
-                               identity: userB.identity!,
-                               accessLevel: .read)
-
-        // Set the permission.
-        let ex2 = expectation(description: "Setting a permission should work.")
-        userA.apply(p) { (error) in
-            XCTAssertNil(error)
-            ex2.fulfill()
-        }
-        wait(for: [ex2], timeout: 2.0)
-
-        // Verify that it was added
-        let ex3 = expectation(description: "Retrieving the results should work.")
-        userB.retrievePermissions { (r, error) in
-            XCTAssertNil(error)
-            XCTAssertNotNil(r)
-            XCTAssertTrue(r!.contains(p))
-            ex3.fulfill()
-        }
-        waitForExpectations(timeout: 2.0, handler: nil)
-    }
-
-    /// User should not be able to change a permission for a Realm they don't own.
-    func testSettingUnownedRealmPermission() {
-        // Open a Realm for user A.
-        let uuid = UUID().uuidString
-        let url = SwiftSyncTestCase.uniqueRealmURL(customName: uuid)
-        _ = try! synchronouslyOpenRealm(url: url, user: userA)
-
-        // Try to have user B give user C permissions to that Realm.
-        let p = SyncPermission(realmPath: url.path, identity: userC.identity!, accessLevel: .read)
-
-        // Attempt to set the permission.
-        let ex2 = expectation(description: "Setting an invalid permission should fail.")
-        userB.apply(p) { error in
-            XCTAssertNotNil(error)
-            ex2.fulfill()
-        }
-        waitForExpectations(timeout: 2.0, handler: nil)
-
-        // Now retrieve the permissions again and make sure the new permission was not set.
-        let ex3 = expectation(description: "Retrieving the results should work.")
-        userB.retrievePermissions { (r, error) in
-            XCTAssertNil(error)
-            XCTAssertNotNil(r)
-            XCTAssertFalse(r!.contains(p))
-            ex3.fulfill()
-        }
-        waitForExpectations(timeout: 2.0, handler: nil)
-    }
-
-    // MARK: - Offer/response
-
-    func testPermissionOffer() {
-        _ = try! synchronouslyOpenRealm(url: realmURL, user: userA)
-        var token: String?
-
-        // Create an offer.
-        let ex = expectation(description: "A new permission offer will be processed by the server.")
-        userA.createOfferForRealm(at: realmURL, accessLevel: .write) { (t, error) in
-            XCTAssertNil(error)
-            XCTAssertNotNil(t)
-            token = t
-            ex.fulfill()
-        }
-        waitForExpectations(timeout: 10.0, handler: nil)
-        XCTAssertGreaterThan(token!.lengthOfBytes(using: .utf8), 0)
-    }
-
-    func testPermissionOfferResponse() {
-        _ = try! synchronouslyOpenRealm(url: realmURL, user: userA)
-        var token: String?
-
-        // Create an offer.
-        let ex = expectation(description: "A new permission offer will be processed by the server.")
-        userA.createOfferForRealm(at: realmURL, accessLevel: .write) { (t, error) in
-            XCTAssertNil(error)
-            XCTAssertNotNil(t)
-            token = t
-            ex.fulfill()
-        }
-        waitForExpectations(timeout: 10.0, handler: nil)
-        guard let theToken = token else {
-            XCTFail("We expected an offer token, but did not get one. Aborting the test.")
-            return
-        }
-        XCTAssertGreaterThan(theToken.lengthOfBytes(using: .utf8), 0)
-
-        // Accept the offer.
-        let ex2 = expectation(description: "A permission offer response will be processed by the server.")
-        var url: URL?
-        userB.acceptOffer(forToken: theToken) { (u, error) in
-            XCTAssertNil(error)
-            XCTAssertNotNil(u)
-            url = u
-            ex2.fulfill()
-        }
-        waitForExpectations(timeout: 10.0, handler: nil)
-        guard let theURL = url else {
-            XCTFail("We expected a Realm URL, but did not get one. Aborting the test.")
-            return
-        }
-        XCTAssertEqual(theURL.path, tildeSubstitutedURL(for: realmURL, user: userA).path)
-        do {
-            _ = try synchronouslyOpenRealm(url: theURL, user: userB)
-        } catch {
-            XCTFail("Was not able to successfully open the Realm with user B after accepting the offer.")
-        }
-    }
-}

+ 0 - 280
Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/SwiftPermissionsTests.swift

@@ -1,280 +0,0 @@
-////////////////////////////////////////////////////////////////////////////
-//
-// Copyright 2018 Realm Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////
-
-import XCTest
-import RealmSwift
-
-final class PermissionUser: Object {
-    // A class with a name that conflicts with an Object class from RealmSwift to verify
-    // that it doesn't break anything
-}
-
-class SwiftPermissionsAPITests: SwiftSyncTestCase {
-    var userA: SyncUser!
-    var userB: SyncUser!
-    var userC: SyncUser!
-
-    override func setUp() {
-        super.setUp()
-        let baseName = UUID().uuidString
-        userA = try! synchronouslyLogInUser(for: .usernamePassword(username: baseName + "-a", password: "a", register: true),
-                                            server: SwiftSyncTestCase.authServerURL())
-        userB = try! synchronouslyLogInUser(for: .usernamePassword(username: baseName + "-b", password: "a", register: true),
-                                            server: SwiftSyncTestCase.authServerURL())
-        userC = try! synchronouslyLogInUser(for: .usernamePassword(username: baseName + "-c", password: "a", register: true),
-                                            server: SwiftSyncTestCase.authServerURL())
-    }
-
-    override func tearDown() {
-        userA.logOut()
-        userB.logOut()
-        userC.logOut()
-        super.tearDown()
-    }
-
-    // MARK: Helper functions
-
-    func openRealm(_ url: URL, _ user: SyncUser) -> Realm {
-        let realm = try! Realm(configuration: user.configuration(realmURL: url))
-        waitForSync(realm)
-        return realm
-    }
-
-    func subscribe<T: Object>(realm: Realm, type: T.Type, _ filter: String = "TRUEPREDICATE") {
-        let subscription = realm.objects(type).filter(filter).subscribe()
-        let ex = expectation(description: "Waiting for subscription completion")
-        let token = subscription.observe(\.state, options: .initial) { state in
-            if state == .complete {
-                ex.fulfill()
-            }
-        }
-        waitForExpectations(timeout: 20.0)
-        token.invalidate()
-    }
-
-    func waitForSync(_ realm: Realm) {
-        waitForUploads(for: realm)
-        waitForDownloads(for: realm)
-        realm.refresh()
-    }
-
-    func createRealm(name: String, permissions: (Realm) -> Void) -> URL {
-        // Create a new Realm with an admin user
-        let admin = createAdminUser(for: SwiftSyncTestCase.authServerURL(),
-                                    username: UUID().uuidString + "-admin")
-        let url = URL(string: "realm://127.0.0.1:9080/\(name.replacingOccurrences(of: "()", with: ""))")!
-        let adminRealm = openRealm(url, admin)
-        // FIXME: we currently need to add a subscription to get the permissions types sent to us
-        subscribe(realm: adminRealm, type: SwiftSyncObject.self)
-
-        // Set up permissions on the Realm
-        try! adminRealm.write {
-            adminRealm.create(SwiftSyncObject.self, value: ["obj 1"])
-            permissions(adminRealm)
-        }
-
-        // FIXME: we currently need to also add the old realm-level permissions
-        let ex1 = expectation(description: "Setting a permission should work.")
-        let ex2 = expectation(description: "Setting a permission should work.")
-        let ex3 = expectation(description: "Setting a permission should work.")
-        admin.apply(SyncPermission(realmPath: url.path, identity: userA.identity!, accessLevel: .read)) { error in
-            XCTAssertNil(error)
-            ex1.fulfill()
-        }
-        admin.apply(SyncPermission(realmPath: url.path, identity: userB.identity!, accessLevel: .read)) { error in
-            XCTAssertNil(error)
-            ex2.fulfill()
-        }
-        admin.apply(SyncPermission(realmPath: url.path, identity: userC.identity!, accessLevel: .read)) { error in
-            XCTAssertNil(error)
-            ex3.fulfill()
-        }
-        waitForExpectations(timeout: 2.0, handler: nil)
-        waitForSync(adminRealm)
-
-        return url
-    }
-
-    func createDefaultPermisisons(_ permissions: List<Permission>) {
-        var p = permissions.findOrCreate(forRoleNamed: "everyone")
-        p.canCreate = false
-        p.canRead = false
-        p.canQuery = false
-        p.canDelete = false
-        p.canUpdate = false
-        p.canModifySchema = false
-        p.canSetPermissions = false
-
-        p = permissions.findOrCreate(forRoleNamed: "reader")
-        p.canRead = true
-        p.canQuery = true
-
-        p = permissions.findOrCreate(forRoleNamed: "writer")
-        p.canUpdate = true
-        p.canCreate = true
-        p.canDelete = true
-
-        p = permissions.findOrCreate(forRoleNamed: "admin")
-        p.canSetPermissions = true
-    }
-
-    func add(user: SyncUser, toRole roleName: String, inRealm realm: Realm) {
-        let user = realm.create(RealmSwift.PermissionUser.self, value: [user.identity!], update: .modified)
-        realm.create(PermissionRole.self, value: [roleName], update: .modified).users.append(user)
-    }
-
-
-    // MARK: Tests
-
-    func testAsyncOpenWaitsForPermissions() {
-        let url = createRealm(name: #function) { realm in
-            createDefaultPermisisons(realm.permissions)
-            add(user: userA, toRole: "reader", inRealm: realm)
-        }
-
-        let ex = expectation(description: "asyncOpen")
-        var subscription: SyncSubscription!
-        var token: NotificationToken!
-        Realm.asyncOpen(configuration: userA.configuration(realmURL: url)) { realm, error in
-            XCTAssertNil(error)
-            // Will crash if the __Class object for swiftSyncObject wasn't downloaded
-            _ = realm!.permissions(forType: SwiftSyncObject.self)
-
-            // Make sure that the dummy subscription we created hasn't interfered
-            // with adding new subscriptions.
-            subscription = realm!.objects(SwiftSyncObject.self).subscribe()
-            token = subscription.observe(\.state, options: .initial) { state in
-                if state == .complete {
-                    ex.fulfill()
-                }
-            }
-        }
-        waitForExpectations(timeout: 10.0, handler: nil)
-        token.invalidate()
-    }
-
-    func testRealmRead() {
-        let url = createRealm(name: "testRealmRead") { realm in
-            createDefaultPermisisons(realm.permissions)
-            add(user: userA, toRole: "reader", inRealm: realm)
-        }
-
-        // userA should now be able to open the Realm and see objects
-        let realmA = openRealm(url, userA)
-        subscribe(realm: realmA, type: SwiftSyncObject.self)
-        XCTAssertEqual(realmA.getPrivileges(), [.read])
-        XCTAssertEqual(realmA.getPrivileges(SwiftSyncObject.self), [.read, .subscribe])
-        XCTAssertEqual(realmA.getPrivileges(realmA.objects(SwiftSyncObject.self).first!), [.read])
-
-        // userA should not be able to create new objects
-        XCTAssertEqual(realmA.objects(SwiftSyncObject.self).count, 1)
-        try! realmA.write {
-            realmA.create(SwiftSyncObject.self, value: ["obj 2"])
-        }
-        XCTAssertEqual(realmA.objects(SwiftSyncObject.self).count, 2)
-        waitForSync(realmA)
-        XCTAssertEqual(realmA.objects(SwiftSyncObject.self).count, 1)
-
-        // userB should not be able to read any objects
-        let realmB = openRealm(url, userB)
-        subscribe(realm: realmB, type: SwiftSyncObject.self)
-        XCTAssertEqual(realmB.getPrivileges(), [])
-        XCTAssertEqual(realmB.getPrivileges(SwiftSyncObject.self), [])
-        XCTAssertEqual(realmB.objects(SwiftSyncObject.self).count, 0)
-    }
-
-    func testRealmWrite() {
-        let url = createRealm(name: "testRealmWrite") { realm in
-            createDefaultPermisisons(realm.permissions)
-            add(user: userA, toRole: "reader", inRealm: realm)
-            add(user: userA, toRole: "writer", inRealm: realm)
-            add(user: userB, toRole: "reader", inRealm: realm)
-        }
-
-        // userA should now be able to open the Realm and see objects
-        let realmA = openRealm(url, userA)
-        subscribe(realm: realmA, type: SwiftSyncObject.self)
-        XCTAssertEqual(realmA.getPrivileges(), [.read, .update])
-        XCTAssertEqual(realmA.getPrivileges(SwiftSyncObject.self),
-                       [.read, .subscribe, .update, .create, .setPermissions])
-        XCTAssertEqual(realmA.getPrivileges(realmA.objects(SwiftSyncObject.self).first!),
-                       [.read, .update, .delete, .setPermissions])
-
-        // userA should be able to create new objects
-        XCTAssertEqual(realmA.objects(SwiftSyncObject.self).count, 1)
-        try! realmA.write {
-            realmA.create(SwiftSyncObject.self, value: ["obj 2"])
-        }
-        XCTAssertEqual(realmA.objects(SwiftSyncObject.self).count, 2)
-        waitForSync(realmA)
-        XCTAssertEqual(realmA.objects(SwiftSyncObject.self).count, 2)
-
-        // userB's insertions should be reverted
-        let realmB = openRealm(url, userB)
-        subscribe(realm: realmB, type: SwiftSyncObject.self)
-        XCTAssertEqual(realmB.objects(SwiftSyncObject.self).count, 2)
-        try! realmB.write {
-            realmB.create(SwiftSyncObject.self, value: ["obj 3"])
-        }
-        XCTAssertEqual(realmB.objects(SwiftSyncObject.self).count, 3)
-        waitForSync(realmB)
-        XCTAssertEqual(realmB.objects(SwiftSyncObject.self).count, 2)
-    }
-    func testRealmSetPermissions() {
-
-    }
-    func testRealmModifySchema() {
-
-    }
-
-    func testClassRead() {
-        let url = createRealm(name: "testClassRead") { realm in
-            createDefaultPermisisons(realm.permissions(forType: SwiftSyncObject.self))
-            add(user: userA, toRole: "reader", inRealm: realm)
-        }
-
-        // userA should now be able to open the Realm and see objects
-        let realmA = openRealm(url, userA)
-        subscribe(realm: realmA, type: SwiftSyncObject.self)
-        XCTAssertEqual(realmA.getPrivileges(), [.read, .update, .setPermissions, .modifySchema])
-        XCTAssertEqual(realmA.getPrivileges(SwiftSyncObject.self), [.read, .subscribe])
-        XCTAssertEqual(realmA.getPrivileges(realmA.objects(SwiftSyncObject.self).first!), [.read])
-
-        // userA should not be able to create new objects
-        XCTAssertEqual(realmA.objects(SwiftSyncObject.self).count, 1)
-        try! realmA.write {
-            realmA.create(SwiftSyncObject.self, value: ["obj 2"])
-        }
-        XCTAssertEqual(realmA.objects(SwiftSyncObject.self).count, 2)
-        waitForSync(realmA)
-        XCTAssertEqual(realmA.objects(SwiftSyncObject.self).count, 1)
-
-        // userB should not be able to read any objects
-        let realmB = openRealm(url, userB)
-        subscribe(realm: realmB, type: SwiftSyncObject.self)
-        XCTAssertEqual(realmB.getPrivileges(), [.read, .update, .setPermissions, .modifySchema])
-        XCTAssertEqual(realmB.getPrivileges(SwiftSyncObject.self), [])
-        XCTAssertEqual(realmB.objects(SwiftSyncObject.self).count, 0)
-    }
-    func testClassWrite() {
-
-    }
-    func testClassSetPermissions() {
-
-    }
-}

+ 0 - 170
Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/SwiftSyncTestCase.swift

@@ -1,170 +0,0 @@
-////////////////////////////////////////////////////////////////////////////
-//
-// Copyright 2016 Realm Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////
-
-import XCTest
-import RealmSwift
-
-class SwiftSyncObject: Object {
-    @objc dynamic var stringProp: String = ""
-}
-
-class SwiftHugeSyncObject: Object {
-    @objc dynamic var dataProp: NSData?
-
-    required init() {
-        super.init()
-        let size = 1000000
-        let ptr = malloc(size)
-        dataProp = NSData(bytes: ptr, length: size)
-        free(ptr)
-    }
-
-    required init(realm: RLMRealm, schema: RLMObjectSchema) {
-        fatalError("init(realm:schema:) has not been implemented")
-    }
-    required init(value: Any, schema: RLMSchema) {
-        fatalError("init(value:schema:) has not been implemented")
-    }
-}
-
-class SwiftPartialSyncObjectA: Object {
-    @objc dynamic var number: Int = 0
-    @objc dynamic var string: String = ""
-
-    convenience init(number: Int, string: String) {
-        self.init()
-        self.number = number
-        self.string = string
-    }
-}
-
-class SwiftPartialSyncObjectB: Object {
-    @objc dynamic var number: Int = 0
-    @objc dynamic var firstString: String = ""
-    @objc dynamic var secondString: String = ""
-
-    convenience init(number: Int, firstString: String, secondString: String) {
-        self.init()
-        self.number = number
-        self.firstString = firstString
-        self.secondString = secondString
-    }
-}
-
-// MARK: Test case
-
-class SwiftSyncTestCase: RLMSyncTestCase {
-
-    var task: Process?
-
-    let authURL: URL = URL(string: "http://127.0.0.1:9080")!
-    let slowConnectAuthURL: URL = URL(string: "http://127.0.0.1:9083")!
-    let realmURL: URL = URL(string: "realm://127.0.0.1:9080/~/testBasicSync")!
-
-    /// For testing, make a unique Realm URL of the form "realm://127.0.0.1:9080/~/X",
-    /// where X is either a custom string passed as an argument, or an UUID string.
-    static func uniqueRealmURL(customName: String? = nil) -> URL {
-        return URL(string: "realm://127.0.0.1:9080/~/\(customName ?? UUID().uuidString)")!
-    }
-
-    func executeChild(file: StaticString = #file, line: UInt = #line) {
-        XCTAssert(0 == runChildAndWait(), "Tests in child process failed", file: file, line: line)
-    }
-
-    func basicCredentials(register: Bool = true,
-                          usernameSuffix: String = "",
-                          file: StaticString = #file,
-                          line: UInt = #line) -> SyncCredentials {
-        let filename = URL(fileURLWithPath: String(describing: file)).deletingPathExtension().lastPathComponent
-        return .usernamePassword(username: "\(filename)\(line)\(usernameSuffix)", password: "a", register: register)
-    }
-
-    func synchronouslyOpenRealm(url: URL, user: SyncUser, file: StaticString = #file, line: UInt = #line) throws -> Realm {
-        let config = user.configuration(realmURL: url, fullSynchronization: true)
-        return try synchronouslyOpenRealm(configuration: config)
-    }
-
-    func synchronouslyOpenRealm(configuration: Realm.Configuration, file: StaticString = #file, line: UInt = #line) throws -> Realm {
-        let semaphore = DispatchSemaphore(value: 0)
-        let basicBlock = { (error: Error?) in
-            if let error = error {
-                let process = self.isParent ? "parent" : "child"
-                XCTFail("Received an asynchronous error: \(error) (process: \(process))", file: file, line: line)
-            }
-            semaphore.signal()
-        }
-        SyncManager.shared.setSessionCompletionNotifier(basicBlock)
-        let realm = try Realm(configuration: configuration)
-        let result = semaphore.wait(timeout: .now() + DispatchTimeInterval.seconds(20))
-        SyncManager.shared.setSessionCompletionNotifier(nil)
-        XCTAssertEqual(result, .success)
-        return realm
-    }
-
-    func immediatelyOpenRealm(url: URL, user: SyncUser) throws -> Realm {
-        return try Realm(configuration: user.configuration(realmURL: url, fullSynchronization: true))
-    }
-
-    func synchronouslyLogInUser(for credentials: SyncCredentials,
-                                server url: URL,
-                                file: StaticString = #file,
-                                line: UInt = #line) throws -> SyncUser {
-        let process = isParent ? "parent" : "child"
-        var theUser: SyncUser?
-        var theError: Error?
-        let ex = expectation(description: "Should log in the user properly")
-        SyncUser.logIn(with: credentials, server: url) { user, error in
-            XCTAssertNotNil(user, file: file, line: line)
-            XCTAssertNil(error,
-                         "Error when trying to log in a user: \(error!) (process: \(process))",
-                         file: file,
-                         line: line)
-            theUser = user
-            theError = error
-            ex.fulfill()
-        }
-        waitForExpectations(timeout: 10, handler: nil)
-        XCTAssertNotNil(theUser, file: file, line: line)
-        XCTAssertEqual(theUser?.state, .active,
-                       "User should have been valid, but wasn't. (process: \(process), error: "
-                        + "\(theError != nil ? String(describing: theError!) : "n/a"))",
-                       file: file,
-                       line: line)
-        return theUser!
-    }
-
-    func waitForUploads(for realm: Realm) {
-        waitForUploads(for: ObjectiveCSupport.convert(object: realm))
-    }
-
-    func waitForDownloads(for realm: Realm) {
-        waitForDownloads(for: ObjectiveCSupport.convert(object: realm))
-    }
-
-    func checkCount<T: Object>(expected: Int,
-                               _ realm: Realm,
-                               _ type: T.Type,
-                               file: StaticString = #file,
-                               line: UInt = #line) {
-        let actual = realm.objects(type).count
-        XCTAssert(actual == expected,
-                  "Error: expected \(expected) items, but got \(actual) (process: \(isParent ? "parent" : "child"))",
-                  file: file,
-                  line: line)
-    }
-}

+ 0 - 27
Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/certificates/ca-key.pem

@@ -1,27 +0,0 @@
------BEGIN RSA PRIVATE KEY-----
-MIIEpQIBAAKCAQEA2jW6EOo+UQGlUGtEqQX1OD54tsqQ6xDZ5YWJqiRx33CdeGc0
-+KlC+Y9hGiOxM+lb0CJuV/w1kHRqlfwIkQNSfQYlREdkdDW3hqBiHBfscahuBBJJ
-q36HBeynxUBcdlxlOYPlZ7QmcEb6CMWmUERbScgZFQVB1VFT2/Ev05g832I3XtrJ
-OCJvDElsnXOvi1Pd2qvmNYe6ap4CsVRDli7k+URyKBIQ7ejHBDx4ufs9bSSMPsFd
-hq7/oek1qWZ4vomI/kv2A1IWpFxzfkXSknm385+ioecEy9f4+ObYJAaR8vcHTzqb
-yKkS50zgO0inW6YvbT8hnzZkoma/w9CHRC6o5wIDAQABAoIBAE9OlZiOOiXg7j9j
-LSotQym08tSknLUCg986gIU5B7YIzQK0p/j0M6ZWKRmB/WZ7muXzjZ0myiT9Wru2
-RTrHNVTBRgwh0m22FES2x9GkFEheydVq/CF7NAHAOF2lfbV68UNNH7RoMkw+T6Oe
-ikrD/VW8hvkv1vR7wXm/l/1UaFNbSBSVou8EjHGK9/3fgvHRMALN0Jr1mHRMgK56
-cU7t7oziOmjr/bjm/VowNbJKpF43FT+95/Af6n6H2bLFSfG+4rVAAk37UnCKp0Pb
-AlWVl8lpMXjK64qNK2I4yf+sQXRNwlsNWxd6gdNfyOqXbfU+c0F1kQL+ODYu5pit
-DNTfObECgYEA5JuY1SsBNVxF0U9Q9QhcZ23h0hgrxvD/DgLNL9/2+C1Lc1iC+qSh
-MV8q5faUAqbkAI0+NhEmmrRMNtvhJXfrO5SO1CO/rRrGHF4MJ+Sj1TpefNktYR/6
-fo2BIbfmAoY3O142RWi1u/6Cv1GONp0EyLbBnxin0PB36OUkNxUjhvkCgYEA9Fsu
-Ar9EolZPJYtLqGitIhkyCXHSyMEHfQRNyz8kUORtFA6yjvD6vFAtVf2DNaY4FQ0a
-TYQ3O0akyPM2lG2c6TtojXKHkDLPJOV0Kh6BMImAqDq2Fsj+nTdoojNw4ypAMU4m
-KLAiA3nd03X7es7a6uvrSvQxJRB9fwiBzO70Rt8CgYEAm7ipuLscjZ6XKGbg/Kh/
-WSzuYFB6sX9EHeUmo+/pqVAhTycBwX4XFyx+ajs2wz+vm/iaYfX41/Ts3YmVqhIv
-uFwPls3rKR1NydD+csY6G2sxJdZCJSDFXyNAzRkZoqqOQPCCA3G6KZ7KrUv+lZEL
-yzVCWv9OgPLsm0ZLDwJlOvECgYEA7+SkIyZL52P8h8tdF5TMhHFf4k3Qti5rf5y+
-Ew+GQ7Q+MjbLrfF+92lvWMBuFDl/TYtziy6GWrdcB7xelRGXvpIIbvVFiZeYLYzm
-ooMYKeKUYJRjN7NT5F0FaFhAN4S/SKiEZeWlPuxhjryBi2uRGJlMgmWB6fVqf1CG
-vf7J6tkCgYEAqySHnPPm8aHPo9/Vx8JMbalPDgR/18jv3rABbQiMSU+C8Z8rVEmH
-MI1DmbWx+9yCqMff1i5xGKt4QDaqGLW7+xy142f1eu+tr7bxx2PusaEpAF2uoAW4
-c/DgWecBLDEhEW3NowHsI3ddNTpNQiNfZRd0TNdr9gwy/N8BfzMZtB4=
------END RSA PRIVATE KEY-----

+ 0 - 19
Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/certificates/ca.pem

@@ -1,19 +0,0 @@
------BEGIN CERTIFICATE-----
-MIIDCTCCAfGgAwIBAgIIcWSopWiXJPMwDQYJKoZIhvcNAQELBQAwIDEeMBwGA1UE
-AxMVbWluaWNhIHJvb3QgY2EgNzE2NGE4MCAXDTE4MDgyOTE5MTcxM1oYDzIxMTgw
-ODI5MjAxNzEzWjAgMR4wHAYDVQQDExVtaW5pY2Egcm9vdCBjYSA3MTY0YTgwggEi
-MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDaNboQ6j5RAaVQa0SpBfU4Pni2
-ypDrENnlhYmqJHHfcJ14ZzT4qUL5j2EaI7Ez6VvQIm5X/DWQdGqV/AiRA1J9BiVE
-R2R0NbeGoGIcF+xxqG4EEkmrfocF7KfFQFx2XGU5g+VntCZwRvoIxaZQRFtJyBkV
-BUHVUVPb8S/TmDzfYjde2sk4Im8MSWydc6+LU93aq+Y1h7pqngKxVEOWLuT5RHIo
-EhDt6McEPHi5+z1tJIw+wV2Grv+h6TWpZni+iYj+S/YDUhakXHN+RdKSebfzn6Kh
-5wTL1/j45tgkBpHy9wdPOpvIqRLnTOA7SKdbpi9tPyGfNmSiZr/D0IdELqjnAgMB
-AAGjRTBDMA4GA1UdDwEB/wQEAwIChDAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYB
-BQUHAwIwEgYDVR0TAQH/BAgwBgEB/wIBADANBgkqhkiG9w0BAQsFAAOCAQEARxf4
-85JGwLkxN6bxwc7o3dJow+0xX9zZ0AY3Kvlsp9PSMrydRme1qvzejCfn0n8a9381
-1AerczkhnjJwKFYdy+TxcL0KcnTnJRnSwum+Aq7RXH0NVt/2X28/oX3m4u9rHkjB
-jQ3QxBzfBHWelZ8twxU8wXJVrb45G5Hw5cXOHs4GIXGbCZjJNvyyz9/60qpUV9sh
-q8DMuWkP2eHKP4BjsJ0eX6UitAaZjR0VWZK40yGkouxqLjrE7LesNioQhDGS3Te2
-gg/hAbN4c3lpsPwjeR4RspqjMZzUhY3cJ0t81jVFpbRhKjfU02ww6EDmexjQNAOt
-3yrKmabyT80mBaiL9Q==
------END CERTIFICATE-----

+ 0 - 27
Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/certificates/localhost-cert-key.pem

@@ -1,27 +0,0 @@
------BEGIN RSA PRIVATE KEY-----
-MIIEpAIBAAKCAQEAyh8jYiwYLiZdZNx8fwugGElA0z4km+0qColhU2iaUfK3YalX
-DS11rjg+vO+zrE85/+UVaQ2X0G81PVH5wid+NcFm6N95Mysqum/iNnPwdOOkRPb3
-8bOFxZ7xRs8L+UjptFXwAqD9CvE1q8CegmAcTMrZInxmwjvnOaHriutQoN6eWDsL
-dRxdak3plfNRlR0A8BRhe/uVi/YksLZRBSpij/8ehA7aaDglyvE+K1JTiAbSDm2h
-P+QADkXK5TIUA2tdDpG4Ey1q/NKCrEoVv8XTraa6+t5BC3chuVcsc4o0aTQpNAug
-TY/riBNV0Tsq9OLU3rA2loWCkW08DbnoLhUpuwIDAQABAoIBAGnH8CHCCAmnJHvT
-9QgcknYDaHzl6gz9C2KmUZxwg0teJuFi2d9Yql06rIL/RF5qvGUThKgNaCW6/fcQ
-vxEA0Enb5Tr9MhY4gk0+nvp2pSLXvLInOs5xcRJjQ80WMSMPKNirnUgS7zvZz4gK
-8Co1mLoL86Xby3/eD/6Woop66yC1Uri8RDndgMR8ntC8VtmA0Z2zOM1zMVBz0kam
-YS576pgJh4xJ1Q7SCKr3HTO7/7HeopzXrSP5xQWdYNBo7VPgG2bRPZ2zUaFfm+Ps
-T5Lw5wByqexGnUiCZ98gF6lnFHDOzQSJy45ce7XuQSkO7+0WhGz1QZ+VlEiR/1x6
-0colZEECgYEAz373IfktDj8+L3F930cQK8oKD1LUEMgd44OydvICO+yHUZWgmTWE
-aJPmn8Dw4GuPyjesACR56RCP990T7zdvcwkwj/5h+509xAxNHJZoYRL8m6fw+uo5
-wW34uTCDg+MxP2ipJ2E1iW1NIEYq4wInw6RiEDZLPu33pnX+Ad/6BeECgYEA+V6P
-mFJyGYaw+OUqMT6M40BSTD6TT+yUvUPZa+sCKs296xYc3BEGXe62L/XVE0MrbSvG
-KPNMG5u3IoAGdKc4wbtsdBe+S9zu71ZIKsdkWDl9GwZ2xHX0tqV0/Ca140zlkxAY
-+dJL9nGq82WcEfhPcXwInPBrMpzOlyJXptNx6xsCgYEAmyxVPwfshPIQ3EQgoQCw
-/D5tBYao5x/xEjtkFIXp28yIah/e6ZTXP6oT17bfrMVj1BOMQtMEhKKJOBESHlyz
-sTDXK2hO+G9gSKP2awGkb6xWU0Xl9o+Bv8ExN7UrNU+LfeMUVUniUrL18cPnwLrU
-5/+gAoXIAfjOsqMc4WQRw6ECgYEAzr/XzjKM5x0FHVbi5HE33jI2CYDYIivEJida
-3F68LUDndUGgK9Txsm94Hct0HcRS/PCOGuWc9EbmT3RV5eG+7OC3yojk/YDvmP+w
-Vcd7Kqp/TyjMz5X8jnIfy+9MXmgi7wspqfbxhCI52hMkksGNHEn52iR6vDvGDQgs
-I+SrToECgYAdbzZ0FNeBAOvoEi6svApUNw4w3fHujVpg8b/FhadKaAx+kJBxcqy7
-Xfj3UrfKU7TuR8kO/EK9z9YXo5MiNVWP56QfzbLkvr5Obfi/sJrIHAYqeqPKpgaz
-acclIzLL5HsrbVjKiJs9Q8j9+Rx4RgIFTG0lM+25J8JnOnVFnPWdvw==
------END RSA PRIVATE KEY-----

+ 0 - 19
Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/certificates/localhost-cert.pem

@@ -1,19 +0,0 @@
------BEGIN CERTIFICATE-----
-MIIDDTCCAfWgAwIBAgIISzy7BX9hEJkwDQYJKoZIhvcNAQELBQAwIDEeMBwGA1UE
-AxMVbWluaWNhIHJvb3QgY2EgNzE2NGE4MCAXDTE4MDgyOTE5MTcxNFoYDzIxMDgw
-ODI5MjAxNzE0WjAUMRIwEAYDVQQDEwlsb2NhbGhvc3QwggEiMA0GCSqGSIb3DQEB
-AQUAA4IBDwAwggEKAoIBAQDKHyNiLBguJl1k3Hx/C6AYSUDTPiSb7SoKiWFTaJpR
-8rdhqVcNLXWuOD6877OsTzn/5RVpDZfQbzU9UfnCJ341wWbo33kzKyq6b+I2c/B0
-46RE9vfxs4XFnvFGzwv5SOm0VfACoP0K8TWrwJ6CYBxMytkifGbCO+c5oeuK61Cg
-3p5YOwt1HF1qTemV81GVHQDwFGF7+5WL9iSwtlEFKmKP/x6EDtpoOCXK8T4rUlOI
-BtIObaE/5AAORcrlMhQDa10OkbgTLWr80oKsShW/xdOtprr63kELdyG5VyxzijRp
-NCk0C6BNj+uIE1XROyr04tTesDaWhYKRbTwNueguFSm7AgMBAAGjVTBTMA4GA1Ud
-DwEB/wQEAwIFoDAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDAYDVR0T
-AQH/BAIwADAUBgNVHREEDTALgglsb2NhbGhvc3QwDQYJKoZIhvcNAQELBQADggEB
-AIYlOrkjRZJ/4SubG7MJB9FK5un+0vDPXWmlz90szGCIhM8/SBxwIZyMWEDAPhJ9
-PmhBngrDZjJt1C5TfsH2utGwh2ONErnBp8MC/DK5qSwiCuZTFRGwyZVI7Rpmk2RJ
-AtMUKsR8TRlaZ9QBlDF+6owMgKUb+VN+I806ryaBNKHuS4cmGdqOxzhb5/+9MXh/
-UfAnHNoie0r8eZhE0mUJ0JjTQOKhZMhAmHR5Pm/9S2f+VwsBriR0v3Fxw+9TN9cV
-PXfwR1gRJ1hpCvYUMp6PLsEwSAdTpBm6+vea5iRytSjny+R4E27q1ohTey0+6sUk
-WnVQqUUINxQulv7m60R2foY=
------END CERTIFICATE-----

+ 0 - 19
Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/certificates/localhost-other-cert.pem

@@ -1,19 +0,0 @@
------BEGIN CERTIFICATE-----
-MIIDDTCCAfWgAwIBAgIIUfBnG/nIaSAwDQYJKoZIhvcNAQELBQAwIDEeMBwGA1UE
-AxMVbWluaWNhIHJvb3QgY2EgNzE2NGE4MCAXDTE4MDgzMDE5MzE1NFoYDzIxMDgw
-ODMwMjAzMTU0WjAUMRIwEAYDVQQDEwlsb2NhbGhvc3QwggEiMA0GCSqGSIb3DQEB
-AQUAA4IBDwAwggEKAoIBAQCvm9qn97bX+M7Vu/z7Hd1OUcVynryrISrVdHbs/dv6
-UsXhrl4Z47y0/U0I013gGK8+yblxRLYyLE3jua7nL+pBGOULG2P95KWHVgLtJECl
-wDKLgnn2TUZ6eL72Mu3XkrYmDRd50queGgEIkDvXRGbOs2VfH2giY0ttQK3pXAa9
-0sBuOhFWUd8oyOCplBlRUf+PsjbcyW/LC58WtmizO7QC40ANz0dpR04UZxNe0+gM
-ATKEksELQwSKQoVQwCp1VOZ5jyzk9RtBS5ZJP5n8cl6/ZVSOekLBoE8DQibR3ga2
-E0I/r7bSzCYJr9K4jTFYGwPoY/U2Yk38mGp8/d9x35W1AgMBAAGjVTBTMA4GA1Ud
-DwEB/wQEAwIFoDAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDAYDVR0T
-AQH/BAIwADAUBgNVHREEDTALgglsb2NhbGhvc3QwDQYJKoZIhvcNAQELBQADggEB
-ABoxyKJmBAWuxDAYGnmopWhBkAqh6GHvC4TkVAOaNGhfs+U0g5lwgVm2sFz1+lsZ
-zF/ECVsZhQ5MTZaaMKrlMZ/NEvOll3C5L6LutFMeSQoffnkcIUDmveX9Yp+KoLdV
-tbvVAt2D6BNsNDhmftyB2i8FH0fe1M+oxtAU54pqWGPoQo9+7N7UytFVimbCPNAt
-57rzegPyu4AcDdGO3SZBnhqT/rxUzO5nPJ+6MiXkCROSm26X8IvUR9/bO/QuC0t+
-CT6NJlEcn8X9eLsbSLrjHfXknbneteNCfZWU3qYbEh1Va98vYI3jku62pGyv9A7k
-Fs6VtIfrN3GRpSxs0Xw8hPw=
------END CERTIFICATE-----

BIN
Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/certificates/localhost-other.cer


BIN
Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/certificates/localhost.cer


+ 0 - 19
Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/certificates/not-localhost-cert.pem

@@ -1,19 +0,0 @@
------BEGIN CERTIFICATE-----
-MIIDETCCAfmgAwIBAgIINSZ+oqsybpIwDQYJKoZIhvcNAQELBQAwIDEeMBwGA1UE
-AxMVbWluaWNhIHJvb3QgY2EgMzdjNzNiMCAXDTE4MDgyOTIwMTg0N1oYDzIxMDgw
-ODI5MjExODQ3WjAWMRQwEgYDVQQDEwtleGFtcGxlLmNvbTCCASIwDQYJKoZIhvcN
-AQEBBQADggEPADCCAQoCggEBAN1if5VuZLU2WsWjOsYR7CPUwl3BD8Yw96T7c4ZX
-Nx33lNn8lz/RmMEeyNjavykqAUGpQj1ly3ZHK05SDxBiDA1p0mGm7uxh9ZhkNGiJ
-M4yFsqGDgmDiodGFQuCSg+idXDJkXnUngNSnfi8lLoU8KWHdNygjBZrLvg6TpK/t
-45UZaLIhGb91u6qam7cmofbywIW7dvWDyXSBkplXwkX1uNV7VSFVjcuzvuQdEIta
-plGH/bF2ykzhtJnbS93k3nZUl5HHI7ZV5IriDQ758orXFGLdEmLUd4zkyXJ2U9gz
-hI/90qw6RmDjia55R91LcRuWRic4Etu5Qxy8l9wuYvYl97MCAwEAAaNXMFUwDgYD
-VR0PAQH/BAQDAgWgMB0GA1UdJQQWMBQGCCsGAQUFBwMBBggrBgEFBQcDAjAMBgNV
-HRMBAf8EAjAAMBYGA1UdEQQPMA2CC2V4YW1wbGUuY29tMA0GCSqGSIb3DQEBCwUA
-A4IBAQC7kLaUNOFpWaVB5g3qlDtiklMbgV1LykK3ad+EfaPFzk/ALIzRNu5RmreH
-0GyoYoV+t/9iDgAi6CbBXMTibm0lVPGxoFLEYbYA4wREHBeJ1T16gfJf01/EB7H2
-stw8a6sHTpevqIfjs8T93RRZMzz2FHwWy7a6y0+mWJ+bKK0/GCkhlzNyznUHpphN
-OfrMtXU7uJp+6ml1qhfTppDChO74laFX/JwgDq2sQQUBCKlVtHJo5bm/yS5FSr0B
-S2ub4YgqiHFAozpJgiaPkya9vmUlp35zVSVZ4tTsTrnkArufbyKAfkMAG1Rskjo5
-lOMer8+75TUT9aTM+iE1RTbA5102
------END CERTIFICATE-----

BIN
Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/certificates/not-localhost.cer


+ 0 - 156
Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/test-ros-server.js

@@ -1,156 +0,0 @@
-const ROS = require('realm-object-server');
-const fs = require('fs');
-const http = require('http');
-const httpProxy = require('http-proxy');
-const os = require('os');
-const path = require('path');
-
-// Bypass the mandatory email prompt.
-process.env.ROS_TOS_EMAIL_ADDRESS = 'ci@realm.io';
-process.env.DOCKER_DATA_PATH = '/tmp';
-
-// Don't bother calling fsync() because we're throwing away all the files
-// between runs anyway
-process.env.REALM_DISABLE_SYNC_TO_DISK = 'true';
-
-// Workaround for <https://github.com/realm/realm-object-server-private/issues/950>.
-process.env.ROS_SUPERAGENT_RETRY_DELAY = '0';
-
-// Enable timestamps in the logs
-process.env.ROS_LOG_TIMESTAMP = '1';
-
-if (!process.env.SYNC_WORKER_FEATURE_TOKEN) {
-    try {
-        require(os.homedir() + '/.ros-feature-token.js');
-    }
-    catch (e) {
-        console.error('ROS feature token not found. Running Object Server tests requires setting the SYNC_WORKER_FEATURE_TOKEN environment variable.');
-        process.exit(1);
-    }
-}
-
-// A "email handler" which actually just writes the tokens to files that the
-// tests can read
-class PasswordEmailHandler {
-    constructor(dataRoot) {
-        this.dataRoot = dataRoot;
-        fs.mkdirSync(this.dataRoot);
-    }
-
-    resetPassword(email, token, userAgent, remoteIp) {
-        fs.writeFileSync(path.join(this.dataRoot, email), token);
-        return new Promise(r => setTimeout(r, 0));
-    }
-
-    confirmEmail(email, token) {
-        fs.writeFileSync(path.join(this.dataRoot, email), token);
-        return new Promise(r => setTimeout(r, 0));
-    }
-}
-
-class Proxy {
-    constructor(listenPort, targetPort) {
-        this.proxy = httpProxy.createProxyServer({target: `http://127.0.0.1:${targetPort}`, ws: true});
-        this.proxy.on('error', e => {
-            console.log('proxy error', e);
-        });
-        this.server = http.createServer((req, res) => {
-            this.web(req, res);
-        });
-        this.server.on('upgrade', (req, socket, head) => {
-            this.ws(req, socket, head);
-        });
-        this.server.listen(listenPort);
-    }
-
-    stop() {
-        this.server.close();
-        this.proxy.close();
-    }
-
-    web(req, res) {
-        this.proxy.web(req, res);
-    }
-
-    ws(req, socket, head) {
-        this.proxy.ws(req, socket, head);
-    }
-}
-
-// A simple proxy server that runs in front of ROS and validates custom headers
-class HeaderValidationProxy extends Proxy {
-    web(req, res) {
-        if (this.validate(req)) {
-            this.proxy.web(req, res);
-        }
-        else {
-            res.writeHead(400);
-            res.end('Missing X-Allow-Connection header');
-        }
-    }
-    ws(req, socket, head) {
-        if (this.validate(req)) {
-            this.proxy.ws(req, socket, head);
-        }
-        else {
-            socket.end('HTTP/1.1 400 Bad Request\r\n\r\n');
-        }
-    }
-    validate(req) {
-        return !!req.headers['x-allow-connection'];
-    }
-}
-
-// A proxy which sits in front of ROS and takes a long time to establish connections
-class SlowConnectingWebProxy extends Proxy {
-    web(req, res) {
-        setTimeout(() => this.proxy.web(req, res), 2000);
-    }
-}
-class SlowConnectingWsProxy extends Proxy {
-    ws(req, socket, head) {
-        setTimeout(() => this.proxy.ws(req, socket, head), 2000);
-    }
-}
-
-const server = new ROS.BasicServer();
-server.start({
-    // The desired logging threshold. Can be one of: all, trace, debug, detail, info, warn, error, fatal, off)
-    logLevel: 'off',
-
-    // For all the full list of configuration parameters see:
-    // https://realm.io/docs/realm-object-server/latest/api/ros/interfaces/serverconfig.html
-
-    address: '0.0.0.0',
-    port: 9080,
-    httpsPort: 9443,
-
-    https: true,
-    httpsKeyPath: __dirname + '/certificates/localhost-cert-key.pem',
-    httpsCertChainPath: __dirname + '/certificates/localhost-cert.pem',
-    httpsForInternalComponents: false,
-
-    dataPath: process.argv[2],
-    authProviders: [
-        new ROS.auth.DebugAuthProvider(),
-        new ROS.auth.PasswordAuthProvider({
-            autoCreateAdminUser: true,
-            emailHandler: new PasswordEmailHandler(path.join(process.argv[2], 'email')),
-        }),
-    ],
-    autoKeyGen: true,
-
-    // Disable the legacy Realm-based permissions service
-    permissionServiceConfigOverride: (config) => {
-        config.enableManagementRealmReflection = false;
-        config.enablePermissionRealmReflection = false;
-    },
-}).then(() => {
-    console.log('started');
-    fs.closeSync(1);
-}).catch(err => {
-    console.error(`Error starting Realm Object Server: ${err.message}`)
-});
-new HeaderValidationProxy(9081, 9080);
-new SlowConnectingWebProxy(9082, 9080);
-new SlowConnectingWsProxy(9083, 9080);

+ 0 - 53
Carthage/Checkouts/realm-cocoa/Realm/RLMAccessor.h

@@ -1,53 +0,0 @@
-////////////////////////////////////////////////////////////////////////////
-//
-// Copyright 2014 Realm Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////
-
-#import <Foundation/Foundation.h>
-
-@class RLMObjectSchema, RLMProperty, RLMObjectBase;
-
-NS_ASSUME_NONNULL_BEGIN
-
-//
-// Accessors Class Creation/Caching
-//
-
-// get accessor classes for an object class - generates classes if not cached
-Class RLMManagedAccessorClassForObjectClass(Class objectClass, RLMObjectSchema *schema, const char *name);
-Class RLMUnmanagedAccessorClassForObjectClass(Class objectClass, RLMObjectSchema *schema);
-
-//
-// Dynamic getters/setters
-//
-FOUNDATION_EXTERN void RLMDynamicValidatedSet(RLMObjectBase *obj, NSString *propName, id __nullable val);
-FOUNDATION_EXTERN id __nullable RLMDynamicGet(RLMObjectBase *obj, RLMProperty *prop);
-FOUNDATION_EXTERN id __nullable RLMDynamicGetByName(RLMObjectBase *obj, NSString *propName);
-
-// by property/column
-void RLMDynamicSet(RLMObjectBase *obj, RLMProperty *prop, id val);
-
-//
-// Class modification
-//
-
-// Replace className method for the given class
-void RLMReplaceClassNameMethod(Class accessorClass, NSString *className);
-
-// Replace sharedSchema method for the given class
-void RLMReplaceSharedSchemaMethod(Class accessorClass, RLMObjectSchema * __nullable schema);
-
-NS_ASSUME_NONNULL_END

+ 0 - 117
Carthage/Checkouts/realm-cocoa/Realm/RLMAccessor.hpp

@@ -1,117 +0,0 @@
-////////////////////////////////////////////////////////////////////////////
-//
-// Copyright 2017 Realm Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////
-
-#import "RLMAccessor.h"
-
-#import "object_accessor.hpp"
-
-#import "RLMUtil.hpp"
-
-@class RLMRealm;
-class RLMClassInfo;
-class RLMObservationInfo;
-
-// realm::util::Optional<id> doesn't work because Objective-C types can't
-// be members of unions with ARC, so this covers the subset of Optional that we
-// actually need.
-struct RLMOptionalId {
-    id value;
-    RLMOptionalId(id value) : value(value) { }
-    explicit operator bool() const noexcept { return value; }
-    id operator*() const noexcept { return value; }
-};
-
-class RLMAccessorContext {
-public:
-    // Accessor context interface
-    RLMAccessorContext(RLMAccessorContext& parent, realm::Property const& property);
-
-    id box(realm::List&&);
-    id box(realm::Results&&);
-    id box(realm::Object&&);
-    id box(realm::Obj&&);
-
-    id box(bool v) { return @(v); }
-    id box(double v) { return @(v); }
-    id box(float v) { return @(v); }
-    id box(long long v) { return @(v); }
-    id box(realm::StringData v) { return RLMStringDataToNSString(v) ?: NSNull.null; }
-    id box(realm::BinaryData v) { return RLMBinaryDataToNSData(v) ?: NSNull.null; }
-    id box(realm::Timestamp v) { return RLMTimestampToNSDate(v) ?: NSNull.null; }
-    id box(realm::Mixed v) { return RLMMixedToObjc(v); }
-
-    id box(realm::util::Optional<bool> v) { return v ? @(*v) : NSNull.null; }
-    id box(realm::util::Optional<double> v) { return v ? @(*v) : NSNull.null; }
-    id box(realm::util::Optional<float> v) { return v ? @(*v) : NSNull.null; }
-    id box(realm::util::Optional<int64_t> v) { return v ? @(*v) : NSNull.null; }
-
-    void will_change(realm::Obj const&, realm::Property const&);
-    void will_change(realm::Object& obj, realm::Property const& prop) { will_change(obj.obj(), prop); }
-    void did_change();
-
-    RLMOptionalId value_for_property(id dict, realm::Property const&, size_t prop_index);
-    RLMOptionalId default_value_for_property(realm::ObjectSchema const&,
-                                             realm::Property const& prop);
-
-    bool is_same_list(realm::List const& list, id v) const noexcept;
-
-    template<typename Func>
-    void enumerate_list(__unsafe_unretained const id v, Func&& func) {
-        id enumerable = RLMAsFastEnumeration(v) ?: v;
-        for (id value in enumerable) {
-            func(value);
-        }
-    }
-
-    template<typename T>
-    T unbox(id v, realm::CreatePolicy = realm::CreatePolicy::Skip, realm::ObjKey = {});
-
-    bool is_null(id v) { return v == NSNull.null; }
-    id null_value() { return NSNull.null; }
-    id no_value() { return nil; }
-    bool allow_missing(id v) { return [v isKindOfClass:[NSArray class]]; }
-
-    std::string print(id obj) { return [obj description].UTF8String; }
-
-    // Internal API
-    RLMAccessorContext(RLMObjectBase *parentObject, const realm::Property *property = nullptr);
-    RLMAccessorContext(RLMClassInfo& info, bool promote=true);
-
-    // The property currently being accessed; needed for KVO things for boxing
-    // List and Results
-    RLMProperty *currentProperty;
-
-private:
-    __unsafe_unretained RLMRealm *const _realm;
-    RLMClassInfo& _info;
-    // If true, promote unmanaged RLMObjects passed to box() with create=true
-    // rather than copying them
-    bool _promote_existing = true;
-    // Parent object of the thing currently being processed, for KVO purposes
-    __unsafe_unretained RLMObjectBase *const _parentObject = nil;
-
-    // Cached default values dictionary to avoid having to call the class method
-    // for every property
-    NSDictionary *_defaultValues;
-
-    RLMObservationInfo *_observationInfo = nullptr;
-    NSString *_kvoPropertyName = nil;
-
-    id defaultValue(NSString *key);
-    id propertyValue(id obj, size_t propIndex, __unsafe_unretained RLMProperty *const prop);
-};

+ 0 - 823
Carthage/Checkouts/realm-cocoa/Realm/RLMAccessor.mm

@@ -1,823 +0,0 @@
-////////////////////////////////////////////////////////////////////////////
-//
-// Copyright 2014 Realm Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////
-
-#import "RLMAccessor.hpp"
-
-#import "RLMArray_Private.hpp"
-#import "RLMListBase.h"
-#import "RLMObjectSchema_Private.hpp"
-#import "RLMObjectStore.h"
-#import "RLMObject_Private.hpp"
-#import "RLMObservation.hpp"
-#import "RLMProperty_Private.h"
-#import "RLMRealm_Private.hpp"
-#import "RLMResults_Private.hpp"
-#import "RLMSchema_Private.h"
-#import "RLMUtil.hpp"
-#import "results.hpp"
-#import "property.hpp"
-
-#import <objc/runtime.h>
-#import <objc/message.h>
-
-#pragma mark - Helper functions
-
-namespace realm {
-template<>
-Obj ConstObj::get<Obj>(ColKey col) const {
-    ObjKey key = get<ObjKey>(col);
-    return key ? get_target_table(col)->get_object(key) : Obj();
-}
-}
-
-namespace {
-using realm::ColKey;
-
-template<typename T>
-bool is_null(T const& v) {
-    return !v;
-}
-template<>
-bool is_null(realm::Timestamp const& v) {
-    return v.is_null();
-}
-
-template<typename T>
-T get(__unsafe_unretained RLMObjectBase *const obj, NSUInteger index) {
-    RLMVerifyAttached(obj);
-    return obj->_row.get<T>(obj->_info->objectSchema->persisted_properties[index].column_key);
-}
-
-template<typename T>
-id getBoxed(__unsafe_unretained RLMObjectBase *const obj, NSUInteger index) {
-    RLMVerifyAttached(obj);
-    auto& prop = obj->_info->objectSchema->persisted_properties[index];
-    RLMAccessorContext ctx(obj, &prop);
-    auto value = obj->_row.get<T>(prop.column_key);
-    return is_null(value) ? nil : ctx.box(std::move(value));
-}
-
-template<typename T>
-void setValue(__unsafe_unretained RLMObjectBase *const obj, ColKey key, T val) {
-    RLMVerifyInWriteTransaction(obj);
-    obj->_row.set(key, val);
-}
-
-template<typename Fn>
-auto translateError(Fn&& fn) {
-    try {
-        return fn();
-    }
-    catch (std::exception const& e) {
-        @throw RLMException(e);
-    }
-}
-
-void setValue(__unsafe_unretained RLMObjectBase *const obj, ColKey key,
-              __unsafe_unretained NSString *const val) {
-    RLMVerifyInWriteTransaction(obj);
-    translateError([&] {
-        obj->_row.set(key, RLMStringDataWithNSString(val));
-    });
-}
-
-[[gnu::noinline]]
-void setNull(realm::Obj& row, ColKey key) {
-    translateError([&] { row.set_null(key); });
-}
-
-void setValue(__unsafe_unretained RLMObjectBase *const obj,
-              ColKey key, __unsafe_unretained NSDate *const date) {
-    RLMVerifyInWriteTransaction(obj);
-    if (date) {
-        obj->_row.set(key, RLMTimestampForNSDate(date));
-    }
-    else {
-        setNull(obj->_row, key);
-    }
-}
-
-void setValue(__unsafe_unretained RLMObjectBase *const obj, ColKey key,
-              __unsafe_unretained NSData *const data) {
-    RLMVerifyInWriteTransaction(obj);
-    translateError([&] {
-        obj->_row.set(key, RLMBinaryDataForNSData(data));
-    });
-}
-
-void setValue(__unsafe_unretained RLMObjectBase *const obj, ColKey key,
-              __unsafe_unretained RLMObjectBase *const val) {
-    RLMVerifyInWriteTransaction(obj);
-    if (!val) {
-        obj->_row.set(key, realm::null());
-        return;
-    }
-
-    RLMAddObjectToRealm(val, obj->_realm, RLMUpdatePolicyError);
-
-    // make sure it is the correct type
-    if (val->_row.get_table() != obj->_row.get_table()->get_link_target(key)) {
-        @throw RLMException(@"Can't set object of type '%@' to property of type '%@'",
-                            val->_objectSchema.className,
-                            obj->_info->propertyForTableColumn(key).objectClassName);
-    }
-    obj->_row.set(key, val->_row.get_key());
-}
-
-// array getter/setter
-RLMArray *getArray(__unsafe_unretained RLMObjectBase *const obj, NSUInteger propIndex) {
-    RLMVerifyAttached(obj);
-    auto prop = obj->_info->rlmObjectSchema.properties[propIndex];
-    return [[RLMManagedArray alloc] initWithParent:obj property:prop];
-}
-
-void setValue(__unsafe_unretained RLMObjectBase *const obj, ColKey key,
-              __unsafe_unretained id<NSFastEnumeration> const value) {
-    RLMVerifyInWriteTransaction(obj);
-    auto prop = obj->_info->propertyForTableColumn(key);
-    RLMValidateValueForProperty(value, obj->_info->rlmObjectSchema, prop, true);
-
-    realm::List list(obj->_realm->_realm, obj->_row, key);
-    RLMClassInfo *info = obj->_info;
-    if (list.get_type() == realm::PropertyType::Object) {
-        info = &obj->_info->linkTargetType(prop.index);
-    }
-    RLMAccessorContext ctx(*info);
-    translateError([&] {
-        list.assign(ctx, value, realm::CreatePolicy::ForceCreate);
-    });
-}
-
-void setValue(__unsafe_unretained RLMObjectBase *const obj, ColKey key,
-              __unsafe_unretained NSNumber<RLMInt> *const intObject) {
-    RLMVerifyInWriteTransaction(obj);
-
-    if (intObject) {
-        obj->_row.set(key, intObject.longLongValue);
-    }
-    else {
-        setNull(obj->_row, key);
-    }
-}
-
-void setValue(__unsafe_unretained RLMObjectBase *const obj, ColKey key,
-              __unsafe_unretained NSNumber<RLMFloat> *const floatObject) {
-    RLMVerifyInWriteTransaction(obj);
-
-    if (floatObject) {
-        obj->_row.set(key, floatObject.floatValue);
-    }
-    else {
-        setNull(obj->_row, key);
-    }
-}
-
-void setValue(__unsafe_unretained RLMObjectBase *const obj, ColKey key,
-              __unsafe_unretained NSNumber<RLMDouble> *const doubleObject) {
-    RLMVerifyInWriteTransaction(obj);
-
-    if (doubleObject) {
-        obj->_row.set(key, doubleObject.doubleValue);
-    }
-    else {
-        setNull(obj->_row, key);
-    }
-}
-
-void setValue(__unsafe_unretained RLMObjectBase *const obj, ColKey key,
-              __unsafe_unretained NSNumber<RLMBool> *const boolObject) {
-    RLMVerifyInWriteTransaction(obj);
-
-    if (boolObject) {
-        obj->_row.set(key, (bool)boolObject.boolValue);
-    }
-    else {
-        setNull(obj->_row, key);
-    }
-}
-
-RLMLinkingObjects *getLinkingObjects(__unsafe_unretained RLMObjectBase *const obj,
-                                     __unsafe_unretained RLMProperty *const property) {
-    RLMVerifyAttached(obj);
-    auto& objectInfo = obj->_realm->_info[property.objectClassName];
-    auto& linkOrigin = obj->_info->objectSchema->computed_properties[property.index].link_origin_property_name;
-    auto linkingProperty = objectInfo.objectSchema->property_for_name(linkOrigin);
-    auto backlinkView = obj->_row.get_backlink_view(objectInfo.table(), linkingProperty->column_key);
-    realm::Results results(obj->_realm->_realm, std::move(backlinkView));
-    return [RLMLinkingObjects resultsWithObjectInfo:objectInfo results:std::move(results)];
-}
-
-// any getter/setter
-template<typename Type, typename StorageType=Type>
-id makeGetter(NSUInteger index) {
-    return ^(__unsafe_unretained RLMObjectBase *const obj) {
-        return static_cast<Type>(get<StorageType>(obj, index));
-    };
-}
-
-template<typename Type>
-id makeBoxedGetter(NSUInteger index) {
-    return ^(__unsafe_unretained RLMObjectBase *const obj) {
-        return getBoxed<Type>(obj, index);
-    };
-}
-template<typename Type>
-id makeOptionalGetter(NSUInteger index) {
-    return ^(__unsafe_unretained RLMObjectBase *const obj) {
-        return getBoxed<realm::util::Optional<Type>>(obj, index);
-    };
-}
-template<typename Type>
-id makeNumberGetter(NSUInteger index, bool boxed, bool optional) {
-    if (optional) {
-        return makeOptionalGetter<Type>(index);
-    }
-    if (boxed) {
-        return makeBoxedGetter<Type>(index);
-    }
-    return makeGetter<Type>(index);
-}
-
-// dynamic getter with column closure
-id managedGetter(RLMProperty *prop, const char *type) {
-    NSUInteger index = prop.index;
-    if (prop.array && prop.type != RLMPropertyTypeLinkingObjects) {
-        return ^id(__unsafe_unretained RLMObjectBase *const obj) {
-            return getArray(obj, index);
-        };
-    }
-
-    bool boxed = *type == '@';
-    switch (prop.type) {
-        case RLMPropertyTypeInt:
-            if (prop.optional || boxed) {
-                return makeNumberGetter<long long>(index, boxed, prop.optional);
-            }
-            switch (*type) {
-                case 'c': return makeGetter<char, int64_t>(index);
-                case 's': return makeGetter<short, int64_t>(index);
-                case 'i': return makeGetter<int, int64_t>(index);
-                case 'l': return makeGetter<long, int64_t>(index);
-                case 'q': return makeGetter<long long, int64_t>(index);
-                default:
-                    @throw RLMException(@"Unexpected property type for Objective-C type code");
-            }
-        case RLMPropertyTypeFloat:
-            return makeNumberGetter<float>(index, boxed, prop.optional);
-        case RLMPropertyTypeDouble:
-            return makeNumberGetter<double>(index, boxed, prop.optional);
-        case RLMPropertyTypeBool:
-            return makeNumberGetter<bool>(index, boxed, prop.optional);
-        case RLMPropertyTypeString:
-            return makeBoxedGetter<realm::StringData>(index);
-        case RLMPropertyTypeDate:
-            return makeBoxedGetter<realm::Timestamp>(index);
-        case RLMPropertyTypeData:
-            return makeBoxedGetter<realm::BinaryData>(index);
-        case RLMPropertyTypeObject:
-            return makeBoxedGetter<realm::Obj>(index);
-        case RLMPropertyTypeAny:
-            @throw RLMException(@"Cannot create accessor class for schema with Mixed properties");
-        case RLMPropertyTypeLinkingObjects:
-            return ^(__unsafe_unretained RLMObjectBase *const obj) {
-                return getLinkingObjects(obj, prop);
-            };
-    }
-}
-
-template<typename ArgType, typename StorageType=ArgType>
-id makeSetter(__unsafe_unretained RLMProperty *const prop) {
-    NSUInteger index = prop.index;
-    NSString *name = prop.name;
-    if (prop.isPrimary) {
-        return ^(__unused RLMObjectBase *obj, __unused ArgType val) {
-            @throw RLMException(@"Primary key can't be changed after an object is inserted.");
-        };
-    }
-
-    return ^(__unsafe_unretained RLMObjectBase *const obj, ArgType val) {
-        auto set = [&] {
-            setValue(obj, obj->_info->objectSchema->persisted_properties[index].column_key,
-                     static_cast<StorageType>(val));
-        };
-        if (RLMObservationInfo *info = RLMGetObservationInfo(obj->_observationInfo,
-                                                             obj->_row.get_key(), *obj->_info)) {
-            info->willChange(name);
-            set();
-            info->didChange(name);
-        }
-        else {
-            set();
-        }
-    };
-}
-
-// dynamic setter with column closure
-id managedSetter(RLMProperty *prop, const char *type) {
-    if (prop.array && prop.type != RLMPropertyTypeLinkingObjects) {
-        return makeSetter<id<NSFastEnumeration>>(prop);
-    }
-
-    bool boxed = prop.optional || *type == '@';
-    switch (prop.type) {
-        case RLMPropertyTypeInt:
-            if (boxed) {
-                return makeSetter<NSNumber<RLMInt> *>(prop);
-            }
-            switch (*type) {
-                case 'c': return makeSetter<char, long long>(prop);
-                case 's': return makeSetter<short, long long>(prop);
-                case 'i': return makeSetter<int, long long>(prop);
-                case 'l': return makeSetter<long, long long>(prop);
-                case 'q': return makeSetter<long long>(prop);
-                default:
-                    @throw RLMException(@"Unexpected property type for Objective-C type code");
-            }
-        case RLMPropertyTypeFloat:
-            return boxed ? makeSetter<NSNumber<RLMFloat> *>(prop) : makeSetter<float>(prop);
-        case RLMPropertyTypeDouble:
-            return boxed ? makeSetter<NSNumber<RLMDouble> *>(prop) : makeSetter<double>(prop);
-        case RLMPropertyTypeBool:
-            return boxed ? makeSetter<NSNumber<RLMBool> *>(prop) : makeSetter<BOOL, bool>(prop);
-        case RLMPropertyTypeString:         return makeSetter<NSString *>(prop);
-        case RLMPropertyTypeDate:           return makeSetter<NSDate *>(prop);
-        case RLMPropertyTypeData:           return makeSetter<NSData *>(prop);
-        case RLMPropertyTypeAny:            return nil;
-        case RLMPropertyTypeLinkingObjects: return nil;
-        case RLMPropertyTypeObject:         return makeSetter<RLMObjectBase *>(prop);
-    }
-}
-
-// call getter for superclass for property at key
-id superGet(RLMObjectBase *obj, NSString *propName) {
-    typedef id (*getter_type)(RLMObjectBase *, SEL);
-    RLMProperty *prop = obj->_objectSchema[propName];
-    Class superClass = class_getSuperclass(obj.class);
-    getter_type superGetter = (getter_type)[superClass instanceMethodForSelector:prop.getterSel];
-    return superGetter(obj, prop.getterSel);
-}
-
-// call setter for superclass for property at key
-void superSet(RLMObjectBase *obj, NSString *propName, id val) {
-    typedef void (*setter_type)(RLMObjectBase *, SEL, RLMArray *ar);
-    RLMProperty *prop = obj->_objectSchema[propName];
-    Class superClass = class_getSuperclass(obj.class);
-    setter_type superSetter = (setter_type)[superClass instanceMethodForSelector:prop.setterSel];
-    superSetter(obj, prop.setterSel, val);
-}
-
-// getter/setter for unmanaged object
-id unmanagedGetter(RLMProperty *prop, const char *) {
-    // only override getters for RLMArray and linking objects properties
-    if (prop.type == RLMPropertyTypeLinkingObjects) {
-        return ^(RLMObjectBase *) { return [RLMResults emptyDetachedResults]; };
-    }
-    if (prop.array) {
-        NSString *propName = prop.name;
-        if (prop.type == RLMPropertyTypeObject) {
-            NSString *objectClassName = prop.objectClassName;
-            return ^(RLMObjectBase *obj) {
-                id val = superGet(obj, propName);
-                if (!val) {
-                    val = [[RLMArray alloc] initWithObjectClassName:objectClassName];
-                    superSet(obj, propName, val);
-                }
-                return val;
-            };
-        }
-        auto type = prop.type;
-        auto optional = prop.optional;
-        return ^(RLMObjectBase *obj) {
-            id val = superGet(obj, propName);
-            if (!val) {
-                val = [[RLMArray alloc] initWithObjectType:type optional:optional];
-                superSet(obj, propName, val);
-            }
-            return val;
-        };
-    }
-    return nil;
-}
-
-id unmanagedSetter(RLMProperty *prop, const char *) {
-    // Only RLMArray needs special handling for the unmanaged setter
-    if (!prop.array) {
-        return nil;
-    }
-
-    NSString *propName = prop.name;
-    return ^(RLMObjectBase *obj, id<NSFastEnumeration> values) {
-        auto prop = obj->_objectSchema[propName];
-        RLMValidateValueForProperty(values, obj->_objectSchema, prop, true);
-
-        // make copy when setting (as is the case for all other variants)
-        RLMArray *ar;
-        if (prop.type == RLMPropertyTypeObject)
-            ar = [[RLMArray alloc] initWithObjectClassName:prop.objectClassName];
-        else
-            ar = [[RLMArray alloc] initWithObjectType:prop.type optional:prop.optional];
-        [ar addObjects:values];
-        superSet(obj, propName, ar);
-    };
-}
-
-void addMethod(Class cls, __unsafe_unretained RLMProperty *const prop,
-               id (*getter)(RLMProperty *, const char *),
-               id (*setter)(RLMProperty *, const char *)) {
-    SEL sel = prop.getterSel;
-    auto getterMethod = class_getInstanceMethod(cls, sel);
-    if (!getterMethod) {
-        return;
-    }
-
-    const char *getterType = method_getTypeEncoding(getterMethod);
-    if (id block = getter(prop, getterType)) {
-        class_addMethod(cls, sel, imp_implementationWithBlock(block), getterType);
-    }
-
-    if (!(sel = prop.setterSel)) {
-        return;
-    }
-    auto setterMethod = class_getInstanceMethod(cls, sel);
-    if (!setterMethod) {
-        return;
-    }
-    if (id block = setter(prop, getterType)) { // note: deliberately getterType as it's easier to grab the relevant type from
-        class_addMethod(cls, sel, imp_implementationWithBlock(block), method_getTypeEncoding(setterMethod));
-    }
-}
-
-Class createAccessorClass(Class objectClass,
-                          RLMObjectSchema *schema,
-                          const char *accessorClassName,
-                          id (*getterGetter)(RLMProperty *, const char *),
-                          id (*setterGetter)(RLMProperty *, const char *)) {
-    REALM_ASSERT_DEBUG(RLMIsObjectOrSubclass(objectClass));
-
-    // create and register proxy class which derives from object class
-    Class accClass = objc_allocateClassPair(objectClass, accessorClassName, 0);
-    if (!accClass) {
-        // Class with that name already exists, so just return the pre-existing one
-        // This should only happen for our standalone "accessors"
-        return objc_lookUpClass(accessorClassName);
-    }
-
-    // override getters/setters for each propery
-    for (RLMProperty *prop in schema.properties) {
-        addMethod(accClass, prop, getterGetter, setterGetter);
-    }
-    for (RLMProperty *prop in schema.computedProperties) {
-        addMethod(accClass, prop, getterGetter, setterGetter);
-    }
-
-    objc_registerClassPair(accClass);
-
-    return accClass;
-}
-} // anonymous namespace
-
-#pragma mark - Public Interface
-
-Class RLMManagedAccessorClassForObjectClass(Class objectClass, RLMObjectSchema *schema, const char *name) {
-    return createAccessorClass(objectClass, schema, name, managedGetter, managedSetter);
-}
-
-Class RLMUnmanagedAccessorClassForObjectClass(Class objectClass, RLMObjectSchema *schema) {
-    return createAccessorClass(objectClass, schema,
-                               [@"RLM:Unmanaged " stringByAppendingString:schema.className].UTF8String,
-                               unmanagedGetter, unmanagedSetter);
-}
-
-// implement the class method className on accessors to return the className of the
-// base object
-void RLMReplaceClassNameMethod(Class accessorClass, NSString *className) {
-    Class metaClass = object_getClass(accessorClass);
-    IMP imp = imp_implementationWithBlock(^(Class){ return className; });
-    class_addMethod(metaClass, @selector(className), imp, "@@:");
-}
-
-// implement the shared schema method
-void RLMReplaceSharedSchemaMethod(Class accessorClass, RLMObjectSchema *schema) {
-    Class metaClass = object_getClass(accessorClass);
-    IMP imp = imp_implementationWithBlock(^(Class cls) {
-        if (cls == accessorClass) {
-            return schema;
-        }
-
-        // If we aren't being called directly on the class this was overriden
-        // for, the class is either a subclass which we haven't initialized yet,
-        // or it's a runtime-generated class which should use the parent's
-        // schema. We check for the latter by checking if the immediate
-        // descendent of the desired class is a class generated by us (there
-        // may be further subclasses not generated by us for things like KVO).
-        Class parent = class_getSuperclass(cls);
-        while (parent != accessorClass) {
-            cls = parent;
-            parent = class_getSuperclass(cls);
-        }
-
-        static const char accessorClassPrefix[] = "RLM:";
-        if (!strncmp(class_getName(cls), accessorClassPrefix, sizeof(accessorClassPrefix) - 1)) {
-            return schema;
-        }
-
-        return [RLMSchema sharedSchemaForClass:cls];
-    });
-    class_addMethod(metaClass, @selector(sharedSchema), imp, "@@:");
-}
-
-void RLMDynamicValidatedSet(RLMObjectBase *obj, NSString *propName, id val) {
-    RLMVerifyAttached(obj);
-    RLMObjectSchema *schema = obj->_objectSchema;
-    RLMProperty *prop = schema[propName];
-    if (!prop) {
-        @throw RLMException(@"Invalid property name '%@' for class '%@'.",
-                            propName, obj->_objectSchema.className);
-    }
-    if (prop.isPrimary) {
-        @throw RLMException(@"Primary key can't be changed to '%@' after an object is inserted.", val);
-    }
-    RLMValidateValueForProperty(val, schema, prop, true);
-    RLMDynamicSet(obj, prop, RLMCoerceToNil(val));
-}
-
-// Precondition: the property is not a primary key
-void RLMDynamicSet(__unsafe_unretained RLMObjectBase *const obj,
-                   __unsafe_unretained RLMProperty *const prop,
-                   __unsafe_unretained id const val) {
-    REALM_ASSERT_DEBUG(!prop.isPrimary);
-    realm::Object o(obj->_info->realm->_realm, *obj->_info->objectSchema, obj->_row);
-    RLMAccessorContext c(obj);
-    translateError([&] {
-        o.set_property_value(c, prop.columnName.UTF8String, val ?: NSNull.null);
-    });
-}
-
-id RLMDynamicGet(__unsafe_unretained RLMObjectBase *const obj, __unsafe_unretained RLMProperty *const prop) {
-    realm::Object o(obj->_realm->_realm, *obj->_info->objectSchema, obj->_row);
-    RLMAccessorContext c(obj);
-    c.currentProperty = prop;
-    return translateError([&] {
-        return RLMCoerceToNil(o.get_property_value<id>(c, prop.columnName.UTF8String));
-    });
-}
-
-id RLMDynamicGetByName(__unsafe_unretained RLMObjectBase *const obj,
-                       __unsafe_unretained NSString *const propName) {
-    RLMProperty *prop = obj->_objectSchema[propName];
-    if (!prop) {
-        @throw RLMException(@"Invalid property name '%@' for class '%@'.",
-                            propName, obj->_objectSchema.className);
-    }
-    return RLMDynamicGet(obj, prop);
-}
-
-RLMAccessorContext::RLMAccessorContext(RLMAccessorContext& parent, realm::Property const& property)
-: _realm(parent._realm)
-, _info(property.type == realm::PropertyType::Object ? parent._info.linkTargetType(property) : parent._info)
-, _promote_existing(parent._promote_existing)
-{
-}
-
-RLMAccessorContext::RLMAccessorContext(RLMClassInfo& info, bool promote)
-: _realm(info.realm), _info(info), _promote_existing(promote)
-{
-}
-
-RLMAccessorContext::RLMAccessorContext(__unsafe_unretained RLMObjectBase *const parent,
-                                       const realm::Property *prop)
-: _realm(parent->_realm)
-, _info(prop && prop->type == realm::PropertyType::Object ? parent->_info->linkTargetType(*prop)
-                                                          : *parent->_info)
-, _parentObject(parent)
-{
-}
-
-id RLMAccessorContext::defaultValue(__unsafe_unretained NSString *const key) {
-    if (!_defaultValues) {
-        _defaultValues = RLMDefaultValuesForObjectSchema(_info.rlmObjectSchema);
-    }
-    return _defaultValues[key];
-}
-
-id RLMAccessorContext::propertyValue(__unsafe_unretained id const obj, size_t propIndex,
-                                     __unsafe_unretained RLMProperty *const prop) {
-    // Property value from an NSArray
-    if ([obj respondsToSelector:@selector(objectAtIndex:)]) {
-        return propIndex < [obj count] ? [obj objectAtIndex:propIndex] : nil;
-    }
-
-    // Property value from an NSDictionary
-    if ([obj respondsToSelector:@selector(objectForKey:)]) {
-        return [obj objectForKey:prop.name];
-    }
-
-    // Property value from an instance of this object type
-    id value;
-    if ([obj isKindOfClass:_info.rlmObjectSchema.objectClass] && prop.swiftIvar) {
-        if (prop.array) {
-            return static_cast<RLMListBase *>(object_getIvar(obj, prop.swiftIvar))._rlmArray;
-        }
-        else { // optional
-            value = RLMGetOptional(static_cast<RLMOptionalBase *>(object_getIvar(obj, prop.swiftIvar)));
-        }
-    }
-    else {
-    // Property value from some object that's KVC-compatible
-        value = RLMValidatedValueForProperty(obj, [obj respondsToSelector:prop.getterSel] ? prop.getterName : prop.name,
-                                             _info.rlmObjectSchema.className);
-    }
-    return value ?: NSNull.null;
-}
-
-id RLMAccessorContext::box(realm::List&& l) {
-    REALM_ASSERT(_parentObject);
-    REALM_ASSERT(currentProperty);
-    return [[RLMManagedArray alloc] initWithList:std::move(l)
-                                      parentInfo:_parentObject->_info
-                                        property:currentProperty];
-}
-
-id RLMAccessorContext::box(realm::Object&& o) {
-    REALM_ASSERT(currentProperty);
-    return RLMCreateObjectAccessor(_info.linkTargetType(currentProperty.index), o.obj());
-}
-
-id RLMAccessorContext::box(realm::Obj&& r) {
-    return RLMCreateObjectAccessor(_info, std::move(r));
-}
-
-id RLMAccessorContext::box(realm::Results&& r) {
-    REALM_ASSERT(currentProperty);
-    return [RLMResults resultsWithObjectInfo:_realm->_info[currentProperty.objectClassName]
-                                     results:std::move(r)];
-}
-
-using realm::ObjKey;
-using realm::CreatePolicy;
-
-template<>
-realm::Timestamp RLMAccessorContext::unbox(__unsafe_unretained id const value, CreatePolicy, ObjKey) {
-    id v = RLMCoerceToNil(value);
-    return RLMTimestampForNSDate(v);
-}
-
-template<>
-bool RLMAccessorContext::unbox(__unsafe_unretained id const v, CreatePolicy, ObjKey) {
-    return [v boolValue];
-}
-template<>
-double RLMAccessorContext::unbox(__unsafe_unretained id const v, CreatePolicy, ObjKey) {
-    return [v doubleValue];
-}
-template<>
-float RLMAccessorContext::unbox(__unsafe_unretained id const v, CreatePolicy, ObjKey) {
-    return [v floatValue];
-}
-template<>
-long long RLMAccessorContext::unbox(__unsafe_unretained id const v, CreatePolicy, ObjKey) {
-    return [v longLongValue];
-}
-template<>
-realm::BinaryData RLMAccessorContext::unbox(id v, CreatePolicy, ObjKey) {
-    v = RLMCoerceToNil(v);
-    return RLMBinaryDataForNSData(v);
-}
-template<>
-realm::StringData RLMAccessorContext::unbox(id v, CreatePolicy, ObjKey) {
-    v = RLMCoerceToNil(v);
-    return RLMStringDataWithNSString(v);
-}
-
-template<typename Fn>
-static auto to_optional(__unsafe_unretained id const value, Fn&& fn) {
-    id v = RLMCoerceToNil(value);
-    return v && v != NSNull.null ? realm::util::make_optional(fn(v)) : realm::util::none;
-}
-
-template<>
-realm::util::Optional<bool> RLMAccessorContext::unbox(__unsafe_unretained id const v, CreatePolicy, ObjKey) {
-    return to_optional(v, [&](__unsafe_unretained id v) { return (bool)[v boolValue]; });
-}
-template<>
-realm::util::Optional<double> RLMAccessorContext::unbox(__unsafe_unretained id const v, CreatePolicy, ObjKey) {
-    return to_optional(v, [&](__unsafe_unretained id v) { return [v doubleValue]; });
-}
-template<>
-realm::util::Optional<float> RLMAccessorContext::unbox(__unsafe_unretained id const v, CreatePolicy, ObjKey) {
-    return to_optional(v, [&](__unsafe_unretained id v) { return [v floatValue]; });
-}
-template<>
-realm::util::Optional<int64_t> RLMAccessorContext::unbox(__unsafe_unretained id const v, CreatePolicy, ObjKey) {
-    return to_optional(v, [&](__unsafe_unretained id v) { return [v longLongValue]; });
-}
-
-template<>
-realm::Obj RLMAccessorContext::unbox(__unsafe_unretained id const v, CreatePolicy createPolicy, ObjKey) {
-    bool create = createPolicy != CreatePolicy::Skip;
-    auto policy = static_cast<RLMUpdatePolicy>(createPolicy);
-    RLMObjectBase *link = RLMDynamicCast<RLMObjectBase>(v);
-    if (!link) {
-        if (!create)
-            return realm::Obj();
-        return RLMCreateObjectInRealmWithValue(_realm, _info.rlmObjectSchema.className, v, policy)->_row;
-    }
-
-    if (link.isInvalidated) {
-        if (create) {
-            @throw RLMException(@"Adding a deleted or invalidated object to a Realm is not permitted");
-        }
-        else {
-            @throw RLMException(@"Object has been invalidated");
-        }
-    }
-
-    if (![link->_objectSchema.className isEqualToString:_info.rlmObjectSchema.className]) {
-        if (create && !_promote_existing)
-            return RLMCreateObjectInRealmWithValue(_realm, _info.rlmObjectSchema.className, link, policy)->_row;
-        return link->_row;
-    }
-
-    if (!link->_realm) {
-        if (!create)
-            return realm::Obj();
-        if (!_promote_existing)
-            return RLMCreateObjectInRealmWithValue(_realm, _info.rlmObjectSchema.className, link, policy)->_row;
-        RLMAddObjectToRealm(link, _realm, policy);
-    }
-    else if (link->_realm != _realm) {
-        if (_promote_existing)
-            @throw RLMException(@"Object is already managed by another Realm. Use create instead to copy it into this Realm.");
-        return RLMCreateObjectInRealmWithValue(_realm, _info.rlmObjectSchema.className, v, policy)->_row;
-    }
-    return link->_row;
-}
-
-void RLMAccessorContext::will_change(realm::Obj const& row, realm::Property const& prop) {
-    _observationInfo = RLMGetObservationInfo(nullptr, row.get_key(), _info);
-    if (_observationInfo) {
-        _kvoPropertyName = _info.propertyForTableColumn(prop.column_key).name;
-        _observationInfo->willChange(_kvoPropertyName);
-    }
-}
-
-void RLMAccessorContext::did_change() {
-    if (_observationInfo) {
-        _observationInfo->didChange(_kvoPropertyName);
-        _kvoPropertyName = nil;
-        _observationInfo = nullptr;
-    }
-}
-
-RLMOptionalId RLMAccessorContext::value_for_property(__unsafe_unretained id const obj,
-                                                     realm::Property const&, size_t propIndex) {
-    auto prop = _info.rlmObjectSchema.properties[propIndex];
-    id value = propertyValue(obj, propIndex, prop);
-    if (value) {
-        RLMValidateValueForProperty(value, _info.rlmObjectSchema, prop);
-    }
-
-    if (_promote_existing && [obj isKindOfClass:_info.rlmObjectSchema.objectClass] && !prop.swiftIvar) {
-        // set the ivars for object and array properties to nil as otherwise the
-        // accessors retain objects that are no longer accessible via the properties
-        // this is mainly an issue when the object graph being added has cycles,
-        // as it's not obvious that the user has to set the *ivars* to nil to
-        // avoid leaking memory
-        if (prop.type == RLMPropertyTypeObject) {
-            ((void(*)(id, SEL, id))objc_msgSend)(obj, prop.setterSel, nil);
-        }
-    }
-
-    return RLMOptionalId{value};
-}
-
-RLMOptionalId RLMAccessorContext::default_value_for_property(realm::ObjectSchema const&,
-                                                             realm::Property const& prop)
-{
-    return RLMOptionalId{defaultValue(@(prop.name.c_str()))};
-}
-
-bool RLMAccessorContext::is_same_list(realm::List const& list, __unsafe_unretained id const v) const noexcept {
-    return [v respondsToSelector:@selector(isBackedByList:)] && [v isBackedByList:list];
-}
-
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wincomplete-implementation"
-@implementation RLMManagedPropertyAccessor
-@end
-#pragma clang diagnostic pop

+ 0 - 55
Carthage/Checkouts/realm-cocoa/Realm/RLMAnalytics.hpp

@@ -1,55 +0,0 @@
-////////////////////////////////////////////////////////////////////////////
-//
-// Copyright 2015 Realm Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////
-
-// Asynchronously submits build information to Realm if running in an iOS
-// simulator or on OS X if a debugger is attached. Does nothing if running on an
-// iOS / watchOS device or if a debugger is *not* attached.
-//
-// To be clear: this does *not* run when your app is in production or on
-// your end-user’s devices; it will only run in the simulator or when a debugger
-// is attached.
-//
-// Why are we doing this? In short, because it helps us build a better product
-// for you. None of the data personally identifies you, your employer or your
-// app, but it *will* help us understand what language you use, what iOS
-// versions you target, etc. Having this info will help prioritizing our time,
-// adding new features and deprecating old features. Collecting an anonymized
-// bundle & anonymized MAC is the only way for us to count actual usage of the
-// other metrics accurately. If we don’t have a way to deduplicate the info
-// reported, it will be useless, as a single developer building their Swift app
-// 10 times would report 10 times more than a single Objective-C developer that
-// only builds once, making the data all but useless.
-// No one likes sharing data unless it’s necessary, we get it, and we’ve
-// debated adding this for a long long time. Since Realm is a free product
-// without an email signup, we feel this is a necessary step so we can collect
-// relevant data to build a better product for you. If you truly, absolutely
-// feel compelled to not send this data back to Realm, then you can set an env
-// variable named REALM_DISABLE_ANALYTICS. Since Realm is free we believe
-// letting these analytics run is a small price to pay for the product & support
-// we give you.
-//
-// Currently the following information is reported:
-// - What version of Realm is being used, and from which language (obj-c or Swift).
-// - What version of OS X it's running on (in case Xcode aggressively drops
-//   support for older versions again, we need to know what we need to support).
-// - The minimum iOS/OS X version that the application is targeting (again, to
-//   help us decide what versions we need to support).
-// - An anonymous MAC address and bundle ID to aggregate the other information on.
-// - What version of Swift is being used (if applicable).
-
-void RLMSendAnalytics();

+ 0 - 247
Carthage/Checkouts/realm-cocoa/Realm/RLMAnalytics.mm

@@ -1,247 +0,0 @@
-////////////////////////////////////////////////////////////////////////////
-//
-// Copyright 2015 Realm Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////
-
-// Asynchronously submits build information to Realm if running in an iOS
-// simulator or on OS X if a debugger is attached. Does nothing if running on an
-// iOS / watchOS device or if a debugger is *not* attached.
-//
-// To be clear: this does *not* run when your app is in production or on
-// your end-user’s devices; it will only run in the simulator or when a debugger
-// is attached.
-//
-// Why are we doing this? In short, because it helps us build a better product
-// for you. None of the data personally identifies you, your employer or your
-// app, but it *will* help us understand what language you use, what iOS
-// versions you target, etc. Having this info will help prioritizing our time,
-// adding new features and deprecating old features. Collecting an anonymized
-// bundle & anonymized MAC is the only way for us to count actual usage of the
-// other metrics accurately. If we don’t have a way to deduplicate the info
-// reported, it will be useless, as a single developer building their Swift app
-// 10 times would report 10 times more than a single Objective-C developer that
-// only builds once, making the data all but useless.
-// No one likes sharing data unless it’s necessary, we get it, and we’ve
-// debated adding this for a long long time. Since Realm is a free product
-// without an email signup, we feel this is a necessary step so we can collect
-// relevant data to build a better product for you. If you truly, absolutely
-// feel compelled to not send this data back to Realm, then you can set an env
-// variable named REALM_DISABLE_ANALYTICS. Since Realm is free we believe
-// letting these analytics run is a small price to pay for the product & support
-// we give you.
-//
-// Currently the following information is reported:
-// - What version of Realm is being used, and from which language (obj-c or Swift).
-// - What version of OS X it's running on (in case Xcode aggressively drops
-//   support for older versions again, we need to know what we need to support).
-// - The minimum iOS/OS X version that the application is targeting (again, to
-//   help us decide what versions we need to support).
-// - An anonymous MAC address and bundle ID to aggregate the other information on.
-// - What version of Swift is being used (if applicable).
-
-#import "RLMAnalytics.hpp"
-
-#import <Foundation/Foundation.h>
-
-#if TARGET_IPHONE_SIMULATOR || TARGET_OS_MAC || (TARGET_OS_WATCH && TARGET_OS_SIMULATOR) || (TARGET_OS_TV && TARGET_OS_SIMULATOR)
-#import "RLMRealm.h"
-#import "RLMUtil.hpp"
-
-#import <array>
-#import <sys/socket.h>
-#import <sys/sysctl.h>
-#import <net/if.h>
-#import <net/if_dl.h>
-
-#import <CommonCrypto/CommonDigest.h>
-
-#ifndef REALM_COCOA_VERSION
-#import "RLMVersion.h"
-#endif
-
-#if REALM_ENABLE_SYNC
-#import <realm/sync/version.hpp>
-#endif
-
-// Declared for RealmSwiftObjectUtil
-@interface NSObject (SwiftVersion)
-+ (NSString *)swiftVersion;
-@end
-
-// Wrapper for sysctl() that handles the memory management stuff
-static auto RLMSysCtl(int *mib, u_int mibSize, size_t *bufferSize) {
-    std::unique_ptr<void, decltype(&free)> buffer(nullptr, &free);
-
-    int ret = sysctl(mib, mibSize, nullptr, bufferSize, nullptr, 0);
-    if (ret != 0) {
-        return buffer;
-    }
-
-    buffer.reset(malloc(*bufferSize));
-    if (!buffer) {
-        return buffer;
-    }
-
-    ret = sysctl(mib, mibSize, buffer.get(), bufferSize, nullptr, 0);
-    if (ret != 0) {
-        buffer.reset();
-    }
-
-    return buffer;
-}
-
-// Get the version of OS X we're running on (even in the simulator this gives
-// the OS X version and not the simulated iOS version)
-static NSString *RLMOSVersion() {
-    std::array<int, 2> mib = {{CTL_KERN, KERN_OSRELEASE}};
-    size_t bufferSize;
-    auto buffer = RLMSysCtl(&mib[0], mib.size(), &bufferSize);
-    if (!buffer) {
-        return nil;
-    }
-
-    return [[NSString alloc] initWithBytesNoCopy:buffer.release()
-                                          length:bufferSize - 1
-                                        encoding:NSUTF8StringEncoding
-                                    freeWhenDone:YES];
-}
-
-// Hash the data in the given buffer and convert it to a hex-format string
-static NSString *RLMHashData(const void *bytes, size_t length) {
-    unsigned char buffer[CC_SHA256_DIGEST_LENGTH];
-    CC_SHA256(bytes, static_cast<CC_LONG>(length), buffer);
-
-    char formatted[CC_SHA256_DIGEST_LENGTH * 2 + 1];
-    for (int i = 0; i < CC_SHA256_DIGEST_LENGTH; ++i) {
-        sprintf(formatted + i * 2, "%02x", buffer[i]);
-    }
-
-    return [[NSString alloc] initWithBytes:formatted
-                                    length:CC_SHA256_DIGEST_LENGTH * 2
-                                  encoding:NSUTF8StringEncoding];
-}
-
-// Returns the hash of the MAC address of the first network adaptor since the
-// vendorIdentifier isn't constant between iOS simulators.
-static NSString *RLMMACAddress() {
-    int en0 = static_cast<int>(if_nametoindex("en0"));
-    if (!en0) {
-        return nil;
-    }
-
-    std::array<int, 6> mib = {{CTL_NET, PF_ROUTE, 0, AF_LINK, NET_RT_IFLIST, en0}};
-    size_t bufferSize;
-    auto buffer = RLMSysCtl(&mib[0], mib.size(), &bufferSize);
-    if (!buffer) {
-        return nil;
-    }
-
-    // sockaddr_dl struct is immediately after the if_msghdr struct in the buffer
-    auto sockaddr = reinterpret_cast<sockaddr_dl *>(static_cast<if_msghdr *>(buffer.get()) + 1);
-    auto mac = reinterpret_cast<const unsigned char *>(sockaddr->sdl_data + sockaddr->sdl_nlen);
-
-    return RLMHashData(mac, 6);
-}
-
-static NSDictionary *RLMAnalyticsPayload() {
-    NSBundle *appBundle = NSBundle.mainBundle;
-    NSString *hashedBundleID = appBundle.bundleIdentifier;
-
-    // Main bundle isn't always the one of interest (e.g. when running tests
-    // it's xctest rather than the app's bundle), so look for one with a bundle ID
-    if (!hashedBundleID) {
-        for (NSBundle *bundle in NSBundle.allBundles) {
-            if ((hashedBundleID = bundle.bundleIdentifier)) {
-                appBundle = bundle;
-                break;
-            }
-        }
-    }
-
-    // If we found a bundle ID anywhere, hash it as it could contain sensitive
-    // information (e.g. the name of an unnanounced product)
-    if (hashedBundleID) {
-        NSData *data = [hashedBundleID dataUsingEncoding:NSUTF8StringEncoding];
-        hashedBundleID = RLMHashData(data.bytes, data.length);
-    }
-
-    NSString *osVersionString = [[NSProcessInfo processInfo] operatingSystemVersionString];
-    Class swiftObjectUtilClass = NSClassFromString(@"RealmSwiftObjectUtil");
-    BOOL isSwift = swiftObjectUtilClass != nil;
-    NSString *swiftVersion = isSwift ? [swiftObjectUtilClass swiftVersion] : @"N/A";
-
-    static NSString *kUnknownString = @"unknown";
-    NSString *hashedMACAddress = RLMMACAddress() ?: kUnknownString;
-
-    return @{
-             @"event": @"Run",
-             @"properties": @{
-                     // MixPanel properties
-                     @"token": @"ce0fac19508f6c8f20066d345d360fd0",
-
-                     // Anonymous identifiers to deduplicate events
-                     @"distinct_id": hashedMACAddress,
-                     @"Anonymized MAC Address": hashedMACAddress,
-                     @"Anonymized Bundle ID": hashedBundleID ?: kUnknownString,
-
-                     // Which version of Realm is being used
-                     @"Binding": @"cocoa",
-                     @"Language": isSwift ? @"swift" : @"objc",
-                     @"Realm Version": REALM_COCOA_VERSION,
-#if REALM_ENABLE_SYNC
-                     @"Sync Version": @(REALM_SYNC_VER_STRING),
-#endif
-#if TARGET_OS_WATCH
-                     @"Target OS Type": @"watchos",
-#elif TARGET_OS_TV
-                     @"Target OS Type": @"tvos",
-#elif TARGET_OS_IPHONE
-                     @"Target OS Type": @"ios",
-#else
-                     @"Target OS Type": @"osx",
-#endif
-                     @"Swift Version": swiftVersion,
-                     // Current OS version the app is targetting
-                     @"Target OS Version": osVersionString,
-                     // Minimum OS version the app is targetting
-                     @"Target OS Minimum Version": appBundle.infoDictionary[@"MinimumOSVersion"] ?: kUnknownString,
-
-                     // Host OS version being built on
-                     @"Host OS Type": @"osx",
-                     @"Host OS Version": RLMOSVersion() ?: kUnknownString,
-                 }
-          };
-}
-
-void RLMSendAnalytics() {
-    if (getenv("REALM_DISABLE_ANALYTICS") || !RLMIsDebuggerAttached() || RLMIsRunningInPlayground()) {
-        return;
-    }
-
-
-    NSData *payload = [NSJSONSerialization dataWithJSONObject:RLMAnalyticsPayload() options:0 error:nil];
-    NSString *url = [NSString stringWithFormat:@"https://api.mixpanel.com/track/?data=%@&ip=1", [payload base64EncodedStringWithOptions:0]];
-
-    // No error handling or anything because logging errors annoyed people for no
-    // real benefit, and it's not clear what else we could do
-    [[NSURLSession.sharedSession dataTaskWithURL:[NSURL URLWithString:url]] resume];
-}
-
-#else
-
-void RLMSendAnalytics() {}
-
-#endif

+ 0 - 517
Carthage/Checkouts/realm-cocoa/Realm/RLMArray.h

@@ -1,517 +0,0 @@
-////////////////////////////////////////////////////////////////////////////
-//
-// Copyright 2014 Realm Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////
-
-#import <Realm/RLMCollection.h>
-
-NS_ASSUME_NONNULL_BEGIN
-
-@class RLMObject, RLMResults<RLMObjectType>;
-
-/**
- `RLMArray` is the container type in Realm used to define to-many relationships.
-
- Unlike an `NSArray`, `RLMArray`s hold a single type, specified by the `objectClassName` property.
- This is referred to in these docs as the “type” of the array.
-
- When declaring an `RLMArray` property, the type must be marked as conforming to a
- protocol by the same name as the objects it should contain (see the
- `RLM_ARRAY_TYPE` macro). In addition, the property can be declared using Objective-C
- generics for better compile-time type safety.
-
-     RLM_ARRAY_TYPE(ObjectType)
-     ...
-     @property RLMArray<ObjectType *><ObjectType> *arrayOfObjectTypes;
-
- `RLMArray`s can be queried with the same predicates as `RLMObject` and `RLMResult`s.
-
- `RLMArray`s cannot be created directly. `RLMArray` properties on `RLMObject`s are
- lazily created when accessed, or can be obtained by querying a Realm.
-
- ### Key-Value Observing
-
- `RLMArray` supports array key-value observing on `RLMArray` properties on `RLMObject`
- subclasses, and the `invalidated` property on `RLMArray` instances themselves is
- key-value observing compliant when the `RLMArray` is attached to a managed
- `RLMObject` (`RLMArray`s on unmanaged `RLMObject`s will never become invalidated).
-
- Because `RLMArray`s are attached to the object which they are a property of, they
- do not require using the mutable collection proxy objects from
- `-mutableArrayValueForKey:` or KVC-compatible mutation methods on the containing
- object. Instead, you can call the mutation methods on the `RLMArray` directly.
- */
-
-@interface RLMArray<RLMObjectType> : NSObject<RLMCollection, NSFastEnumeration>
-
-#pragma mark - Properties
-
-/**
- The number of objects in the array.
- */
-@property (nonatomic, readonly, assign) NSUInteger count;
-
-/**
- The type of the objects in the array.
- */
-@property (nonatomic, readonly, assign) RLMPropertyType type;
-
-/**
- Indicates whether the objects in the collection can be `nil`.
- */
-@property (nonatomic, readonly, getter = isOptional) BOOL optional;
-
-/**
- The class name  of the objects contained in the array.
-
- Will be `nil` if `type` is not RLMPropertyTypeObject.
- */
-@property (nonatomic, readonly, copy, nullable) NSString *objectClassName;
-
-/**
- The Realm which manages the array. Returns `nil` for unmanaged arrays.
- */
-@property (nonatomic, readonly, nullable) RLMRealm *realm;
-
-/**
- Indicates if the array can no longer be accessed.
- */
-@property (nonatomic, readonly, getter = isInvalidated) BOOL invalidated;
-
-/**
- Indicates if the array is frozen.
-
- Frozen arrays are immutable and can be accessed from any thread. Frozen arrays
- are created by calling `-freeze` on a managed live array. Unmanaged arrays are
- never frozen.
- */
-@property (nonatomic, readonly, getter = isFrozen) BOOL frozen;
-
-#pragma mark - Accessing Objects from an Array
-
-/**
- Returns the object at the index specified.
-
- @param index   The index to look up.
-
- @return An object of the type contained in the array.
- */
-- (RLMObjectType)objectAtIndex:(NSUInteger)index;
-
-/**
- Returns the first object in the array.
-
- Returns `nil` if called on an empty array.
-
- @return An object of the type contained in the array.
- */
-- (nullable RLMObjectType)firstObject;
-
-/**
- Returns the last object in the array.
-
- Returns `nil` if called on an empty array.
-
- @return An object of the type contained in the array.
- */
-- (nullable RLMObjectType)lastObject;
-
-
-
-#pragma mark - Adding, Removing, and Replacing Objects in an Array
-
-/**
- Adds an object to the end of the array.
-
- @warning This method may only be called during a write transaction.
-
- @param object  An object of the type contained in the array.
- */
-- (void)addObject:(RLMObjectType)object;
-
-/**
- Adds an array of objects to the end of the array.
-
- @warning This method may only be called during a write transaction.
-
- @param objects     An enumerable object such as `NSArray` or `RLMResults` which contains objects of the
-                    same class as the array.
- */
-- (void)addObjects:(id<NSFastEnumeration>)objects;
-
-/**
- Inserts an object at the given index.
-
- Throws an exception if the index exceeds the bounds of the array.
-
- @warning This method may only be called during a write transaction.
-
- @param anObject  An object of the type contained in the array.
- @param index   The index at which to insert the object.
- */
-- (void)insertObject:(RLMObjectType)anObject atIndex:(NSUInteger)index;
-
-/**
- Removes an object at the given index.
-
- Throws an exception if the index exceeds the bounds of the array.
-
- @warning This method may only be called during a write transaction.
-
- @param index   The array index identifying the object to be removed.
- */
-- (void)removeObjectAtIndex:(NSUInteger)index;
-
-/**
- Removes the last object in the array.
-
- This is a no-op if the array is already empty.
-
- @warning This method may only be called during a write transaction.
-*/
-- (void)removeLastObject;
-
-/**
- Removes all objects from the array.
-
- @warning This method may only be called during a write transaction.
- */
-- (void)removeAllObjects;
-
-/**
- Replaces an object at the given index with a new object.
-
- Throws an exception if the index exceeds the bounds of the array.
-
- @warning This method may only be called during a write transaction.
-
- @param index       The index of the object to be replaced.
- @param anObject    An object (of the same type as returned from the `objectClassName` selector).
- */
-- (void)replaceObjectAtIndex:(NSUInteger)index withObject:(RLMObjectType)anObject;
-
-/**
- Moves the object at the given source index to the given destination index.
-
- Throws an exception if the index exceeds the bounds of the array.
-
- @warning This method may only be called during a write transaction.
-
- @param sourceIndex      The index of the object to be moved.
- @param destinationIndex The index to which the object at `sourceIndex` should be moved.
- */
-- (void)moveObjectAtIndex:(NSUInteger)sourceIndex toIndex:(NSUInteger)destinationIndex;
-
-/**
- Exchanges the objects in the array at given indices.
-
- Throws an exception if either index exceeds the bounds of the array.
-
- @warning This method may only be called during a write transaction.
-
- @param index1 The index of the object which should replace the object at index `index2`.
- @param index2 The index of the object which should replace the object at index `index1`.
- */
-- (void)exchangeObjectAtIndex:(NSUInteger)index1 withObjectAtIndex:(NSUInteger)index2;
-
-#pragma mark - Querying an Array
-
-/**
- Returns the index of an object in the array.
-
- Returns `NSNotFound` if the object is not found in the array.
-
- @param object  An object (of the same type as returned from the `objectClassName` selector).
- */
-- (NSUInteger)indexOfObject:(RLMObjectType)object;
-
-/**
- Returns the index of the first object in the array matching the predicate.
-
- @param predicateFormat A predicate format string, optionally followed by a variable number of arguments.
-
- @return    The index of the object, or `NSNotFound` if the object is not found in the array.
- */
-- (NSUInteger)indexOfObjectWhere:(NSString *)predicateFormat, ...;
-
-/// :nodoc:
-- (NSUInteger)indexOfObjectWhere:(NSString *)predicateFormat args:(va_list)args;
-
-/**
- Returns the index of the first object in the array matching the predicate.
-
- @param predicate   The predicate with which to filter the objects.
-
- @return    The index of the object, or `NSNotFound` if the object is not found in the array.
- */
-- (NSUInteger)indexOfObjectWithPredicate:(NSPredicate *)predicate;
-
-/**
- Returns all the objects matching the given predicate in the array.
-
- @param predicateFormat A predicate format string, optionally followed by a variable number of arguments.
-
- @return                An `RLMResults` of objects that match the given predicate.
- */
-- (RLMResults<RLMObjectType> *)objectsWhere:(NSString *)predicateFormat, ...;
-
-/// :nodoc:
-- (RLMResults<RLMObjectType> *)objectsWhere:(NSString *)predicateFormat args:(va_list)args;
-
-/**
- Returns all the objects matching the given predicate in the array.
-
- @param predicate   The predicate with which to filter the objects.
-
- @return            An `RLMResults` of objects that match the given predicate
- */
-- (RLMResults<RLMObjectType> *)objectsWithPredicate:(NSPredicate *)predicate;
-
-/**
- Returns a sorted `RLMResults` from the array.
-
- @param keyPath     The key path to sort by.
- @param ascending   The direction to sort in.
-
- @return    An `RLMResults` sorted by the specified key path.
- */
-- (RLMResults<RLMObjectType> *)sortedResultsUsingKeyPath:(NSString *)keyPath ascending:(BOOL)ascending;
-
-/**
- Returns a sorted `RLMResults` from the array.
-
- @param properties  An array of `RLMSortDescriptor`s to sort by.
-
- @return    An `RLMResults` sorted by the specified properties.
- */
-- (RLMResults<RLMObjectType> *)sortedResultsUsingDescriptors:(NSArray<RLMSortDescriptor *> *)properties;
-
-/**
- Returns a distinct `RLMResults` from the array.
-
- @param keyPaths     The key paths to distinct on.
-
- @return    An `RLMResults` with the distinct values of the keypath(s).
- */
-- (RLMResults<RLMObjectType> *)distinctResultsUsingKeyPaths:(NSArray<NSString *> *)keyPaths;
-
-/// :nodoc:
-- (RLMObjectType)objectAtIndexedSubscript:(NSUInteger)index;
-
-/// :nodoc:
-- (void)setObject:(RLMObjectType)newValue atIndexedSubscript:(NSUInteger)index;
-
-#pragma mark - Notifications
-
-/**
- Registers a block to be called each time the array changes.
-
- The block will be asynchronously called with the initial array, and then
- called again after each write transaction which changes any of the objects in
- the array, which objects are in the results, or the order of the objects in the
- array.
-
- The `changes` parameter will be `nil` the first time the block is called.
- For each call after that, it will contain information about
- which rows in the array were added, removed or modified. If a write transaction
- did not modify any objects in the array, the block is not called at all.
- See the `RLMCollectionChange` documentation for information on how the changes
- are reported and an example of updating a `UITableView`.
-
- If an error occurs the block will be called with `nil` for the results
- parameter and a non-`nil` error. Currently the only errors that can occur are
- when opening the Realm on the background worker thread.
-
- Notifications are delivered via the standard run loop, and so can't be
- delivered while the run loop is blocked by other activity. When
- notifications can't be delivered instantly, multiple notifications may be
- coalesced into a single notification. This can include the notification
- with the initial results. For example, the following code performs a write
- transaction immediately after adding the notification block, so there is no
- opportunity for the initial notification to be delivered first. As a
- result, the initial notification will reflect the state of the Realm after
- the write transaction.
-
-     Person *person = [[Person allObjectsInRealm:realm] firstObject];
-     NSLog(@"person.dogs.count: %zu", person.dogs.count); // => 0
-     self.token = [person.dogs addNotificationBlock(RLMArray<Dog *> *dogs,
-                                                    RLMCollectionChange *changes,
-                                                    NSError *error) {
-         // Only fired once for the example
-         NSLog(@"dogs.count: %zu", dogs.count) // => 1
-     }];
-     [realm transactionWithBlock:^{
-         Dog *dog = [[Dog alloc] init];
-         dog.name = @"Rex";
-         [person.dogs addObject:dog];
-     }];
-     // end of run loop execution context
-
- You must retain the returned token for as long as you want updates to continue
- to be sent to the block. To stop receiving updates, call `-invalidate` on the token.
-
- @warning This method cannot be called during a write transaction, or when the
-          containing Realm is read-only.
- @warning This method may only be called on a non-frozen managed array.
-
- @param block The block to be called each time the array changes.
- @return A token which must be held for as long as you want updates to be delivered.
- */
-- (RLMNotificationToken *)addNotificationBlock:(void (^)(RLMArray<RLMObjectType> *_Nullable array,
-                                                         RLMCollectionChange *_Nullable changes,
-                                                         NSError *_Nullable error))block
-__attribute__((warn_unused_result));
-
-/**
- Registers a block to be called each time the array changes.
-
- The block will be asynchronously called with the initial array, and then
- called again after each write transaction which changes any of the objects in
- the array, which objects are in the results, or the order of the objects in the
- array.
-
- The `changes` parameter will be `nil` the first time the block is called.
- For each call after that, it will contain information about
- which rows in the array were added, removed or modified. If a write transaction
- did not modify any objects in the array, the block is not called at all.
- See the `RLMCollectionChange` documentation for information on how the changes
- are reported and an example of updating a `UITableView`.
-
- If an error occurs the block will be called with `nil` for the results
- parameter and a non-`nil` error. Currently the only errors that can occur are
- when opening the Realm on the background worker thread.
-
- Notifications are delivered on the given queue. If the queue is blocked and
- notifications can't be delivered instantly, multiple notifications may be
- coalesced into a single notification.
-
- You must retain the returned token for as long as you want updates to continue
- to be sent to the block. To stop receiving updates, call `-invalidate` on the token.
-
- @warning This method cannot be called when the containing Realm is read-only or frozen.
- @warning The queue must be a serial queue.
-
- @param block The block to be called whenever a change occurs.
- @param queue The serial queue to deliver notifications to.
- @return A token which must be held for as long as you want updates to be delivered.
- */
-- (RLMNotificationToken *)addNotificationBlock:(void (^)(RLMArray<RLMObjectType> *_Nullable array,
-                                                         RLMCollectionChange *_Nullable changes,
-                                                         NSError *_Nullable error))block
-                                         queue:(nullable dispatch_queue_t)queue
-__attribute__((warn_unused_result));
-
-#pragma mark - Aggregating Property Values
-
-/**
- Returns the minimum (lowest) value of the given property among all the objects in the array.
-
-     NSNumber *min = [object.arrayProperty minOfProperty:@"age"];
-
- @warning You cannot use this method on `RLMObject`, `RLMArray`, and `NSData` properties.
-
- @param property The property whose minimum value is desired. Only properties of
-                 types `int`, `float`, `double`, and `NSDate` are supported.
-
- @return The minimum value of the property, or `nil` if the array is empty.
- */
-- (nullable id)minOfProperty:(NSString *)property;
-
-/**
- Returns the maximum (highest) value of the given property among all the objects in the array.
-
-     NSNumber *max = [object.arrayProperty maxOfProperty:@"age"];
-
- @warning You cannot use this method on `RLMObject`, `RLMArray`, and `NSData` properties.
-
- @param property The property whose maximum value is desired. Only properties of
-                 types `int`, `float`, `double`, and `NSDate` are supported.
-
- @return The maximum value of the property, or `nil` if the array is empty.
- */
-- (nullable id)maxOfProperty:(NSString *)property;
-
-/**
- Returns the sum of the values of a given property over all the objects in the array.
-
-     NSNumber *sum = [object.arrayProperty sumOfProperty:@"age"];
-
- @warning You cannot use this method on `RLMObject`, `RLMArray`, and `NSData` properties.
-
- @param property The property whose values should be summed. Only properties of
-                 types `int`, `float`, and `double` are supported.
-
- @return The sum of the given property.
- */
-- (NSNumber *)sumOfProperty:(NSString *)property;
-
-/**
- Returns the average value of a given property over the objects in the array.
-
-     NSNumber *average = [object.arrayProperty averageOfProperty:@"age"];
-
- @warning You cannot use this method on `RLMObject`, `RLMArray`, and `NSData` properties.
-
- @param property The property whose average value should be calculated. Only
-                 properties of types `int`, `float`, and `double` are supported.
-
- @return    The average value of the given property, or `nil` if the array is empty.
- */
-- (nullable NSNumber *)averageOfProperty:(NSString *)property;
-
-#pragma mark - Freeze
-
-/**
- Returns a frozen (immutable) snapshot of this array.
-
- The frozen copy is an immutable array which contains the same data as this
- array currently contains, but will not update when writes are made to the
- containing Realm. Unlike live arrays, frozen arrays can be accessed from any
- thread.
-
- @warning This method cannot be called during a write transaction, or when the
-          containing Realm is read-only.
- @warning This method may only be called on a managed array.
- @warning Holding onto a frozen array for an extended period while performing
-          write transaction on the Realm may result in the Realm file growing
-          to large sizes. See `RLMRealmConfiguration.maximumNumberOfActiveVersions`
-          for more information.
- */
-- (instancetype)freeze;
-
-#pragma mark - Unavailable Methods
-
-/**
- `-[RLMArray init]` is not available because `RLMArray`s cannot be created directly.
- `RLMArray` properties on `RLMObject`s are lazily created when accessed.
- */
-- (instancetype)init __attribute__((unavailable("RLMArrays cannot be created directly")));
-
-/**
- `+[RLMArray new]` is not available because `RLMArray`s cannot be created directly.
- `RLMArray` properties on `RLMObject`s are lazily created when accessed.
- */
-+ (instancetype)new __attribute__((unavailable("RLMArrays cannot be created directly")));
-
-@end
-
-/// :nodoc:
-@interface RLMArray (Swift)
-// for use only in Swift class definitions
-- (instancetype)initWithObjectClassName:(NSString *)objectClassName;
-@end
-
-NS_ASSUME_NONNULL_END

+ 0 - 599
Carthage/Checkouts/realm-cocoa/Realm/RLMArray.mm

@@ -1,599 +0,0 @@
-////////////////////////////////////////////////////////////////////////////
-//
-// Copyright 2014 Realm Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////
-
-#import "RLMArray_Private.hpp"
-
-#import "RLMObjectSchema.h"
-#import "RLMObjectStore.h"
-#import "RLMObject_Private.h"
-#import "RLMProperty_Private.h"
-#import "RLMQueryUtil.hpp"
-#import "RLMSchema_Private.h"
-#import "RLMSwiftSupport.h"
-#import "RLMThreadSafeReference_Private.hpp"
-#import "RLMUtil.hpp"
-
-// See -countByEnumeratingWithState:objects:count
-@interface RLMArrayHolder : NSObject {
-@public
-    std::unique_ptr<id[]> items;
-}
-@end
-@implementation RLMArrayHolder
-@end
-
-@interface RLMArray () <RLMThreadConfined_Private>
-@end
-
-@implementation RLMArray {
-@public
-    // Backing array when this instance is unmanaged
-    NSMutableArray *_backingArray;
-}
-
-#pragma mark - Initializers
-
-- (instancetype)initWithObjectClassName:(__unsafe_unretained NSString *const)objectClassName {
-    REALM_ASSERT([objectClassName length] > 0);
-    self = [super init];
-    if (self) {
-        _objectClassName = objectClassName;
-        _type = RLMPropertyTypeObject;
-    }
-    return self;
-}
-
-- (instancetype)initWithObjectType:(RLMPropertyType)type optional:(BOOL)optional {
-    self = [super init];
-    if (self) {
-        _type = type;
-        _optional = optional;
-    }
-    return self;
-}
-
-#pragma mark - Convenience wrappers used for all RLMArray types
-
-- (void)addObjects:(id<NSFastEnumeration>)objects {
-    for (id obj in objects) {
-        [self addObject:obj];
-    }
-}
-
-- (void)addObject:(id)object {
-    [self insertObject:object atIndex:self.count];
-}
-
-- (void)removeLastObject {
-    NSUInteger count = self.count;
-    if (count) {
-        [self removeObjectAtIndex:count-1];
-    }
-}
-
-- (id)objectAtIndexedSubscript:(NSUInteger)index {
-    return [self objectAtIndex:index];
-}
-
-- (void)setObject:(id)newValue atIndexedSubscript:(NSUInteger)index {
-    [self replaceObjectAtIndex:index withObject:newValue];
-}
-
-- (RLMResults *)sortedResultsUsingKeyPath:(NSString *)keyPath ascending:(BOOL)ascending {
-    return [self sortedResultsUsingDescriptors:@[[RLMSortDescriptor sortDescriptorWithKeyPath:keyPath ascending:ascending]]];
-}
-
-- (NSUInteger)indexOfObjectWhere:(NSString *)predicateFormat, ... {
-    va_list args;
-    va_start(args, predicateFormat);
-    NSUInteger index = [self indexOfObjectWhere:predicateFormat args:args];
-    va_end(args);
-    return index;
-}
-
-- (NSUInteger)indexOfObjectWhere:(NSString *)predicateFormat args:(va_list)args {
-    return [self indexOfObjectWithPredicate:[NSPredicate predicateWithFormat:predicateFormat
-                                                                   arguments:args]];
-}
-
-#pragma mark - Unmanaged RLMArray implementation
-
-- (RLMRealm *)realm {
-    return nil;
-}
-
-- (id)firstObject {
-    if (self.count) {
-        return [self objectAtIndex:0];
-    }
-    return nil;
-}
-
-- (id)lastObject {
-    NSUInteger count = self.count;
-    if (count) {
-        return [self objectAtIndex:count-1];
-    }
-    return nil;
-}
-
-- (id)objectAtIndex:(NSUInteger)index {
-    validateArrayBounds(self, index);
-    return [_backingArray objectAtIndex:index];
-}
-
-- (NSUInteger)count {
-    return _backingArray.count;
-}
-
-- (BOOL)isInvalidated {
-    return NO;
-}
-
-- (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state
-                                  objects:(__unused __unsafe_unretained id [])buffer
-                                    count:(__unused NSUInteger)len {
-    if (state->state != 0) {
-        return 0;
-    }
-
-    // We need to enumerate a copy of the backing array so that it doesn't
-    // reflect changes made during enumeration. This copy has to be autoreleased
-    // (since there's nowhere for us to store a strong reference), and uses
-    // RLMArrayHolder rather than an NSArray because NSArray doesn't guarantee
-    // that it'll use a single contiguous block of memory, and if it doesn't
-    // we'd need to forward multiple calls to this method to the same NSArray,
-    // which would require holding a reference to it somewhere.
-    __autoreleasing RLMArrayHolder *copy = [[RLMArrayHolder alloc] init];
-    copy->items = std::make_unique<id[]>(self.count);
-
-    NSUInteger i = 0;
-    for (id object in _backingArray) {
-        copy->items[i++] = object;
-    }
-
-    state->itemsPtr = (__unsafe_unretained id *)(void *)copy->items.get();
-    // needs to point to something valid, but the whole point of this is so
-    // that it can't be changed
-    state->mutationsPtr = state->extra;
-    state->state = i;
-
-    return i;
-}
-
-
-template<typename IndexSetFactory>
-static void changeArray(__unsafe_unretained RLMArray *const ar,
-                        NSKeyValueChange kind, dispatch_block_t f, IndexSetFactory&& is) {
-    if (!ar->_backingArray) {
-        ar->_backingArray = [NSMutableArray new];
-    }
-
-    if (RLMObjectBase *parent = ar->_parentObject) {
-        NSIndexSet *indexes = is();
-        [parent willChange:kind valuesAtIndexes:indexes forKey:ar->_key];
-        f();
-        [parent didChange:kind valuesAtIndexes:indexes forKey:ar->_key];
-    }
-    else {
-        f();
-    }
-}
-
-static void changeArray(__unsafe_unretained RLMArray *const ar, NSKeyValueChange kind,
-                        NSUInteger index, dispatch_block_t f) {
-    changeArray(ar, kind, f, [=] { return [NSIndexSet indexSetWithIndex:index]; });
-}
-
-static void changeArray(__unsafe_unretained RLMArray *const ar, NSKeyValueChange kind,
-                        NSRange range, dispatch_block_t f) {
-    changeArray(ar, kind, f, [=] { return [NSIndexSet indexSetWithIndexesInRange:range]; });
-}
-
-static void changeArray(__unsafe_unretained RLMArray *const ar, NSKeyValueChange kind,
-                        NSIndexSet *is, dispatch_block_t f) {
-    changeArray(ar, kind, f, [=] { return is; });
-}
-
-void RLMArrayValidateMatchingObjectType(__unsafe_unretained RLMArray *const array,
-                                        __unsafe_unretained id const value) {
-    if (!value && !array->_optional) {
-        @throw RLMException(@"Invalid nil value for array of '%@'.",
-                            array->_objectClassName ?: RLMTypeToString(array->_type));
-    }
-    if (array->_type != RLMPropertyTypeObject) {
-        if (!RLMValidateValue(value, array->_type, array->_optional, false, nil)) {
-            @throw RLMException(@"Invalid value '%@' of type '%@' for expected type '%@%s'.",
-                                value, [value class], RLMTypeToString(array->_type),
-                                array->_optional ? "?" : "");
-        }
-        return;
-    }
-
-    auto object = RLMDynamicCast<RLMObjectBase>(value);
-    if (!object) {
-        return;
-    }
-    if (!object->_objectSchema) {
-        @throw RLMException(@"Object cannot be inserted unless the schema is initialized. "
-                            "This can happen if you try to insert objects into a RLMArray / List from a default value or from an overriden unmanaged initializer (`init()`).");
-    }
-    if (![array->_objectClassName isEqualToString:object->_objectSchema.className]) {
-        @throw RLMException(@"Object of type '%@' does not match RLMArray type '%@'.",
-                            object->_objectSchema.className, array->_objectClassName);
-    }
-}
-
-static void validateArrayBounds(__unsafe_unretained RLMArray *const ar,
-                                   NSUInteger index, bool allowOnePastEnd=false) {
-    NSUInteger max = ar->_backingArray.count + allowOnePastEnd;
-    if (index >= max) {
-        @throw RLMException(@"Index %llu is out of bounds (must be less than %llu).",
-                            (unsigned long long)index, (unsigned long long)max);
-    }
-}
-
-- (void)addObjectsFromArray:(NSArray *)array {
-    for (id obj in array) {
-        RLMArrayValidateMatchingObjectType(self, obj);
-    }
-    changeArray(self, NSKeyValueChangeInsertion, NSMakeRange(_backingArray.count, array.count), ^{
-        [_backingArray addObjectsFromArray:array];
-    });
-}
-
-- (void)insertObject:(id)anObject atIndex:(NSUInteger)index {
-    RLMArrayValidateMatchingObjectType(self, anObject);
-    validateArrayBounds(self, index, true);
-    changeArray(self, NSKeyValueChangeInsertion, index, ^{
-        [_backingArray insertObject:anObject atIndex:index];
-    });
-}
-
-- (void)insertObjects:(id<NSFastEnumeration>)objects atIndexes:(NSIndexSet *)indexes {
-    changeArray(self, NSKeyValueChangeInsertion, indexes, ^{
-        NSUInteger currentIndex = [indexes firstIndex];
-        for (RLMObject *obj in objects) {
-            RLMArrayValidateMatchingObjectType(self, obj);
-            [_backingArray insertObject:obj atIndex:currentIndex];
-            currentIndex = [indexes indexGreaterThanIndex:currentIndex];
-        }
-    });
-}
-
-- (void)removeObjectAtIndex:(NSUInteger)index {
-    validateArrayBounds(self, index);
-    changeArray(self, NSKeyValueChangeRemoval, index, ^{
-        [_backingArray removeObjectAtIndex:index];
-    });
-}
-
-- (void)removeObjectsAtIndexes:(NSIndexSet *)indexes {
-    changeArray(self, NSKeyValueChangeRemoval, indexes, ^{
-        [_backingArray removeObjectsAtIndexes:indexes];
-    });
-}
-
-- (void)replaceObjectAtIndex:(NSUInteger)index withObject:(id)anObject {
-    RLMArrayValidateMatchingObjectType(self, anObject);
-    validateArrayBounds(self, index);
-    changeArray(self, NSKeyValueChangeReplacement, index, ^{
-        [_backingArray replaceObjectAtIndex:index withObject:anObject];
-    });
-}
-
-- (void)moveObjectAtIndex:(NSUInteger)sourceIndex toIndex:(NSUInteger)destinationIndex {
-    validateArrayBounds(self, sourceIndex);
-    validateArrayBounds(self, destinationIndex);
-    id original = _backingArray[sourceIndex];
-
-    auto start = std::min(sourceIndex, destinationIndex);
-    auto len = std::max(sourceIndex, destinationIndex) - start + 1;
-    changeArray(self, NSKeyValueChangeReplacement, {start, len}, ^{
-        [_backingArray removeObjectAtIndex:sourceIndex];
-        [_backingArray insertObject:original atIndex:destinationIndex];
-    });
-}
-
-- (void)exchangeObjectAtIndex:(NSUInteger)index1 withObjectAtIndex:(NSUInteger)index2 {
-    validateArrayBounds(self, index1);
-    validateArrayBounds(self, index2);
-
-    changeArray(self, NSKeyValueChangeReplacement, ^{
-        [_backingArray exchangeObjectAtIndex:index1 withObjectAtIndex:index2];
-    }, [=] {
-        NSMutableIndexSet *set = [[NSMutableIndexSet alloc] initWithIndex:index1];
-        [set addIndex:index2];
-        return set;
-    });
-}
-
-- (NSUInteger)indexOfObject:(id)object {
-    RLMArrayValidateMatchingObjectType(self, object);
-    if (!_backingArray) {
-        return NSNotFound;
-    }
-    if (_type != RLMPropertyTypeObject) {
-        return [_backingArray indexOfObject:object];
-    }
-
-    NSUInteger index = 0;
-    for (RLMObjectBase *cmp in _backingArray) {
-        if (RLMObjectBaseAreEqual(object, cmp)) {
-            return index;
-        }
-        index++;
-    }
-    return NSNotFound;
-}
-
-- (void)removeAllObjects {
-    changeArray(self, NSKeyValueChangeRemoval, NSMakeRange(0, _backingArray.count), ^{
-        [_backingArray removeAllObjects];
-    });
-}
-
-- (RLMResults *)objectsWhere:(NSString *)predicateFormat, ... {
-    va_list args;
-    va_start(args, predicateFormat);
-    RLMResults *results = [self objectsWhere:predicateFormat args:args];
-    va_end(args);
-    return results;
-}
-
-- (RLMResults *)objectsWhere:(NSString *)predicateFormat args:(va_list)args {
-    return [self objectsWithPredicate:[NSPredicate predicateWithFormat:predicateFormat arguments:args]];
-}
-
-static bool canAggregate(RLMPropertyType type, bool allowDate) {
-    switch (type) {
-        case RLMPropertyTypeInt:
-        case RLMPropertyTypeFloat:
-        case RLMPropertyTypeDouble:
-            return true;
-        case RLMPropertyTypeDate:
-            return allowDate;
-        default:
-            return false;
-    }
-}
-
-- (RLMPropertyType)typeForProperty:(NSString *)propertyName {
-    if ([propertyName isEqualToString:@"self"]) {
-        return _type;
-    }
-
-    RLMObjectSchema *objectSchema;
-    if (_backingArray.count) {
-        objectSchema = [_backingArray[0] objectSchema];
-    }
-    else {
-        objectSchema = [RLMSchema.partialPrivateSharedSchema schemaForClassName:_objectClassName];
-    }
-
-    return RLMValidatedProperty(objectSchema, propertyName).type;
-}
-
-- (id)aggregateProperty:(NSString *)key operation:(NSString *)op method:(SEL)sel {
-    // Although delegating to valueForKeyPath: here would allow to support
-    // nested key paths as well, limiting functionality gives consistency
-    // between unmanaged and managed arrays.
-    if ([key rangeOfString:@"."].location != NSNotFound) {
-        @throw RLMException(@"Nested key paths are not supported yet for KVC collection operators.");
-    }
-
-    bool allowDate = false;
-    bool sum = false;
-    if ([op isEqualToString:@"@min"] || [op isEqualToString:@"@max"]) {
-        allowDate = true;
-    }
-    else if ([op isEqualToString:@"@sum"]) {
-        sum = true;
-    }
-    else if (![op isEqualToString:@"@avg"]) {
-        // Just delegate to NSArray for all other operators
-        return [_backingArray valueForKeyPath:[op stringByAppendingPathExtension:key]];
-    }
-
-    RLMPropertyType type = [self typeForProperty:key];
-    if (!canAggregate(type, allowDate)) {
-        NSString *method = sel ? NSStringFromSelector(sel) : op;
-        if (_type == RLMPropertyTypeObject) {
-            @throw RLMException(@"%@: is not supported for %@ property '%@.%@'",
-                                method, RLMTypeToString(type), _objectClassName, key);
-        }
-        else {
-            @throw RLMException(@"%@ is not supported for %@%s array",
-                                method, RLMTypeToString(_type), _optional ? "?" : "");
-        }
-    }
-
-    NSArray *values = [key isEqualToString:@"self"] ? _backingArray : [_backingArray valueForKey:key];
-    if (_optional) {
-        // Filter out NSNull values to match our behavior on managed arrays
-        NSIndexSet *nonnull = [values indexesOfObjectsPassingTest:^BOOL(id obj, NSUInteger, BOOL *) {
-            return obj != NSNull.null;
-        }];
-        if (nonnull.count < values.count) {
-            values = [values objectsAtIndexes:nonnull];
-        }
-    }
-    id result = [values valueForKeyPath:[op stringByAppendingString:@".self"]];
-    return sum && !result ? @0 : result;
-}
-
-- (id)valueForKeyPath:(NSString *)keyPath {
-    if ([keyPath characterAtIndex:0] != '@') {
-        return _backingArray ? [_backingArray valueForKeyPath:keyPath] : [super valueForKeyPath:keyPath];
-    }
-
-    if (!_backingArray) {
-        _backingArray = [NSMutableArray new];
-    }
-
-    NSUInteger dot = [keyPath rangeOfString:@"."].location;
-    if (dot == NSNotFound) {
-        return [_backingArray valueForKeyPath:keyPath];
-    }
-
-    NSString *op = [keyPath substringToIndex:dot];
-    NSString *key = [keyPath substringFromIndex:dot + 1];
-    return [self aggregateProperty:key operation:op method:nil];
-}
-
-- (id)valueForKey:(NSString *)key {
-    if ([key isEqualToString:RLMInvalidatedKey]) {
-        return @NO; // Unmanaged arrays are never invalidated
-    }
-    if (!_backingArray) {
-        _backingArray = [NSMutableArray new];
-    }
-    return [_backingArray valueForKey:key];
-}
-
-- (void)setValue:(id)value forKey:(NSString *)key {
-    if ([key isEqualToString:@"self"]) {
-        RLMArrayValidateMatchingObjectType(self, value);
-        for (NSUInteger i = 0, count = _backingArray.count; i < count; ++i) {
-            _backingArray[i] = value;
-        }
-        return;
-    }
-    else if (_type == RLMPropertyTypeObject) {
-        [_backingArray setValue:value forKey:key];
-    }
-    else {
-        [self setValue:value forUndefinedKey:key];
-    }
-}
-
-- (id)minOfProperty:(NSString *)property {
-    return [self aggregateProperty:property operation:@"@min" method:_cmd];
-}
-
-- (id)maxOfProperty:(NSString *)property {
-    return [self aggregateProperty:property operation:@"@max" method:_cmd];
-}
-
-- (id)sumOfProperty:(NSString *)property {
-    return [self aggregateProperty:property operation:@"@sum" method:_cmd];
-}
-
-- (id)averageOfProperty:(NSString *)property {
-    return [self aggregateProperty:property operation:@"@avg" method:_cmd];
-}
-
-- (NSUInteger)indexOfObjectWithPredicate:(NSPredicate *)predicate {
-    if (!_backingArray) {
-        return NSNotFound;
-    }
-    return [_backingArray indexOfObjectPassingTest:^BOOL(id obj, NSUInteger, BOOL *) {
-        return [predicate evaluateWithObject:obj];
-    }];
-}
-
-- (NSArray *)objectsAtIndexes:(NSIndexSet *)indexes {
-    if (!_backingArray) {
-        _backingArray = [NSMutableArray new];
-    }
-    return [_backingArray objectsAtIndexes:indexes];
-}
-
-- (void)addObserver:(NSObject *)observer forKeyPath:(NSString *)keyPath
-            options:(NSKeyValueObservingOptions)options context:(void *)context {
-    RLMValidateArrayObservationKey(keyPath, self);
-    [super addObserver:observer forKeyPath:keyPath options:options context:context];
-}
-
-#pragma mark - Methods unsupported on unmanaged RLMArray instances
-
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wunused-parameter"
-
-- (RLMResults *)objectsWithPredicate:(NSPredicate *)predicate {
-    @throw RLMException(@"This method may only be called on RLMArray instances retrieved from an RLMRealm");
-}
-
-- (RLMResults *)sortedResultsUsingDescriptors:(NSArray<RLMSortDescriptor *> *)properties {
-    @throw RLMException(@"This method may only be called on RLMArray instances retrieved from an RLMRealm");
-}
-
-- (RLMResults *)distinctResultsUsingKeyPaths:(NSArray<NSString *> *)keyPaths {
-    @throw RLMException(@"This method may only be called on RLMArray instances retrieved from an RLMRealm");
-}
-
-// The compiler complains about the method's argument type not matching due to
-// it not having the generic type attached, but it doesn't seem to be possible
-// to actually include the generic type
-// http://www.openradar.me/radar?id=6135653276319744
-#pragma clang diagnostic ignored "-Wmismatched-parameter-types"
-- (RLMNotificationToken *)addNotificationBlock:(void (^)(RLMArray *, RLMCollectionChange *, NSError *))block {
-    return [self addNotificationBlock:block queue:nil];
-}
-- (RLMNotificationToken *)addNotificationBlock:(void (^)(RLMArray *, RLMCollectionChange *, NSError *))block
-                                         queue:(nullable dispatch_queue_t)queue {
-    @throw RLMException(@"This method may only be called on RLMArray instances retrieved from an RLMRealm");
-}
-
-- (instancetype)freeze {
-    @throw RLMException(@"This method may only be called on RLMArray instances retrieved from an RLMRealm");
-}
-
-#pragma mark - Thread Confined Protocol Conformance
-
-- (realm::ThreadSafeReference)makeThreadSafeReference {
-    REALM_TERMINATE("Unexpected handover of unmanaged `RLMArray`");
-}
-
-- (id)objectiveCMetadata {
-    REALM_TERMINATE("Unexpected handover of unmanaged `RLMArray`");
-}
-
-+ (instancetype)objectWithThreadSafeReference:(realm::ThreadSafeReference)reference
-                                     metadata:(id)metadata
-                                        realm:(RLMRealm *)realm {
-    REALM_TERMINATE("Unexpected handover of unmanaged `RLMArray`");
-}
-
-#pragma clang diagnostic pop // unused parameter warning
-
-#pragma mark - Superclass Overrides
-
-- (NSString *)description {
-    return [self descriptionWithMaxDepth:RLMDescriptionMaxDepth];
-}
-
-- (NSString *)descriptionWithMaxDepth:(NSUInteger)depth {
-    return RLMDescriptionWithMaxDepth(@"RLMArray", self, depth);
-}
-@end
-
-@implementation RLMSortDescriptor
-
-+ (instancetype)sortDescriptorWithKeyPath:(NSString *)keyPath ascending:(BOOL)ascending {
-    RLMSortDescriptor *desc = [[RLMSortDescriptor alloc] init];
-    desc->_keyPath = keyPath;
-    desc->_ascending = ascending;
-    return desc;
-}
-
-- (instancetype)reversedSortDescriptor {
-    return [self.class sortDescriptorWithKeyPath:_keyPath ascending:!_ascending];
-}
-
-@end

+ 0 - 32
Carthage/Checkouts/realm-cocoa/Realm/RLMArray_Private.h

@@ -1,32 +0,0 @@
-////////////////////////////////////////////////////////////////////////////
-//
-// Copyright 2014 Realm Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////
-
-#import <Realm/RLMArray.h>
-#import <Realm/RLMConstants.h>
-
-NS_ASSUME_NONNULL_BEGIN
-
-@interface RLMArray ()
-- (instancetype)initWithObjectClassName:(NSString *)objectClassName;
-- (instancetype)initWithObjectType:(RLMPropertyType)type optional:(BOOL)optional;
-- (NSString *)descriptionWithMaxDepth:(NSUInteger)depth;
-@end
-
-void RLMArrayValidateMatchingObjectType(RLMArray *array, id value);
-
-NS_ASSUME_NONNULL_END

+ 0 - 71
Carthage/Checkouts/realm-cocoa/Realm/RLMArray_Private.hpp

@@ -1,71 +0,0 @@
-////////////////////////////////////////////////////////////////////////////
-//
-// Copyright 2014 Realm Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////
-
-#import "RLMArray_Private.h"
-
-#import "RLMCollection_Private.hpp"
-
-#import "RLMResults_Private.hpp"
-
-#import <realm/table_ref.hpp>
-
-namespace realm {
-    class Results;
-}
-
-@class RLMObjectBase, RLMObjectSchema, RLMProperty;
-class RLMClassInfo;
-class RLMObservationInfo;
-
-@interface RLMArray () {
-@protected
-    NSString *_objectClassName;
-    RLMPropertyType _type;
-    BOOL _optional;
-@public
-    // The name of the property which this RLMArray represents
-    NSString *_key;
-    __weak RLMObjectBase *_parentObject;
-}
-@end
-
-@interface RLMManagedArray : RLMArray <RLMFastEnumerable>
-- (instancetype)initWithParent:(RLMObjectBase *)parentObject property:(RLMProperty *)property;
-- (RLMManagedArray *)initWithList:(realm::List)list
-                       parentInfo:(RLMClassInfo *)parentInfo
-                         property:(__unsafe_unretained RLMProperty *const)property;
-
-- (bool)isBackedByList:(realm::List const&)list;
-
-// deletes all objects in the RLMArray from their containing realms
-- (void)deleteObjectsFromRealm;
-@end
-
-void RLMValidateArrayObservationKey(NSString *keyPath, RLMArray *array);
-
-// Initialize the observation info for an array if needed
-void RLMEnsureArrayObservationInfo(std::unique_ptr<RLMObservationInfo>& info,
-                                   NSString *keyPath, RLMArray *array, id observed);
-
-
-//
-// RLMResults private methods
-//
-@interface RLMResults () <RLMFastEnumerable>
-- (void)deleteObjectsFromRealm;
-@end

+ 0 - 113
Carthage/Checkouts/realm-cocoa/Realm/RLMClassInfo.hpp

@@ -1,113 +0,0 @@
-////////////////////////////////////////////////////////////////////////////
-//
-// Copyright 2016 Realm Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////
-
-#import <Foundation/Foundation.h>
-
-#import <realm/table_ref.hpp>
-
-#import <unordered_map>
-#import <vector>
-
-namespace realm {
-    class ObjectSchema;
-    class Schema;
-    struct Property;
-    struct ColKey;
-}
-
-class RLMObservationInfo;
-@class RLMRealm, RLMSchema, RLMObjectSchema, RLMProperty;
-
-NS_ASSUME_NONNULL_BEGIN
-
-namespace std {
-// Add specializations so that NSString can be used as the key for hash containers
-template<> struct hash<NSString *> {
-    size_t operator()(__unsafe_unretained NSString *const str) const {
-        return [str hash];
-    }
-};
-template<> struct equal_to<NSString *> {
-    bool operator()(__unsafe_unretained NSString * lhs, __unsafe_unretained NSString *rhs) const {
-        return [lhs isEqualToString:rhs];
-    }
-};
-}
-
-// The per-RLMRealm object schema information which stores the cached table
-// reference, handles table column lookups, and tracks observed objects
-class RLMClassInfo {
-public:
-    RLMClassInfo(RLMRealm *, RLMObjectSchema *, const realm::ObjectSchema *);
-
-    __unsafe_unretained RLMRealm *const realm;
-    __unsafe_unretained RLMObjectSchema *const rlmObjectSchema;
-    const realm::ObjectSchema *const objectSchema;
-
-    // Storage for the functionality in RLMObservation for handling indirect
-    // changes to KVO-observed things
-    std::vector<RLMObservationInfo *> observedObjects;
-
-    // Get the table for this object type. Will return nullptr only if it's a
-    // read-only Realm that is missing the table entirely.
-    realm::TableRef table() const;
-
-    // Get the RLMProperty for a given table column, or `nil` if it is a column
-    // not used by the current schema
-    RLMProperty *_Nullable propertyForTableColumn(realm::ColKey) const noexcept;
-
-    // Get the RLMProperty that's used as the primary key, or `nil` if there is
-    // no primary key for the current schema
-    RLMProperty *_Nullable propertyForPrimaryKey() const noexcept;
-
-    // Get the table column for the given property. The property must be a valid
-    // persisted property.
-    realm::ColKey tableColumn(NSString *propertyName) const;
-    realm::ColKey tableColumn(RLMProperty *property) const;
-
-    // Get the info for the target of the link at the given property index.
-    RLMClassInfo &linkTargetType(size_t propertyIndex);
-
-    // Get the info for the target of the given property
-    RLMClassInfo &linkTargetType(realm::Property const& property);
-
-    // Get the corresponding ClassInfo for the given Realm
-    RLMClassInfo &freeze(RLMRealm *);
-};
-
-// A per-RLMRealm object schema map which stores RLMClassInfo keyed on the name
-class RLMSchemaInfo {
-    using impl = std::unordered_map<NSString *, RLMClassInfo>;
-public:
-    RLMSchemaInfo() = default;
-    RLMSchemaInfo(RLMRealm *realm);
-
-    RLMSchemaInfo clone(realm::Schema const& source_schema, RLMRealm *target_realm);
-
-    // Look up by name, throwing if it's not present
-    RLMClassInfo& operator[](NSString *name);
-
-    impl::iterator begin() noexcept;
-    impl::iterator end() noexcept;
-    impl::const_iterator begin() const noexcept;
-    impl::const_iterator end() const noexcept;
-private:
-    std::unordered_map<NSString *, RLMClassInfo> m_objects;
-};
-
-NS_ASSUME_NONNULL_END

+ 0 - 130
Carthage/Checkouts/realm-cocoa/Realm/RLMClassInfo.mm

@@ -1,130 +0,0 @@
-////////////////////////////////////////////////////////////////////////////
-//
-// Copyright 2016 Realm Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////
-
-#import "RLMClassInfo.hpp"
-
-#import "RLMRealm_Private.hpp"
-#import "RLMObjectSchema_Private.h"
-#import "RLMSchema.h"
-#import "RLMProperty_Private.h"
-#import "RLMQueryUtil.hpp"
-#import "RLMUtil.hpp"
-
-#import "object_schema.hpp"
-#import "object_store.hpp"
-#import "schema.hpp"
-#import "shared_realm.hpp"
-
-#import <realm/table.hpp>
-
-using namespace realm;
-
-RLMClassInfo::RLMClassInfo(RLMRealm *realm, RLMObjectSchema *rlmObjectSchema,
-                           const realm::ObjectSchema *objectSchema)
-: realm(realm), rlmObjectSchema(rlmObjectSchema), objectSchema(objectSchema) { }
-
-realm::TableRef RLMClassInfo::table() const {
-    if (auto key = objectSchema->table_key) {
-        return realm.group.get_table(objectSchema->table_key);
-    }
-    return nullptr;
-}
-
-RLMProperty *RLMClassInfo::propertyForTableColumn(ColKey col) const noexcept {
-    auto const& props = objectSchema->persisted_properties;
-    for (size_t i = 0; i < props.size(); ++i) {
-        if (props[i].column_key == col) {
-            return rlmObjectSchema.properties[i];
-        }
-    }
-    return nil;
-}
-
-RLMProperty *RLMClassInfo::propertyForPrimaryKey() const noexcept {
-    return rlmObjectSchema.primaryKeyProperty;
-}
-
-realm::ColKey RLMClassInfo::tableColumn(NSString *propertyName) const {
-    return tableColumn(RLMValidatedProperty(rlmObjectSchema, propertyName));
-}
-
-realm::ColKey RLMClassInfo::tableColumn(RLMProperty *property) const {
-    return objectSchema->persisted_properties[property.index].column_key;
-}
-
-RLMClassInfo &RLMClassInfo::linkTargetType(size_t propertyIndex) {
-    return realm->_info[rlmObjectSchema.properties[propertyIndex].objectClassName];
-}
-
-RLMClassInfo &RLMClassInfo::linkTargetType(realm::Property const& property) {
-    REALM_ASSERT(property.type == PropertyType::Object);
-    return linkTargetType(&property - &objectSchema->persisted_properties[0]);
-}
-
-RLMClassInfo &RLMClassInfo::freeze(__unsafe_unretained RLMRealm *const frozenRealm) {
-    REALM_ASSERT(frozenRealm.frozen);
-    // FIXME
-    return frozenRealm->_info[rlmObjectSchema.className];
-}
-
-RLMSchemaInfo::impl::iterator RLMSchemaInfo::begin() noexcept { return m_objects.begin(); }
-RLMSchemaInfo::impl::iterator RLMSchemaInfo::end() noexcept { return m_objects.end(); }
-RLMSchemaInfo::impl::const_iterator RLMSchemaInfo::begin() const noexcept { return m_objects.begin(); }
-RLMSchemaInfo::impl::const_iterator RLMSchemaInfo::end() const noexcept { return m_objects.end(); }
-
-RLMClassInfo& RLMSchemaInfo::operator[](NSString *name) {
-    auto it = m_objects.find(name);
-    if (it == m_objects.end()) {
-        @throw RLMException(@"Object type '%@' is not managed by the Realm. "
-                            @"If using a custom `objectClasses` / `objectTypes` array in your configuration, "
-                            @"add `%@` to the list of `objectClasses` / `objectTypes`.",
-                            name, name);
-    }
-    return *&it->second;
-}
-
-RLMSchemaInfo::RLMSchemaInfo(RLMRealm *realm) {
-    RLMSchema *rlmSchema = realm.schema;
-    realm::Schema const& schema = realm->_realm->schema();
-    // rlmSchema can be larger due to multiple classes backed by one table
-    REALM_ASSERT(rlmSchema.objectSchema.count >= schema.size());
-
-    m_objects.reserve(schema.size());
-    for (RLMObjectSchema *rlmObjectSchema in rlmSchema.objectSchema) {
-        m_objects.emplace(std::piecewise_construct,
-                          std::forward_as_tuple(rlmObjectSchema.className),
-                          std::forward_as_tuple(realm, rlmObjectSchema,
-                                                &*schema.find(rlmObjectSchema.objectName.UTF8String)));
-    }
-}
-
-RLMSchemaInfo RLMSchemaInfo::clone(realm::Schema const& source_schema,
-                                   __unsafe_unretained RLMRealm *const target_realm) {
-    RLMSchemaInfo info;
-    info.m_objects.reserve(m_objects.size());
-
-    auto& schema = target_realm->_realm->schema();
-    for (auto& pair : m_objects) {
-        size_t idx = pair.second.objectSchema - &*source_schema.begin();
-        info.m_objects.emplace(std::piecewise_construct,
-                               std::forward_as_tuple(pair.first),
-                               std::forward_as_tuple(target_realm, pair.second.rlmObjectSchema,
-                                                     &*schema.begin() + idx));
-    }
-    return info;
-}

+ 0 - 428
Carthage/Checkouts/realm-cocoa/Realm/RLMCollection.h

@@ -1,428 +0,0 @@
-////////////////////////////////////////////////////////////////////////////
-//
-// Copyright 2014 Realm Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////
-
-#import <Foundation/Foundation.h>
-
-#import <Realm/RLMConstants.h>
-#import <Realm/RLMThreadSafeReference.h>
-
-NS_ASSUME_NONNULL_BEGIN
-
-@class RLMRealm, RLMResults, RLMSortDescriptor, RLMNotificationToken, RLMCollectionChange;
-typedef RLM_CLOSED_ENUM(int32_t, RLMPropertyType);
-
-/**
- A homogenous collection of Realm-managed objects. Examples of conforming types
- include `RLMArray`, `RLMResults`, and `RLMLinkingObjects`.
- */
-@protocol RLMCollection <NSFastEnumeration, RLMThreadConfined>
-
-@required
-
-#pragma mark - Properties
-
-/**
- The number of objects in the collection.
- */
-@property (nonatomic, readonly, assign) NSUInteger count;
-
-/**
- The type of the objects in the collection.
- */
-@property (nonatomic, readonly, assign) RLMPropertyType type;
-
-/**
- Indicates whether the objects in the collection can be `nil`.
- */
-@property (nonatomic, readonly, getter = isOptional) BOOL optional;
-
-/**
- The class name  of the objects contained in the collection.
-
- Will be `nil` if `type` is not RLMPropertyTypeObject.
- */
-@property (nonatomic, readonly, copy, nullable) NSString *objectClassName;
-
-/**
- The Realm which manages the collection, or `nil` for unmanaged collections.
- */
-@property (nonatomic, readonly) RLMRealm *realm;
-
-#pragma mark - Accessing Objects from a Collection
-
-/**
- Returns the object at the index specified.
-
- @param index   The index to look up.
-
- @return An object of the type contained in the collection.
- */
-- (id)objectAtIndex:(NSUInteger)index;
-
-/**
- Returns the first object in the collection.
-
- Returns `nil` if called on an empty collection.
-
- @return An object of the type contained in the collection.
- */
-- (nullable id)firstObject;
-
-/**
- Returns the last object in the collection.
-
- Returns `nil` if called on an empty collection.
-
- @return An object of the type contained in the collection.
- */
-- (nullable id)lastObject;
-
-#pragma mark - Querying a Collection
-
-/**
- Returns the index of an object in the collection.
-
- Returns `NSNotFound` if the object is not found in the collection.
-
- @param object  An object (of the same type as returned from the `objectClassName` selector).
- */
-- (NSUInteger)indexOfObject:(id)object;
-
-/**
- Returns the index of the first object in the collection matching the predicate.
-
- @param predicateFormat A predicate format string, optionally followed by a variable number of arguments.
-
- @return    The index of the object, or `NSNotFound` if the object is not found in the collection.
- */
-- (NSUInteger)indexOfObjectWhere:(NSString *)predicateFormat, ...;
-
-/// :nodoc:
-- (NSUInteger)indexOfObjectWhere:(NSString *)predicateFormat args:(va_list)args;
-
-/**
- Returns the index of the first object in the collection matching the predicate.
-
- @param predicate   The predicate with which to filter the objects.
-
- @return    The index of the object, or `NSNotFound` if the object is not found in the collection.
- */
-- (NSUInteger)indexOfObjectWithPredicate:(NSPredicate *)predicate;
-
-/**
- Returns all objects matching the given predicate in the collection.
-
- @param predicateFormat A predicate format string, optionally followed by a variable number of arguments.
-
- @return    An `RLMResults` containing objects that match the given predicate.
- */
-- (RLMResults *)objectsWhere:(NSString *)predicateFormat, ...;
-
-/// :nodoc:
-- (RLMResults *)objectsWhere:(NSString *)predicateFormat args:(va_list)args;
-
-/**
- Returns all objects matching the given predicate in the collection.
-
- @param predicate   The predicate with which to filter the objects.
-
- @return            An `RLMResults` containing objects that match the given predicate.
- */
-- (RLMResults *)objectsWithPredicate:(NSPredicate *)predicate;
-
-/**
- Returns a sorted `RLMResults` from the collection.
-
- @param keyPath     The keyPath to sort by.
- @param ascending   The direction to sort in.
-
- @return    An `RLMResults` sorted by the specified key path.
- */
-- (RLMResults *)sortedResultsUsingKeyPath:(NSString *)keyPath ascending:(BOOL)ascending;
-
-/**
- Returns a sorted `RLMResults` from the collection.
-
- @param properties  An array of `RLMSortDescriptor`s to sort by.
-
- @return    An `RLMResults` sorted by the specified properties.
- */
-- (RLMResults *)sortedResultsUsingDescriptors:(NSArray<RLMSortDescriptor *> *)properties;
-
-/// :nodoc:
-- (id)objectAtIndexedSubscript:(NSUInteger)index;
-
-/**
- Returns an `NSArray` containing the results of invoking `valueForKey:` using `key` on each of the collection's objects.
-
- @param key The name of the property.
-
- @return An `NSArray` containing results.
- */
-- (nullable id)valueForKey:(NSString *)key;
-
-/**
- Invokes `setValue:forKey:` on each of the collection's objects using the specified `value` and `key`.
-
- @warning This method may only be called during a write transaction.
-
- @param value The object value.
- @param key   The name of the property.
- */
-- (void)setValue:(nullable id)value forKey:(NSString *)key;
-
-#pragma mark - Notifications
-
-/**
- Registers a block to be called each time the collection changes.
-
- The block will be asynchronously called with the initial collection, and then
- called again after each write transaction which changes either any of the
- objects in the collection, or which objects are in the collection.
-
- The `change` parameter will be `nil` the first time the block is called.
- For each call after that, it will contain information about
- which rows in the collection were added, removed or modified. If a write transaction
- did not modify any objects in this collection, the block is not called at all.
- See the `RLMCollectionChange` documentation for information on how the changes
- are reported and an example of updating a `UITableView`.
-
- If an error occurs the block will be called with `nil` for the collection
- parameter and a non-`nil` error. Currently the only errors that can occur are
- when opening the Realm on the background worker thread.
-
- At the time when the block is called, the collection object will be fully
- evaluated and up-to-date, and as long as you do not perform a write transaction
- on the same thread or explicitly call `-[RLMRealm refresh]`, accessing it will
- never perform blocking work.
-
- Notifications are delivered via the standard run loop, and so can't be
- delivered while the run loop is blocked by other activity. When
- notifications can't be delivered instantly, multiple notifications may be
- coalesced into a single notification. This can include the notification
- with the initial collection. For example, the following code performs a write
- transaction immediately after adding the notification block, so there is no
- opportunity for the initial notification to be delivered first. As a
- result, the initial notification will reflect the state of the Realm after
- the write transaction.
-
-     id<RLMCollection> collection = [Dog allObjects];
-     NSLog(@"dogs.count: %zu", dogs.count); // => 0
-     self.token = [collection addNotificationBlock:^(id<RLMCollection> dogs,
-                                                  RLMCollectionChange *changes,
-                                                  NSError *error) {
-         // Only fired once for the example
-         NSLog(@"dogs.count: %zu", dogs.count); // => 1
-     }];
-     [realm transactionWithBlock:^{
-         Dog *dog = [[Dog alloc] init];
-         dog.name = @"Rex";
-         [realm addObject:dog];
-     }];
-     // end of run loop execution context
-
- You must retain the returned token for as long as you want updates to continue
- to be sent to the block. To stop receiving updates, call `-invalidate` on the token.
-
- @warning This method cannot be called during a write transaction, or when the
-          containing Realm is read-only.
-
- @param block The block to be called each time the collection changes.
- @return A token which must be held for as long as you want collection notifications to be delivered.
- */
-- (RLMNotificationToken *)addNotificationBlock:(void (^)(id<RLMCollection> __nullable collection,
-                                                         RLMCollectionChange *__nullable change,
-                                                         NSError *__nullable error))block __attribute__((warn_unused_result));
-
-#pragma mark - Aggregating Property Values
-
-/**
- Returns the minimum (lowest) value of the given property among all the objects
- in the collection.
-
-     NSNumber *min = [results minOfProperty:@"age"];
-
- @warning You cannot use this method on `RLMObject`, `RLMArray`, and `NSData` properties.
-
- @param property The property whose minimum value is desired. Only properties of
-                 types `int`, `float`, `double`, and `NSDate` are supported.
-
- @return The minimum value of the property, or `nil` if the Results are empty.
- */
-- (nullable id)minOfProperty:(NSString *)property;
-
-/**
- Returns the maximum (highest) value of the given property among all the objects
- in the collection.
-
-     NSNumber *max = [results maxOfProperty:@"age"];
-
- @warning You cannot use this method on `RLMObject`, `RLMArray`, and `NSData` properties.
-
- @param property The property whose maximum value is desired. Only properties of
-                 types `int`, `float`, `double`, and `NSDate` are supported.
-
- @return The maximum value of the property, or `nil` if the Results are empty.
- */
-- (nullable id)maxOfProperty:(NSString *)property;
-
-/**
- Returns the sum of the values of a given property over all the objects in the collection.
-
-     NSNumber *sum = [results sumOfProperty:@"age"];
-
- @warning You cannot use this method on `RLMObject`, `RLMArray`, and `NSData` properties.
-
- @param property The property whose values should be summed. Only properties of
-                 types `int`, `float`, and `double` are supported.
-
- @return The sum of the given property.
- */
-- (NSNumber *)sumOfProperty:(NSString *)property;
-
-/**
- Returns the average value of a given property over the objects in the collection.
-
-     NSNumber *average = [results averageOfProperty:@"age"];
-
- @warning You cannot use this method on `RLMObject`, `RLMArray`, and `NSData` properties.
-
- @param property The property whose average value should be calculated. Only
-                 properties of types `int`, `float`, and `double` are supported.
-
- @return    The average value of the given property, or `nil` if the Results are empty.
- */
-- (nullable NSNumber *)averageOfProperty:(NSString *)property;
-
-#pragma mark - Freeze
-
-/**
- Indicates if the collection is frozen.
-
- Frozen collections are immutable and can be accessed from any thread. The
- objects read from a frozen collection will also be frozen.
- */
-@property (nonatomic, readonly, getter=isFrozen) BOOL frozen;
-
-/**
- Returns a frozen (immutable) snapshot of this collection.
-
- The frozen copy is an immutable collection which contains the same data as
- this collection currently contains, but will not update when writes are made
- to the containing Realm. Unlike live collections, frozen collections can be
- accessed from any thread.
-
- @warning This method cannot be called during a write transaction, or when the containing Realm is read-only.
- @warning Holding onto a frozen collection for an extended period while
-          performing write transaction on the Realm may result in the Realm
-          file growing to large sizes. See
-          `RLMRealmConfiguration.maximumNumberOfActiveVersions`
-          for more information.
- */
-- (instancetype)freeze;
-
-@end
-
-/**
- An `RLMSortDescriptor` stores a property name and a sort order for use with
- `sortedResultsUsingDescriptors:`. It is similar to `NSSortDescriptor`, but supports
- only the subset of functionality which can be efficiently run by Realm's query
- engine.
-
- `RLMSortDescriptor` instances are immutable.
- */
-@interface RLMSortDescriptor : NSObject
-
-#pragma mark - Properties
-
-/**
- The key path which the sort descriptor orders results by.
- */
-@property (nonatomic, readonly) NSString *keyPath;
-
-/**
- Whether the descriptor sorts in ascending or descending order.
- */
-@property (nonatomic, readonly) BOOL ascending;
-
-#pragma mark - Methods
-
-/**
- Returns a new sort descriptor for the given key path and sort direction.
- */
-+ (instancetype)sortDescriptorWithKeyPath:(NSString *)keyPath ascending:(BOOL)ascending;
-
-/**
- Returns a copy of the receiver with the sort direction reversed.
- */
-- (instancetype)reversedSortDescriptor;
-
-@end
-
-/**
- A `RLMCollectionChange` object encapsulates information about changes to collections
- that are reported by Realm notifications.
-
- `RLMCollectionChange` is passed to the notification blocks registered with
- `-addNotificationBlock` on `RLMArray` and `RLMResults`, and reports what rows in the
- collection changed since the last time the notification block was called.
-
- The change information is available in two formats: a simple array of row
- indices in the collection for each type of change, and an array of index paths
- in a requested section suitable for passing directly to `UITableView`'s batch
- update methods. A complete example of updating a `UITableView` named `tv`:
-
-     [tv beginUpdates];
-     [tv deleteRowsAtIndexPaths:[changes deletionsInSection:0] withRowAnimation:UITableViewRowAnimationAutomatic];
-     [tv insertRowsAtIndexPaths:[changes insertionsInSection:0] withRowAnimation:UITableViewRowAnimationAutomatic];
-     [tv reloadRowsAtIndexPaths:[changes modificationsInSection:0] withRowAnimation:UITableViewRowAnimationAutomatic];
-     [tv endUpdates];
-
- All of the arrays in an `RLMCollectionChange` are always sorted in ascending order.
- */
-@interface RLMCollectionChange : NSObject
-/// The indices of objects in the previous version of the collection which have
-/// been removed from this one.
-@property (nonatomic, readonly) NSArray<NSNumber *> *deletions;
-
-/// The indices in the new version of the collection which were newly inserted.
-@property (nonatomic, readonly) NSArray<NSNumber *> *insertions;
-
-/**
- The indices in the new version of the collection which were modified.
-
- For `RLMResults`, this means that one or more of the properties of the object at
- that index were modified (or an object linked to by that object was
- modified).
-
- For `RLMArray`, the array itself being modified to contain a
- different object at that index will also be reported as a modification.
- */
-@property (nonatomic, readonly) NSArray<NSNumber *> *modifications;
-
-/// Returns the index paths of the deletion indices in the given section.
-- (NSArray<NSIndexPath *> *)deletionsInSection:(NSUInteger)section;
-
-/// Returns the index paths of the insertion indices in the given section.
-- (NSArray<NSIndexPath *> *)insertionsInSection:(NSUInteger)section;
-
-/// Returns the index paths of the modification indices in the given section.
-- (NSArray<NSIndexPath *> *)modificationsInSection:(NSUInteger)section;
-@end
-
-NS_ASSUME_NONNULL_END

+ 0 - 460
Carthage/Checkouts/realm-cocoa/Realm/RLMCollection.mm

@@ -1,460 +0,0 @@
-////////////////////////////////////////////////////////////////////////////
-//
-// Copyright 2016 Realm Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////
-
-#import "RLMCollection_Private.hpp"
-
-#import "RLMAccessor.hpp"
-#import "RLMArray_Private.hpp"
-#import "RLMListBase.h"
-#import "RLMObjectSchema_Private.hpp"
-#import "RLMObjectStore.h"
-#import "RLMObject_Private.hpp"
-#import "RLMProperty_Private.h"
-
-#import "collection_notifications.hpp"
-#import "list.hpp"
-#import "results.hpp"
-
-static const int RLMEnumerationBufferSize = 16;
-
-@implementation RLMFastEnumerator {
-    // The buffer supplied by fast enumeration does not retain the objects given
-    // to it, but because we create objects on-demand and don't want them
-    // autoreleased (a table can have more rows than the device has memory for
-    // accessor objects) we need a thing to retain them.
-    id _strongBuffer[RLMEnumerationBufferSize];
-
-    RLMRealm *_realm;
-    RLMClassInfo *_info;
-
-    // A pointer to either _snapshot or a Results from the source collection,
-    // to avoid having to copy the Results when not in a write transaction
-    realm::Results *_results;
-    realm::Results _snapshot;
-
-    // A strong reference to the collection being enumerated to ensure it stays
-    // alive when we're holding a pointer to a member in it
-    id _collection;
-}
-
-- (instancetype)initWithList:(realm::List&)list
-                  collection:(id)collection
-                   classInfo:(RLMClassInfo&)info
-{
-    self = [super init];
-    if (self) {
-        _info = &info;
-        _realm = _info->realm;
-        if (_realm.inWriteTransaction) {
-            _snapshot = list.snapshot();
-        }
-        else {
-            _snapshot = list.as_results();
-            _collection = collection;
-            [_realm registerEnumerator:self];
-        }
-        _results = &_snapshot;
-    }
-    return self;
-}
-
-- (instancetype)initWithResults:(realm::Results&)results
-                     collection:(id)collection
-                      classInfo:(RLMClassInfo&)info
-{
-    self = [super init];
-    if (self) {
-        _info = &info;
-        _realm = _info->realm;
-        if (_realm.inWriteTransaction) {
-            _snapshot = results.snapshot();
-            _results = &_snapshot;
-        }
-        else {
-            _results = &results;
-            _collection = collection;
-            [_realm registerEnumerator:self];
-        }
-    }
-    return self;
-}
-
-- (void)dealloc {
-    if (_collection) {
-        [_realm unregisterEnumerator:self];
-    }
-}
-
-- (void)detach {
-    _snapshot = _results->snapshot();
-    _results = &_snapshot;
-    _collection = nil;
-}
-
-- (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state
-                                    count:(NSUInteger)len {
-    [_realm verifyThread];
-    if (!_results->is_valid()) {
-        @throw RLMException(@"Collection is no longer valid");
-    }
-    // The fast enumeration buffer size is currently a hardcoded number in the
-    // compiler so this can't actually happen, but just in case it changes in
-    // the future...
-    if (len > RLMEnumerationBufferSize) {
-        len = RLMEnumerationBufferSize;
-    }
-
-    NSUInteger batchCount = 0, count = state->extra[1];
-
-    @autoreleasepool {
-        RLMAccessorContext ctx(*_info);
-        for (NSUInteger index = state->state; index < count && batchCount < len; ++index) {
-            _strongBuffer[batchCount] = _results->get(ctx, index);
-            batchCount++;
-        }
-    }
-
-    for (NSUInteger i = batchCount; i < len; ++i) {
-        _strongBuffer[i] = nil;
-    }
-
-    if (batchCount == 0) {
-        // Release our data if we're done, as we're autoreleased and so may
-        // stick around for a while
-        if (_collection) {
-            _collection = nil;
-            [_realm unregisterEnumerator:self];
-        }
-        _snapshot = {};
-    }
-
-    state->itemsPtr = (__unsafe_unretained id *)(void *)_strongBuffer;
-    state->state += batchCount;
-    state->mutationsPtr = state->extra+1;
-
-    return batchCount;
-}
-@end
-
-NSUInteger RLMFastEnumerate(NSFastEnumerationState *state, NSUInteger len, id<RLMFastEnumerable> collection) {
-    __autoreleasing RLMFastEnumerator *enumerator;
-    if (state->state == 0) {
-        enumerator = collection.fastEnumerator;
-        state->extra[0] = (long)enumerator;
-        state->extra[1] = collection.count;
-    }
-    else {
-        enumerator = (__bridge id)(void *)state->extra[0];
-    }
-
-    return [enumerator countByEnumeratingWithState:state count:len];
-}
-
-template<typename Collection>
-NSArray *RLMCollectionValueForKey(Collection& collection, NSString *key, RLMClassInfo& info) {
-    size_t count = collection.size();
-    if (count == 0) {
-        return @[];
-    }
-
-    NSMutableArray *array = [NSMutableArray arrayWithCapacity:count];
-    if ([key isEqualToString:@"self"]) {
-        RLMAccessorContext context(info);
-        for (size_t i = 0; i < count; ++i) {
-            [array addObject:collection.get(context, i) ?: NSNull.null];
-        }
-        return array;
-    }
-
-    if (collection.get_type() != realm::PropertyType::Object) {
-        RLMAccessorContext context(info);
-        for (size_t i = 0; i < count; ++i) {
-            [array addObject:[collection.get(context, i) valueForKey:key] ?: NSNull.null];
-        }
-        return array;
-    }
-
-    RLMObject *accessor = RLMCreateManagedAccessor(info.rlmObjectSchema.accessorClass, &info);
-
-    // List properties need to be handled specially since we need to create a
-    // new List each time
-    if (info.rlmObjectSchema.isSwiftClass) {
-        auto prop = info.rlmObjectSchema[key];
-        if (prop && prop.array && prop.swiftIvar) {
-            // Grab the actual class for the generic List from an instance of it
-            // so that we can make instances of the List without creating a new
-            // object accessor each time
-            Class cls = [object_getIvar(accessor, prop.swiftIvar) class];
-            RLMAccessorContext context(info);
-            for (size_t i = 0; i < count; ++i) {
-                RLMListBase *list = [[cls alloc] init];
-                list._rlmArray = [[RLMManagedArray alloc] initWithList:realm::List(info.realm->_realm,
-                                                                                   collection.get(i),
-                                                                                   info.tableColumn(prop))
-                                                            parentInfo:&info
-                                                              property:prop];
-                [array addObject:list];
-            }
-            return array;
-        }
-    }
-
-    for (size_t i = 0; i < count; i++) {
-        accessor->_row = collection.get(i);
-        RLMInitializeSwiftAccessorGenerics(accessor);
-        [array addObject:[accessor valueForKey:key] ?: NSNull.null];
-    }
-    return array;
-}
-
-template NSArray *RLMCollectionValueForKey(realm::Results&, NSString *, RLMClassInfo&);
-template NSArray *RLMCollectionValueForKey(realm::List&, NSString *, RLMClassInfo&);
-
-void RLMCollectionSetValueForKey(id<RLMFastEnumerable> collection, NSString *key, id value) {
-    realm::TableView tv = [collection tableView];
-    if (tv.size() == 0) {
-        return;
-    }
-
-    RLMClassInfo *info = collection.objectInfo;
-    RLMObject *accessor = RLMCreateManagedAccessor(info->rlmObjectSchema.accessorClass, info);
-    for (size_t i = 0; i < tv.size(); i++) {
-        accessor->_row = tv[i];
-        RLMInitializeSwiftAccessorGenerics(accessor);
-        [accessor setValue:value forKey:key];
-    }
-}
-
-NSString *RLMDescriptionWithMaxDepth(NSString *name,
-                                     id<RLMCollection> collection,
-                                     NSUInteger depth) {
-    if (depth == 0) {
-        return @"<Maximum depth exceeded>";
-    }
-
-    const NSUInteger maxObjects = 100;
-    auto str = [NSMutableString stringWithFormat:@"%@<%@> <%p> (\n", name,
-                [collection objectClassName] ?: RLMTypeToString([collection type]),
-                (void *)collection];
-    size_t index = 0, skipped = 0;
-    for (id obj in collection) {
-        NSString *sub;
-        if ([obj respondsToSelector:@selector(descriptionWithMaxDepth:)]) {
-            sub = [obj descriptionWithMaxDepth:depth - 1];
-        }
-        else {
-            sub = [obj description];
-        }
-
-        // Indent child objects
-        NSString *objDescription = [sub stringByReplacingOccurrencesOfString:@"\n"
-                                                                  withString:@"\n\t"];
-        [str appendFormat:@"\t[%zu] %@,\n", index++, objDescription];
-        if (index >= maxObjects) {
-            skipped = collection.count - maxObjects;
-            break;
-        }
-    }
-
-    // Remove last comma and newline characters
-    if (collection.count > 0) {
-        [str deleteCharactersInRange:NSMakeRange(str.length-2, 2)];
-    }
-    if (skipped) {
-        [str appendFormat:@"\n\t... %zu objects skipped.", skipped];
-    }
-    [str appendFormat:@"\n)"];
-    return str;
-}
-
-std::vector<std::pair<std::string, bool>> RLMSortDescriptorsToKeypathArray(NSArray<RLMSortDescriptor *> *properties) {
-    std::vector<std::pair<std::string, bool>> keypaths;
-    keypaths.reserve(properties.count);
-    for (RLMSortDescriptor *desc in properties) {
-        if ([desc.keyPath rangeOfString:@"@"].location != NSNotFound) {
-            @throw RLMException(@"Cannot sort on key path '%@': KVC collection operators are not supported.", desc.keyPath);
-        }
-        keypaths.push_back({desc.keyPath.UTF8String, desc.ascending});
-    }
-    return keypaths;
-}
-
-@implementation RLMCollectionChange {
-    realm::CollectionChangeSet _indices;
-}
-
-- (instancetype)initWithChanges:(realm::CollectionChangeSet)indices {
-    self = [super init];
-    if (self) {
-        _indices = std::move(indices);
-    }
-    return self;
-}
-
-static NSArray *toArray(realm::IndexSet const& set) {
-    NSMutableArray *ret = [NSMutableArray new];
-    for (auto index : set.as_indexes()) {
-        [ret addObject:@(index)];
-    }
-    return ret;
-}
-
-- (NSArray *)insertions {
-    return toArray(_indices.insertions);
-}
-
-- (NSArray *)deletions {
-    return toArray(_indices.deletions);
-}
-
-- (NSArray *)modifications {
-    return toArray(_indices.modifications);
-}
-
-static NSArray *toIndexPathArray(realm::IndexSet const& set, NSUInteger section) {
-    NSMutableArray *ret = [NSMutableArray new];
-    NSUInteger path[2] = {section, 0};
-    for (auto index : set.as_indexes()) {
-        path[1] = index;
-        [ret addObject:[NSIndexPath indexPathWithIndexes:path length:2]];
-    }
-    return ret;
-}
-
-- (NSArray<NSIndexPath *> *)deletionsInSection:(NSUInteger)section {
-    return toIndexPathArray(_indices.deletions, section);
-}
-
-- (NSArray<NSIndexPath *> *)insertionsInSection:(NSUInteger)section {
-    return toIndexPathArray(_indices.insertions, section);
-}
-
-- (NSArray<NSIndexPath *> *)modificationsInSection:(NSUInteger)section {
-    return toIndexPathArray(_indices.modifications, section);
-}
-
-- (NSString *)description {
-    return [NSString stringWithFormat:@"<RLMCollectionChange: %p> insertions: %@, deletions: %@, modifications: %@",
-            (__bridge void *)self, self.insertions, self.deletions, self.modifications];
-}
-
-@end
-
-namespace {
-struct CollectionCallbackWrapper {
-    void (^block)(id, RLMCollectionChange *, NSError *);
-    id collection;
-    bool ignoreChangesInInitialNotification;
-
-    void operator()(realm::CollectionChangeSet const& changes, std::exception_ptr err) {
-        if (err) {
-            try {
-                rethrow_exception(err);
-            }
-            catch (...) {
-                NSError *error = nil;
-                RLMRealmTranslateException(&error);
-                block(nil, nil, error);
-                return;
-            }
-        }
-
-        if (ignoreChangesInInitialNotification) {
-            ignoreChangesInInitialNotification = false;
-            block(collection, nil, nil);
-        }
-        else if (changes.empty()) {
-            block(collection, nil, nil);
-        }
-        else {
-            block(collection, [[RLMCollectionChange alloc] initWithChanges:changes], nil);
-        }
-    }
-};
-} // anonymous namespace
-
-@interface RLMCancellationToken : RLMNotificationToken
-@end
-
-@implementation RLMCancellationToken {
-@public
-    __unsafe_unretained RLMRealm *_realm;
-    realm::NotificationToken _token;
-    std::mutex _mutex;
-}
-
-- (RLMRealm *)realm {
-    std::lock_guard<std::mutex> lock(_mutex);
-    return _realm;
-}
-
-- (void)suppressNextNotification {
-    std::lock_guard<std::mutex> lock(_mutex);
-    if (_realm) {
-        _token.suppress_next();
-    }
-}
-
-- (void)invalidate {
-    std::lock_guard<std::mutex> lock(_mutex);
-    _token = {};
-    _realm = nil;
-}
-
-template<typename RLMCollection>
-RLMNotificationToken *RLMAddNotificationBlock(RLMCollection *collection,
-                                              void (^block)(id, RLMCollectionChange *, NSError *),
-                                              dispatch_queue_t queue) {
-    RLMRealm *realm = collection.realm;
-    if (!realm) {
-        @throw RLMException(@"Linking objects notifications are only supported on managed objects.");
-    }
-    bool skipFirst = std::is_same_v<RLMCollection, RLMResults>;
-    auto token = [[RLMCancellationToken alloc] init];
-
-    if (!queue) {
-        [realm verifyNotificationsAreSupported:true];
-        token->_realm = realm;
-        token->_token = RLMGetBackingCollection(collection).add_notification_callback(CollectionCallbackWrapper{block, collection, skipFirst});
-        return token;
-    }
-
-    RLMThreadSafeReference *tsr = [RLMThreadSafeReference referenceWithThreadConfined:collection];
-    token->_realm = realm;
-    RLMRealmConfiguration *config = realm.configuration;
-    dispatch_async(queue, ^{
-        std::lock_guard<std::mutex> lock(token->_mutex);
-        if (!token->_realm) {
-            return;
-        }
-        NSError *error;
-        RLMRealm *realm = token->_realm = [RLMRealm realmWithConfiguration:config queue:queue error:&error];
-        if (!realm) {
-            block(nil, nil, error);
-            return;
-        }
-        RLMCollection *collection = [realm resolveThreadSafeReference:tsr];
-        token->_token = RLMGetBackingCollection(collection).add_notification_callback(CollectionCallbackWrapper{block, collection, skipFirst});
-    });
-    return token;
-}
-@end
-
-// Explicitly instantiate the templated function for the two types we'll use it on
-template RLMNotificationToken *RLMAddNotificationBlock<>(RLMManagedArray *, void (^)(id, RLMCollectionChange *, NSError *), dispatch_queue_t);
-template RLMNotificationToken *RLMAddNotificationBlock<>(RLMResults *, void (^)(id, RLMCollectionChange *, NSError *), dispatch_queue_t);

+ 0 - 31
Carthage/Checkouts/realm-cocoa/Realm/RLMCollection_Private.h

@@ -1,31 +0,0 @@
-////////////////////////////////////////////////////////////////////////////
-//
-// Copyright 2016 Realm Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////
-
-#import <Realm/RLMCollection.h>
-
-#import <Realm/RLMRealm.h>
-
-@protocol RLMFastEnumerable;
-
-NS_ASSUME_NONNULL_BEGIN
-
-void RLMCollectionSetValueForKey(id<RLMFastEnumerable> collection, NSString *key, id _Nullable value);
-FOUNDATION_EXTERN NSString *RLMDescriptionWithMaxDepth(NSString *name, id<RLMCollection> collection, NSUInteger depth);
-FOUNDATION_EXTERN id _Nullable (*_Nullable RLMSwiftAsFastEnumeration)(id);
-
-NS_ASSUME_NONNULL_END

+ 0 - 82
Carthage/Checkouts/realm-cocoa/Realm/RLMCollection_Private.hpp

@@ -1,82 +0,0 @@
-////////////////////////////////////////////////////////////////////////////
-//
-// Copyright 2016 Realm Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////
-
-#import <Realm/RLMCollection_Private.h>
-
-#import <vector>
-
-namespace realm {
-    class List;
-    class Results;
-    class TableView;
-    struct CollectionChangeSet;
-    struct NotificationToken;
-}
-class RLMClassInfo;
-@class RLMFastEnumerator, RLMManagedArray;
-
-@protocol RLMFastEnumerable
-@property (nonatomic, readonly) RLMRealm *realm;
-@property (nonatomic, readonly) RLMClassInfo *objectInfo;
-@property (nonatomic, readonly) NSUInteger count;
-
-- (realm::TableView)tableView;
-- (RLMFastEnumerator *)fastEnumerator;
-@end
-
-// An object which encapulates the shared logic for fast-enumerating RLMArray
-// and RLMResults, and has a buffer to store strong references to the current
-// set of enumerated items
-@interface RLMFastEnumerator : NSObject
-- (instancetype)initWithList:(realm::List&)list
-                  collection:(id)collection
-                   classInfo:(RLMClassInfo&)info;
-- (instancetype)initWithResults:(realm::Results&)results
-                     collection:(id)collection
-                      classInfo:(RLMClassInfo&)info;
-
-// Detach this enumerator from the source collection. Must be called before the
-// source collection is changed.
-- (void)detach;
-
-- (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state
-                                    count:(NSUInteger)len;
-@end
-NSUInteger RLMFastEnumerate(NSFastEnumerationState *state, NSUInteger len, id<RLMFastEnumerable> collection);
-
-@interface RLMNotificationToken ()
-- (void)suppressNextNotification;
-- (RLMRealm *)realm;
-@end
-
-@interface RLMCollectionChange ()
-- (instancetype)initWithChanges:(realm::CollectionChangeSet)indices;
-@end
-
-realm::List& RLMGetBackingCollection(RLMManagedArray *);
-realm::Results& RLMGetBackingCollection(RLMResults *);
-
-template<typename RLMCollection>
-RLMNotificationToken *RLMAddNotificationBlock(RLMCollection *collection,
-                                              void (^block)(id, RLMCollectionChange *, NSError *),
-                                              dispatch_queue_t queue);
-
-template<typename Collection>
-NSArray *RLMCollectionValueForKey(Collection& collection, NSString *key, RLMClassInfo& info);
-
-std::vector<std::pair<std::string, bool>> RLMSortDescriptorsToKeypathArray(NSArray<RLMSortDescriptor *> *properties);

+ 0 - 224
Carthage/Checkouts/realm-cocoa/Realm/RLMConstants.h

@@ -1,224 +0,0 @@
-////////////////////////////////////////////////////////////////////////////
-//
-// Copyright 2014 Realm Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////
-
-#import <Foundation/Foundation.h>
-
-NS_ASSUME_NONNULL_BEGIN
-
-// For compatibility with Xcode 7, before extensible string enums were introduced,
-#ifdef NS_EXTENSIBLE_STRING_ENUM
-#define RLM_EXTENSIBLE_STRING_ENUM NS_EXTENSIBLE_STRING_ENUM
-#define RLM_EXTENSIBLE_STRING_ENUM_CASE_SWIFT_NAME(_, extensible_string_enum) NS_SWIFT_NAME(extensible_string_enum)
-#else
-#define RLM_EXTENSIBLE_STRING_ENUM
-#define RLM_EXTENSIBLE_STRING_ENUM_CASE_SWIFT_NAME(fully_qualified, _) NS_SWIFT_NAME(fully_qualified)
-#endif
-
-// Swift 5 considers NS_ENUM to be "open", meaning there could be values present
-// other than the defined cases (which allows adding more cases later without
-// it being a breaking change), while older versions consider it "closed".
-#ifdef NS_CLOSED_ENUM
-#define RLM_CLOSED_ENUM NS_CLOSED_ENUM
-#else
-#define RLM_CLOSED_ENUM NS_ENUM
-#endif
-
-#if __has_attribute(ns_error_domain) && (!defined(__cplusplus) || !__cplusplus || __cplusplus >= 201103L)
-#define RLM_ERROR_ENUM(type, name, domain) \
-    _Pragma("clang diagnostic push") \
-    _Pragma("clang diagnostic ignored \"-Wignored-attributes\"") \
-    NS_ENUM(type, __attribute__((ns_error_domain(domain))) name) \
-    _Pragma("clang diagnostic pop")
-#else
-#define RLM_ERROR_ENUM(type, name, domain) NS_ENUM(type, name)
-#endif
-
-
-#pragma mark - Enums
-
-/**
- `RLMPropertyType` is an enumeration describing all property types supported in Realm models.
-
- For more information, see [Realm Models](https://realm.io/docs/objc/latest/#models).
- */
-typedef RLM_CLOSED_ENUM(int32_t, RLMPropertyType) {
-
-#pragma mark - Primitive types
-
-    /** Integers: `NSInteger`, `int`, `long`, `Int` (Swift) */
-    RLMPropertyTypeInt    = 0,
-    /** Booleans: `BOOL`, `bool`, `Bool` (Swift) */
-    RLMPropertyTypeBool   = 1,
-    /** Floating-point numbers: `float`, `Float` (Swift) */
-    RLMPropertyTypeFloat  = 5,
-    /** Double-precision floating-point numbers: `double`, `Double` (Swift) */
-    RLMPropertyTypeDouble = 6,
-
-#pragma mark - Object types
-
-    /** Strings: `NSString`, `String` (Swift) */
-    RLMPropertyTypeString = 2,
-    /** Binary data: `NSData` */
-    RLMPropertyTypeData   = 3,
-    /**
-     Any object: `id`.
-
-     This property type is no longer supported for new models. However, old files
-     with any-typed properties are still supported for migration purposes.
-     */
-    RLMPropertyTypeAny    = 9,
-    /** Dates: `NSDate` */
-    RLMPropertyTypeDate   = 4,
-
-#pragma mark - Linked object types
-
-    /** Realm model objects. See [Realm Models](https://realm.io/docs/objc/latest/#models) for more information. */
-    RLMPropertyTypeObject = 7,
-    /** Realm linking objects. See [Realm Models](https://realm.io/docs/objc/latest/#models) for more information. */
-    RLMPropertyTypeLinkingObjects = 8,
-};
-
-/** An error domain identifying Realm-specific errors. */
-extern NSString * const RLMErrorDomain;
-
-/** An error domain identifying non-specific system errors. */
-extern NSString * const RLMUnknownSystemErrorDomain;
-
-/**
- `RLMError` is an enumeration representing all recoverable errors. It is associated with the
- Realm error domain specified in `RLMErrorDomain`.
- */
-typedef RLM_ERROR_ENUM(NSInteger, RLMError, RLMErrorDomain) {
-    /** Denotes a general error that occurred when trying to open a Realm. */
-    RLMErrorFail                  = 1,
-
-    /** Denotes a file I/O error that occurred when trying to open a Realm. */
-    RLMErrorFileAccess            = 2,
-
-    /**
-     Denotes a file permission error that ocurred when trying to open a Realm.
-
-     This error can occur if the user does not have permission to open or create
-     the specified file in the specified access mode when opening a Realm.
-     */
-    RLMErrorFilePermissionDenied  = 3,
-
-    /** Denotes an error where a file was to be written to disk, but another file with the same name already exists. */
-    RLMErrorFileExists            = 4,
-
-    /**
-     Denotes an error that occurs if a file could not be found.
-
-     This error may occur if a Realm file could not be found on disk when trying to open a
-     Realm as read-only, or if the directory part of the specified path was not found when
-     trying to write a copy.
-     */
-    RLMErrorFileNotFound          = 5,
-
-    /**
-     Denotes an error that occurs if a file format upgrade is required to open the file,
-     but upgrades were explicitly disabled.
-     */
-    RLMErrorFileFormatUpgradeRequired = 6,
-
-    /**
-     Denotes an error that occurs if the database file is currently open in another
-     process which cannot share with the current process due to an
-     architecture mismatch.
-
-     This error may occur if trying to share a Realm file between an i386 (32-bit) iOS
-     Simulator and the Realm Browser application. In this case, please use the 64-bit
-     version of the iOS Simulator.
-     */
-    RLMErrorIncompatibleLockFile  = 8,
-
-    /** Denotes an error that occurs when there is insufficient available address space. */
-    RLMErrorAddressSpaceExhausted = 9,
-
-    /** Denotes an error that occurs if there is a schema version mismatch, so that a migration is required. */
-    RLMErrorSchemaMismatch = 10,
-    // Error code 11 is obsolete
-    // RLMErrorIncompatibleSyncedFile = 11,
-    /**
-     Denotates an error where an operation was requested which cannot be performed on an open file.
-     */
-    RLMErrorAlreadyOpen = 12,
-};
-
-#pragma mark - Constants
-
-#pragma mark - Notification Constants
-
-/**
- A notification indicating that changes were made to a Realm.
-*/
-typedef NSString * RLMNotification RLM_EXTENSIBLE_STRING_ENUM;
-
-/**
- This notification is posted when a write transaction has been committed to a Realm on a different thread for
- the same file.
-
- It is not posted if `autorefresh` is enabled, or if the Realm is refreshed before the notification has a chance
- to run.
-
- Realms with autorefresh disabled should normally install a handler for this notification which calls
- `-[RLMRealm refresh]` after doing some work. Refreshing the Realm is optional, but not refreshing the Realm may lead to
- large Realm files. This is because an extra copy of the data must be kept for the stale Realm.
- */
-extern RLMNotification const RLMRealmRefreshRequiredNotification
-RLM_EXTENSIBLE_STRING_ENUM_CASE_SWIFT_NAME(RLMRealmRefreshRequiredNotification, RefreshRequired);
-
-/**
- This notification is posted by a Realm when a write transaction has been
- committed to a Realm on a different thread for the same file.
-
- It is not posted if `-[RLMRealm autorefresh]` is enabled, or if the Realm is
- refreshed before the notification has a chance to run.
-
- Realms with autorefresh disabled should normally install a handler for this
- notification which calls `-[RLMRealm refresh]` after doing some work. Refreshing
- the Realm is optional, but not refreshing the Realm may lead to large Realm
- files. This is because Realm must keep an extra copy of the data for the stale
- Realm.
- */
-extern RLMNotification const RLMRealmDidChangeNotification
-RLM_EXTENSIBLE_STRING_ENUM_CASE_SWIFT_NAME(RLMRealmDidChangeNotification, DidChange);
-
-#pragma mark - Error keys
-
-/** Key to identify the associated backup Realm configuration in an error's `userInfo` dictionary */
-extern NSString * const RLMBackupRealmConfigurationErrorKey;
-
-#pragma mark - Other Constants
-
-/** The schema version used for uninitialized Realms */
-extern const uint64_t RLMNotVersioned;
-
-/** The corresponding value is the name of an exception thrown by Realm. */
-extern NSString * const RLMExceptionName;
-
-/** The corresponding value is a Realm file version. */
-extern NSString * const RLMRealmVersionKey;
-
-/** The corresponding key is the version of the underlying database engine. */
-extern NSString * const RLMRealmCoreVersionKey;
-
-/** The corresponding key is the Realm invalidated property name. */
-extern NSString * const RLMInvalidatedKey;
-
-NS_ASSUME_NONNULL_END

+ 0 - 36
Carthage/Checkouts/realm-cocoa/Realm/RLMConstants.m

@@ -1,36 +0,0 @@
-////////////////////////////////////////////////////////////////////////////
-//
-// Copyright 2014 Realm Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////
-
-#import <Realm/RLMConstants.h>
-
-RLMNotification const RLMRealmRefreshRequiredNotification = @"RLMRealmRefreshRequiredNotification";
-RLMNotification const RLMRealmDidChangeNotification = @"RLMRealmDidChangeNotification";
-
-NSString * const RLMErrorDomain = @"io.realm";
-
-NSString * const RLMUnknownSystemErrorDomain = @"io.realm.unknown";
-
-NSString * const RLMExceptionName = @"RLMException";
-
-NSString * const RLMRealmVersionKey = @"RLMRealmVersion";
-
-NSString * const RLMRealmCoreVersionKey = @"RLMRealmCoreVersion";
-
-NSString * const RLMInvalidatedKey = @"invalidated";
-
-NSString * const RLMBackupRealmConfigurationErrorKey = @"RLMBackupRealmConfiguration";

+ 0 - 103
Carthage/Checkouts/realm-cocoa/Realm/RLMJSONModels.h

@@ -1,103 +0,0 @@
-////////////////////////////////////////////////////////////////////////////
-//
-// Copyright 2017 Realm Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////
-
-#import <Foundation/Foundation.h>
-
-#import "RLMSyncUtil_Private.h"
-
-NS_ASSUME_NONNULL_BEGIN
-
-@class RLMTokenDataModel, RLMSyncUserAccountInfo;
-
-#pragma mark - RLMTokenModel
-
-@interface RLMTokenModel : NSObject RLM_SYNC_UNINITIALIZABLE
-
-@property (nonatomic, readonly) NSString *token;
-@property (nonatomic, nullable, readonly) NSString *path;
-@property (nonatomic, readonly) RLMTokenDataModel *tokenData;
-
-- (instancetype)initWithDictionary:(NSDictionary *)jsonDictionary;
-
-@end
-
-#pragma mark - RLMTokenDataModel
-
-@interface RLMTokenDataModel : NSObject RLM_SYNC_UNINITIALIZABLE
-
-@property (nonatomic, readonly) NSString *identity;
-@property (nonatomic, nullable, readonly) NSString *appID;
-@property (nonatomic, nullable, readonly) NSString *path;
-@property (nonatomic, readonly) NSTimeInterval expires;
-@property (nonatomic, readonly) BOOL isAdmin;
-
-- (instancetype)initWithDictionary:(NSDictionary *)jsonDictionary;
-
-@end
-
-#pragma mark - RLMAuthResponseModel
-
-/**
- An internal class representing a valid JSON response to an auth request.
-
- ```
- {
- "access_token": { ... } // (optional),
- "refresh_token": { ... } // (optional)
- }
- ```
- */
-@interface RLMAuthResponseModel : NSObject RLM_SYNC_UNINITIALIZABLE
-
-@property (nonatomic, readonly, nullable) RLMTokenModel *accessToken;
-@property (nonatomic, readonly, nullable) RLMTokenModel *refreshToken;
-@property (nonatomic, readonly, nullable) NSString *urlPrefix;
-
-- (instancetype)initWithDictionary:(NSDictionary *)jsonDictionary
-                requireAccessToken:(BOOL)requireAccessToken
-               requireRefreshToken:(BOOL)requireRefreshToken;
-
-@end
-
-#pragma mark - RLMUserInfoResponseModel
-
-@interface RLMUserResponseModel : NSObject RLM_SYNC_UNINITIALIZABLE
-
-@property (nonatomic, readonly) NSString *identity;
-@property (nonatomic, readonly) NSArray<RLMSyncUserAccountInfo *> *accounts;
-@property (nonatomic, readonly) NSDictionary *metadata;
-@property (nonatomic, readonly) BOOL isAdmin;
-
-- (instancetype)initWithDictionary:(NSDictionary *)jsonDictionary;
-
-@end
-
-#pragma mark - RLMSyncErrorResponseModel
-
-@interface RLMSyncErrorResponseModel : NSObject RLM_SYNC_UNINITIALIZABLE
-
-@property (nonatomic, readonly) NSInteger status;
-@property (nonatomic, readonly) NSInteger code;
-@property (nullable, nonatomic, readonly) NSString *title;
-@property (nullable, nonatomic, readonly) NSString *hint;
-
-- (instancetype)initWithDictionary:(NSDictionary *)jsonDictionary;
-
-@end
-
-NS_ASSUME_NONNULL_END

+ 0 - 233
Carthage/Checkouts/realm-cocoa/Realm/RLMJSONModels.m

@@ -1,233 +0,0 @@
-////////////////////////////////////////////////////////////////////////////
-//
-// Copyright 2017 Realm Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////
-
-#import "RLMJSONModels.h"
-#import "RLMSyncUtil_Private.h"
-#import "RLMSyncUser.h"
-
-#pragma mark - Constants
-
-static const NSString *const kRLMSyncAccessTokenKey     = @"access_token";
-static const NSString *const kRLMSyncAccountsKey        = @"accounts";
-static const NSString *const kRLMSyncErrorCodeKey       = @"code";
-static const NSString *const kRLMSyncExpiresKey         = @"expires";
-static const NSString *const kRLMSyncErrorHintKey       = @"hint";
-static const NSString *const kRLMSyncIdKey              = @"id";
-static const NSString *const kRLMSyncKeyKey             = @"key";
-static const NSString *const kRLMSyncMetadataKey        = @"metadata";
-static const NSString *const kRLMSyncRefreshTokenKey    = @"refresh_token";
-static const NSString *const kRLMSyncErrorStatusKey     = @"status";
-static const NSString *const kRLMSyncErrorTitleKey      = @"title";
-static const NSString *const kRLMSyncTokenDataKey       = @"token_data";
-static const NSString *const kRLMSyncUserKey            = @"user";
-static const NSString *const kRLMSyncValueKey           = @"value";
-
-#pragma mark - RLMTokenDataModel
-
-@interface RLMTokenDataModel ()
-
-@property (nonatomic, readwrite) NSString *identity;
-@property (nonatomic, readwrite) NSString *appID;
-@property (nonatomic, readwrite) NSString *path;
-@property (nonatomic, readwrite) NSTimeInterval expires;
-@property (nonatomic, readwrite) BOOL isAdmin;
-
-@end
-
-@implementation RLMTokenDataModel
-
-- (instancetype)initWithDictionary:(NSDictionary *)jsonDictionary {
-    if (self = [super init]) {
-        self.isAdmin = NO;
-        RLM_SYNC_PARSE_STRING_OR_ABORT(jsonDictionary, kRLMSyncIdentityKey, identity);
-        RLM_SYNC_PARSE_OPTIONAL_STRING(jsonDictionary, kRLMSyncAppIDKey, appID);
-        RLM_SYNC_PARSE_OPTIONAL_STRING(jsonDictionary, kRLMSyncPathKey, path);
-        RLM_SYNC_PARSE_OPTIONAL_BOOL(jsonDictionary, kRLMSyncIsAdminKey, isAdmin);
-        RLM_SYNC_PARSE_DOUBLE_OR_ABORT(jsonDictionary, kRLMSyncExpiresKey, expires);
-        return self;
-    }
-    return nil;
-}
-
-@end
-
-#pragma mark - RLMTokenModel
-
-@interface RLMTokenModel ()
-
-@property (nonatomic, readwrite) NSString *token;
-@property (nonatomic, nullable, readwrite) NSString *path;
-@property (nonatomic, readwrite) RLMTokenDataModel *tokenData;
-
-@end
-
-@implementation RLMTokenModel
-
-- (instancetype)initWithDictionary:(NSDictionary *)jsonDictionary {
-    if (self = [super init]) {
-        RLM_SYNC_PARSE_STRING_OR_ABORT(jsonDictionary, kRLMSyncTokenKey, token);
-        RLM_SYNC_PARSE_OPTIONAL_STRING(jsonDictionary, kRLMSyncPathKey, path);
-        RLM_SYNC_PARSE_MODEL_OR_ABORT(jsonDictionary, kRLMSyncTokenDataKey, RLMTokenDataModel, tokenData);
-        return self;
-    }
-    return nil;
-}
-
-@end
-
-#pragma mark - RLMAuthResponseModel
-
-@interface RLMAuthResponseModel ()
-
-@property (nonatomic, readwrite) RLMTokenModel *accessToken;
-@property (nonatomic, readwrite) RLMTokenModel *refreshToken;
-@property (nonatomic, readwrite) NSString *urlPrefix;
-
-@end
-
-@implementation RLMAuthResponseModel
-
-- (instancetype)initWithDictionary:(NSDictionary *)jsonDictionary
-                requireAccessToken:(BOOL)requireAccessToken
-               requireRefreshToken:(BOOL)requireRefreshToken {
-    if (self = [super init]) {
-        // Get the access token.
-        if (requireAccessToken) {
-            RLM_SYNC_PARSE_MODEL_OR_ABORT(jsonDictionary, kRLMSyncAccessTokenKey, RLMTokenModel, accessToken);
-        } else {
-            RLM_SYNC_PARSE_OPTIONAL_MODEL(jsonDictionary, kRLMSyncAccessTokenKey, RLMTokenModel, accessToken);
-        }
-        // Get the refresh token.
-        if (requireRefreshToken) {
-            RLM_SYNC_PARSE_MODEL_OR_ABORT(jsonDictionary, kRLMSyncRefreshTokenKey, RLMTokenModel, refreshToken);
-        } else {
-            RLM_SYNC_PARSE_OPTIONAL_MODEL(jsonDictionary, kRLMSyncRefreshTokenKey, RLMTokenModel, refreshToken);
-        }
-        self.urlPrefix = jsonDictionary[@"sync_worker"][@"path"];
-        return self;
-    }
-    return nil;
-}
-
-@end
-
-#pragma mark - RLMUserInfoResponseModel
-
-@interface RLMSyncUserAccountInfo ()
-@property (nonatomic, readwrite) NSString *provider;
-@property (nonatomic, readwrite) NSString *providerUserIdentity;
-@end
-
-@implementation RLMSyncUserAccountInfo
-
-- (instancetype)initWithDictionary:(NSDictionary *)jsonDictionary {
-    if (self = [super init]) {
-        RLM_SYNC_PARSE_STRING_OR_ABORT(jsonDictionary, kRLMSyncProviderKey, provider);
-        RLM_SYNC_PARSE_STRING_OR_ABORT(jsonDictionary, kRLMSyncProviderIDKey, providerUserIdentity);
-        return self;
-    }
-    return nil;
-}
-
-@end
-
-@interface RLMUserResponseModel ()
-
-@property (nonatomic, readwrite) NSString *identity;
-@property (nonatomic, readwrite) NSArray *accounts;
-@property (nonatomic, readwrite) NSDictionary *metadata;
-@property (nonatomic, readwrite) BOOL isAdmin;
-
-@end
-
-@implementation RLMUserResponseModel
-
-- (void)parseMetadataFromJSON:(NSDictionary *)jsonDictionary {
-    NSMutableDictionary *buffer = [NSMutableDictionary dictionary];
-    NSArray *metadataArray = jsonDictionary[kRLMSyncMetadataKey];
-    if (![metadataArray isKindOfClass:[NSArray class]]) {
-        self.metadata = @{};
-        return;
-    }
-    for (NSDictionary *object in metadataArray) {
-        if (![object isKindOfClass:[NSDictionary class]]) {
-            continue;
-        }
-        NSString *key = object[kRLMSyncKeyKey];
-        NSString *value = object[kRLMSyncValueKey];
-        if (!key || !value) {
-            continue;
-        }
-        buffer[key] = value;
-    }
-    self.metadata = [buffer copy];
-}
-
-- (instancetype)initWithDictionary:(NSDictionary *)jsonDictionary {
-    if (self = [super init]) {
-        self.isAdmin = NO;
-        RLM_SYNC_PARSE_STRING_OR_ABORT(jsonDictionary, kRLMSyncUserIDKey, identity);
-        RLM_SYNC_PARSE_OPTIONAL_BOOL(jsonDictionary, kRLMSyncIsAdminKey, isAdmin);
-        RLM_SYNC_PARSE_MODEL_ARRAY_OR_ABORT(jsonDictionary, kRLMSyncAccountsKey, RLMSyncUserAccountInfo, accounts);
-        [self parseMetadataFromJSON:jsonDictionary];
-        return self;
-    }
-    return nil;
-}
-
-@end
-
-#pragma mark - RLMSyncErrorResponseModel
-
-@interface RLMSyncErrorResponseModel ()
-
-@property (nonatomic, readwrite) NSInteger status;
-@property (nonatomic, readwrite) NSInteger code;
-@property (nonatomic, readwrite) NSString *title;
-@property (nonatomic, readwrite) NSString *hint;
-
-@end
-
-@implementation RLMSyncErrorResponseModel
-
-- (instancetype)initWithDictionary:(NSDictionary *)jsonDictionary {
-    if (self = [super init]) {
-        RLM_SYNC_PARSE_DOUBLE_OR_ABORT(jsonDictionary, kRLMSyncErrorStatusKey, status);
-        RLM_SYNC_PARSE_DOUBLE_OR_ABORT(jsonDictionary, kRLMSyncErrorCodeKey, code);
-        RLM_SYNC_PARSE_OPTIONAL_STRING(jsonDictionary, kRLMSyncErrorTitleKey, title);
-        RLM_SYNC_PARSE_OPTIONAL_STRING(jsonDictionary, kRLMSyncErrorHintKey, hint);
-
-        NSString *detail = jsonDictionary[@"detail"];
-        if ([detail isKindOfClass:[NSString class]]) {
-            _title = detail;
-        }
-
-        for (NSDictionary<NSString *, NSString *> *problem in jsonDictionary[@"invalid_params"]) {
-            NSString *name = problem[@"name"];
-            NSString *reason = problem[@"reason"];
-            if (name && reason) {
-                _title = [NSString stringWithFormat:@"%@ %@: %@;", _title, name, reason];
-            }
-        }
-
-        return self;
-    }
-    return nil;
-}
-
-@end

+ 0 - 42
Carthage/Checkouts/realm-cocoa/Realm/RLMListBase.h

@@ -1,42 +0,0 @@
-////////////////////////////////////////////////////////////////////////////
-//
-// Copyright 2014 Realm Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////
-
-#import <Foundation/Foundation.h>
-
-@class RLMArray, RLMObjectBase, RLMResults, RLMProperty, RLMLinkingObjects;
-
-NS_ASSUME_NONNULL_BEGIN
-
-// A base class for Swift generic Lists to make it possible to interact with
-// them from obj-c
-@interface RLMListBase : NSObject <NSFastEnumeration>
-@property (nonatomic, strong) RLMArray *_rlmArray;
-
-- (instancetype)init;
-- (instancetype)initWithArray:(RLMArray *)array;
-@end
-
-@interface RLMLinkingObjectsHandle : NSObject
-- (instancetype)initWithObject:(RLMObjectBase *)object property:(RLMProperty *)property;
-- (instancetype)initWithLinkingObjects:(RLMResults *)linkingObjects;
-- (instancetype)freeze;
-
-@property (nonatomic, readonly) RLMLinkingObjects *results;
-@end
-
-NS_ASSUME_NONNULL_END

+ 0 - 147
Carthage/Checkouts/realm-cocoa/Realm/RLMListBase.mm

@@ -1,147 +0,0 @@
-////////////////////////////////////////////////////////////////////////////
-//
-// Copyright 2015 Realm Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////
-
-#import "RLMListBase.h"
-
-#import "RLMArray_Private.hpp"
-#import "RLMObjectSchema_Private.h"
-#import "RLMObject_Private.hpp"
-#import "RLMObservation.hpp"
-#import "RLMProperty_Private.h"
-#import "RLMRealm_Private.hpp"
-
-@interface RLMArray (KVO)
-- (NSArray *)objectsAtIndexes:(__unused NSIndexSet *)indexes;
-@end
-
-@implementation RLMListBase {
-    std::unique_ptr<RLMObservationInfo> _observationInfo;
-}
-
-+ (RLMArray *)_unmanagedArray {
-    return nil;
-}
-
-- (instancetype)init {
-    return self = [super init];
-}
-
-- (instancetype)initWithArray:(RLMArray *)array {
-    self = [super init];
-    if (self) {
-        __rlmArray = array;
-    }
-    return self;
-}
-
-- (RLMArray *)_rlmArray {
-    if (!__rlmArray) {
-        __rlmArray = self.class._unmanagedArray;
-    }
-    return __rlmArray;
-}
-
-- (id)valueForKey:(NSString *)key {
-    return [self._rlmArray valueForKey:key];
-}
-
-- (id)valueForKeyPath:(NSString *)keyPath {
-    return [self._rlmArray valueForKeyPath:keyPath];
-}
-
-- (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state
-                                  objects:(id __unsafe_unretained [])buffer
-                                    count:(NSUInteger)len {
-    return [self._rlmArray countByEnumeratingWithState:state objects:buffer count:len];
-}
-
-- (NSArray *)objectsAtIndexes:(NSIndexSet *)indexes {
-    return [self._rlmArray objectsAtIndexes:indexes];
-}
-
-- (void)addObserver:(id)observer
-         forKeyPath:(NSString *)keyPath
-            options:(NSKeyValueObservingOptions)options
-            context:(void *)context {
-    RLMEnsureArrayObservationInfo(_observationInfo, keyPath, self._rlmArray, self);
-    [super addObserver:observer forKeyPath:keyPath options:options context:context];
-}
-
-@end
-
-@implementation RLMLinkingObjectsHandle {
-    realm::TableKey _tableKey;
-    realm::ObjKey _objKey;
-    RLMClassInfo *_info;
-    RLMRealm *_realm;
-    RLMProperty *_property;
-
-    RLMResults *_results;
-}
-
-- (instancetype)initWithObject:(RLMObjectBase *)object property:(RLMProperty *)prop {
-    if (!(self = [super init])) {
-        return nil;
-    }
-    auto& obj = object->_row;
-    _tableKey = obj.get_table()->get_key();
-    _objKey = obj.get_key();
-    _info = object->_info;
-    _realm = object->_realm;
-    _property = prop;
-
-    return self;
-}
-
-- (instancetype)initWithLinkingObjects:(RLMResults *)linkingObjects {
-    if (!(self = [super init])) {
-        return nil;
-    }
-    _realm = linkingObjects.realm;
-    _results = linkingObjects;
-
-    return self;
-}
-
-- (instancetype)freeze {
-    RLMLinkingObjectsHandle *frozen = [[self.class alloc] init];
-    frozen->_results = [self.results freeze];
-    return frozen;
-}
-
-- (RLMResults *)results {
-    if (_results) {
-        return _results;
-    }
-    [_realm verifyThread];
-
-    auto table = _realm.group.get_table(_tableKey);
-    if (!table->is_valid(_objKey)) {
-        @throw RLMException(@"Object has been deleted or invalidated.");
-    }
-
-    auto obj = _realm.group.get_table(_tableKey)->get_object(_objKey);
-    auto& objectInfo = _realm->_info[_property.objectClassName];
-    auto& linkOrigin = _info->objectSchema->computed_properties[_property.index].link_origin_property_name;
-    auto linkingProperty = objectInfo.objectSchema->property_for_name(linkOrigin);
-    realm::Results results(_realm->_realm, obj.get_backlink_view(objectInfo.table(), linkingProperty->column_key));
-    _results = [RLMLinkingObjects resultsWithObjectInfo:objectInfo results:std::move(results)];
-    _realm = nil;
-    return _results;
-}
-@end

+ 0 - 568
Carthage/Checkouts/realm-cocoa/Realm/RLMManagedArray.mm

@@ -1,568 +0,0 @@
-////////////////////////////////////////////////////////////////////////////
-//
-// Copyright 2014 Realm Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////
-
-#import "RLMArray_Private.hpp"
-
-#import "RLMAccessor.hpp"
-#import "RLMObjectSchema_Private.hpp"
-#import "RLMObjectStore.h"
-#import "RLMObject_Private.hpp"
-#import "RLMObservation.hpp"
-#import "RLMProperty_Private.h"
-#import "RLMQueryUtil.hpp"
-#import "RLMRealm_Private.hpp"
-#import "RLMSchema.h"
-#import "RLMThreadSafeReference_Private.hpp"
-#import "RLMUtil.hpp"
-
-#import "list.hpp"
-#import "results.hpp"
-#import "shared_realm.hpp"
-
-#import <realm/table_view.hpp>
-#import <objc/runtime.h>
-
-@interface RLMManagedArrayHandoverMetadata : NSObject
-@property (nonatomic) NSString *parentClassName;
-@property (nonatomic) NSString *key;
-@end
-
-@implementation RLMManagedArrayHandoverMetadata
-@end
-
-@interface RLMManagedArray () <RLMThreadConfined_Private>
-@end
-
-//
-// RLMArray implementation
-//
-@implementation RLMManagedArray {
-@public
-    realm::List _backingList;
-    RLMRealm *_realm;
-    RLMClassInfo *_objectInfo;
-    RLMClassInfo *_ownerInfo;
-    std::unique_ptr<RLMObservationInfo> _observationInfo;
-}
-
-- (RLMManagedArray *)initWithList:(realm::List)list
-                       parentInfo:(RLMClassInfo *)parentInfo
-                         property:(__unsafe_unretained RLMProperty *const)property {
-    if (property.type == RLMPropertyTypeObject)
-        self = [self initWithObjectClassName:property.objectClassName];
-    else
-        self = [self initWithObjectType:property.type optional:property.optional];
-    if (self) {
-        _realm = parentInfo->realm;
-        REALM_ASSERT(list.get_realm() == _realm->_realm);
-        _backingList = std::move(list);
-        _ownerInfo = parentInfo;
-        if (property.type == RLMPropertyTypeObject)
-            _objectInfo = &parentInfo->linkTargetType(property.index);
-        else
-            _objectInfo = _ownerInfo;
-        _key = property.name;
-    }
-    return self;
-}
-
-- (RLMManagedArray *)initWithParent:(__unsafe_unretained RLMObjectBase *const)parentObject
-                           property:(__unsafe_unretained RLMProperty *const)property {
-    __unsafe_unretained RLMRealm *const realm = parentObject->_realm;
-    auto col = parentObject->_info->tableColumn(property);
-    return [self initWithList:realm::List(realm->_realm, parentObject->_row, col)
-                   parentInfo:parentObject->_info
-                     property:property];
-}
-
-void RLMValidateArrayObservationKey(__unsafe_unretained NSString *const keyPath,
-                                    __unsafe_unretained RLMArray *const array) {
-    if (![keyPath isEqualToString:RLMInvalidatedKey]) {
-        @throw RLMException(@"[<%@ %p> addObserver:forKeyPath:options:context:] is not supported. Key path: %@",
-                            [array class], array, keyPath);
-    }
-}
-
-void RLMEnsureArrayObservationInfo(std::unique_ptr<RLMObservationInfo>& info,
-                                   __unsafe_unretained NSString *const keyPath,
-                                   __unsafe_unretained RLMArray *const array,
-                                   __unsafe_unretained id const observed) {
-    RLMValidateArrayObservationKey(keyPath, array);
-    if (!info && array.class == [RLMManagedArray class]) {
-        auto lv = static_cast<RLMManagedArray *>(array);
-        info = std::make_unique<RLMObservationInfo>(*lv->_ownerInfo,
-                                                    lv->_backingList.get_parent_object_key(),
-                                                    observed);
-    }
-}
-
-//
-// validation helpers
-//
-[[gnu::noinline]]
-[[noreturn]]
-static void throwError(__unsafe_unretained RLMManagedArray *const ar, NSString *aggregateMethod) {
-    try {
-        throw;
-    }
-    catch (realm::InvalidTransactionException const&) {
-        @throw RLMException(@"Cannot modify managed RLMArray outside of a write transaction.");
-    }
-    catch (realm::IncorrectThreadException const&) {
-        @throw RLMException(@"Realm accessed from incorrect thread.");
-    }
-    catch (realm::List::InvalidatedException const&) {
-        @throw RLMException(@"RLMArray has been invalidated or the containing object has been deleted.");
-    }
-    catch (realm::List::OutOfBoundsIndexException const& e) {
-        @throw RLMException(@"Index %zu is out of bounds (must be less than %zu).",
-                            e.requested, e.valid_count);
-    }
-    catch (realm::Results::UnsupportedColumnTypeException const& e) {
-        if (ar->_backingList.get_type() == realm::PropertyType::Object) {
-            @throw RLMException(@"%@: is not supported for %s%s property '%s'.",
-                                aggregateMethod,
-                                string_for_property_type(e.property_type),
-                                is_nullable(e.property_type) ? "?" : "",
-                                e.column_name.data());
-        }
-        @throw RLMException(@"%@: is not supported for %s%s array '%@.%@'.",
-                            aggregateMethod,
-                            string_for_property_type(e.property_type),
-                            is_nullable(e.property_type) ? "?" : "",
-                            ar->_ownerInfo->rlmObjectSchema.className, ar->_key);
-    }
-    catch (std::logic_error const& e) {
-        @throw RLMException(e);
-    }
-}
-
-template<typename Function>
-static auto translateErrors(__unsafe_unretained RLMManagedArray *const ar,
-                            Function&& f, NSString *aggregateMethod=nil) {
-    try {
-        return f();
-    }
-    catch (...) {
-        throwError(ar, aggregateMethod);
-    }
-}
-
-template<typename Function>
-static auto translateErrors(Function&& f) {
-    try {
-        return f();
-    }
-    catch (...) {
-        throwError(nil, nil);
-    }
-}
-
-template<typename IndexSetFactory>
-static void changeArray(__unsafe_unretained RLMManagedArray *const ar,
-                        NSKeyValueChange kind, dispatch_block_t f, IndexSetFactory&& is) {
-    translateErrors([&] { ar->_backingList.verify_in_transaction(); });
-    RLMObservationInfo *info = RLMGetObservationInfo(ar->_observationInfo.get(),
-                                                     ar->_backingList.get_parent_object_key(),
-                                                     *ar->_ownerInfo);
-    if (info) {
-        NSIndexSet *indexes = is();
-        info->willChange(ar->_key, kind, indexes);
-        try {
-            f();
-        }
-        catch (...) {
-            info->didChange(ar->_key, kind, indexes);
-            throwError(ar, nil);
-        }
-        info->didChange(ar->_key, kind, indexes);
-    }
-    else {
-        translateErrors([&] { f(); });
-    }
-}
-
-static void changeArray(__unsafe_unretained RLMManagedArray *const ar, NSKeyValueChange kind, NSUInteger index, dispatch_block_t f) {
-    changeArray(ar, kind, f, [=] { return [NSIndexSet indexSetWithIndex:index]; });
-}
-
-static void changeArray(__unsafe_unretained RLMManagedArray *const ar, NSKeyValueChange kind, NSRange range, dispatch_block_t f) {
-    changeArray(ar, kind, f, [=] { return [NSIndexSet indexSetWithIndexesInRange:range]; });
-}
-
-static void changeArray(__unsafe_unretained RLMManagedArray *const ar, NSKeyValueChange kind, NSIndexSet *is, dispatch_block_t f) {
-    changeArray(ar, kind, f, [=] { return is; });
-}
-
-//
-// public method implementations
-//
-- (RLMRealm *)realm {
-    return _realm;
-}
-
-- (NSUInteger)count {
-    return translateErrors([&] { return _backingList.size(); });
-}
-
-- (BOOL)isInvalidated {
-    return translateErrors([&] { return !_backingList.is_valid(); });
-}
-
-- (RLMClassInfo *)objectInfo {
-    return _objectInfo;
-}
-
-
-- (bool)isBackedByList:(realm::List const&)list {
-    return _backingList == list;
-}
-
-- (BOOL)isEqual:(id)object {
-    return [object respondsToSelector:@selector(isBackedByList:)] && [object isBackedByList:_backingList];
-}
-
-- (NSUInteger)hash {
-    return std::hash<realm::List>()(_backingList);
-}
-
-- (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state
-                                  objects:(__unused __unsafe_unretained id [])buffer
-                                    count:(NSUInteger)len {
-    return RLMFastEnumerate(state, len, self);
-}
-
-- (id)objectAtIndex:(NSUInteger)index {
-    return translateErrors([&] {
-        RLMAccessorContext context(*_objectInfo);
-        return _backingList.get(context, index);
-    });
-}
-
-static void RLMInsertObject(RLMManagedArray *ar, id object, NSUInteger index) {
-    RLMArrayValidateMatchingObjectType(ar, object);
-    if (index == NSUIntegerMax) {
-        index = translateErrors([&] { return ar->_backingList.size(); });
-    }
-
-    changeArray(ar, NSKeyValueChangeInsertion, index, ^{
-        RLMAccessorContext context(*ar->_objectInfo);
-        ar->_backingList.insert(context, index, object);
-    });
-}
-
-- (void)addObject:(id)object {
-    RLMInsertObject(self, object, NSUIntegerMax);
-}
-
-- (void)insertObject:(id)object atIndex:(NSUInteger)index {
-    RLMInsertObject(self, object, index);
-}
-
-- (void)insertObjects:(id<NSFastEnumeration>)objects atIndexes:(NSIndexSet *)indexes {
-    changeArray(self, NSKeyValueChangeInsertion, indexes, ^{
-        NSUInteger index = [indexes firstIndex];
-        RLMAccessorContext context(*_objectInfo);
-        for (id obj in objects) {
-            RLMArrayValidateMatchingObjectType(self, obj);
-            _backingList.insert(context, index, obj);
-            index = [indexes indexGreaterThanIndex:index];
-        }
-    });
-}
-
-
-- (void)removeObjectAtIndex:(NSUInteger)index {
-    changeArray(self, NSKeyValueChangeRemoval, index, ^{
-        _backingList.remove(index);
-    });
-}
-
-- (void)removeObjectsAtIndexes:(NSIndexSet *)indexes {
-    changeArray(self, NSKeyValueChangeRemoval, indexes, ^{
-        [indexes enumerateIndexesWithOptions:NSEnumerationReverse usingBlock:^(NSUInteger idx, BOOL *) {
-            _backingList.remove(idx);
-        }];
-    });
-}
-
-- (void)addObjectsFromArray:(NSArray *)array {
-    changeArray(self, NSKeyValueChangeInsertion, NSMakeRange(self.count, array.count), ^{
-        RLMAccessorContext context(*_objectInfo);
-        for (id obj in array) {
-            RLMArrayValidateMatchingObjectType(self, obj);
-            _backingList.add(context, obj);
-        }
-    });
-}
-
-- (void)removeAllObjects {
-    changeArray(self, NSKeyValueChangeRemoval, NSMakeRange(0, self.count), ^{
-        _backingList.remove_all();
-    });
-}
-
-- (void)replaceObjectAtIndex:(NSUInteger)index withObject:(id)object {
-    RLMArrayValidateMatchingObjectType(self, object);
-    changeArray(self, NSKeyValueChangeReplacement, index, ^{
-        RLMAccessorContext context(*_objectInfo);
-        _backingList.set(context, index, object);
-    });
-}
-
-- (void)moveObjectAtIndex:(NSUInteger)sourceIndex toIndex:(NSUInteger)destinationIndex {
-    auto start = std::min(sourceIndex, destinationIndex);
-    auto len = std::max(sourceIndex, destinationIndex) - start + 1;
-    changeArray(self, NSKeyValueChangeReplacement, {start, len}, ^{
-        _backingList.move(sourceIndex, destinationIndex);
-    });
-}
-
-- (void)exchangeObjectAtIndex:(NSUInteger)index1 withObjectAtIndex:(NSUInteger)index2 {
-    changeArray(self, NSKeyValueChangeReplacement, ^{
-        _backingList.swap(index1, index2);
-    }, [=] {
-        NSMutableIndexSet *set = [[NSMutableIndexSet alloc] initWithIndex:index1];
-        [set addIndex:index2];
-        return set;
-    });
-}
-
-- (NSUInteger)indexOfObject:(id)object {
-    RLMArrayValidateMatchingObjectType(self, object);
-    return translateErrors([&] {
-        RLMAccessorContext context(*_objectInfo);
-        return RLMConvertNotFound(_backingList.find(context, object));
-    });
-}
-
-- (id)valueForKeyPath:(NSString *)keyPath {
-    if ([keyPath hasPrefix:@"@"]) {
-        // Delegate KVC collection operators to RLMResults
-        return translateErrors([&] {
-            auto results = [RLMResults resultsWithObjectInfo:*_objectInfo results:_backingList.as_results()];
-            return [results valueForKeyPath:keyPath];
-        });
-    }
-    return [super valueForKeyPath:keyPath];
-}
-
-- (id)valueForKey:(NSString *)key {
-    // Ideally we'd use "@invalidated" for this so that "invalidated" would use
-    // normal array KVC semantics, but observing @things works very oddly (when
-    // it's part of a key path, it's triggered automatically when array index
-    // changes occur, and can't be sent explicitly, but works normally when it's
-    // the entire key path), and an RLMManagedArray *can't* have objects where
-    // invalidated is true, so we're not losing much.
-    return translateErrors([&]() -> id {
-        if ([key isEqualToString:RLMInvalidatedKey]) {
-            return @(!_backingList.is_valid());
-        }
-
-        _backingList.verify_attached();
-        return RLMCollectionValueForKey(_backingList, key, *_objectInfo);
-    });
-}
-
-- (void)setValue:(id)value forKey:(NSString *)key {
-    if ([key isEqualToString:@"self"]) {
-        RLMArrayValidateMatchingObjectType(self, value);
-        RLMAccessorContext context(*_objectInfo);
-        translateErrors([&] {
-            for (size_t i = 0, count = _backingList.size(); i < count; ++i) {
-                _backingList.set(context, i, value);
-            }
-        });
-        return;
-    }
-    else if (_type == RLMPropertyTypeObject) {
-        RLMArrayValidateMatchingObjectType(self, value);
-        translateErrors([&] { _backingList.verify_in_transaction(); });
-        RLMCollectionSetValueForKey(self, key, value);
-    }
-    else {
-        [self setValue:value forUndefinedKey:key];
-    }
-}
-
-- (realm::ColKey)columnForProperty:(NSString *)propertyName {
-    if (_backingList.get_type() == realm::PropertyType::Object) {
-        return _objectInfo->tableColumn(propertyName);
-    }
-    if (![propertyName isEqualToString:@"self"]) {
-        @throw RLMException(@"Arrays of '%@' can only be aggregated on \"self\"", RLMTypeToString(_type));
-    }
-    return {};
-}
-
-- (id)minOfProperty:(NSString *)property {
-    auto column = [self columnForProperty:property];
-    auto value = translateErrors(self, [&] { return _backingList.min(column); }, @"minOfProperty");
-    return value ? RLMMixedToObjc(*value) : nil;
-}
-
-- (id)maxOfProperty:(NSString *)property {
-    auto column = [self columnForProperty:property];
-    auto value = translateErrors(self, [&] { return _backingList.max(column); }, @"maxOfProperty");
-    return value ? RLMMixedToObjc(*value) : nil;
-}
-
-- (id)sumOfProperty:(NSString *)property {
-    auto column = [self columnForProperty:property];
-    return RLMMixedToObjc(translateErrors(self, [&] { return _backingList.sum(column); }, @"sumOfProperty"));
-}
-
-- (id)averageOfProperty:(NSString *)property {
-    auto column = [self columnForProperty:property];
-    auto value = translateErrors(self, [&] { return _backingList.average(column); }, @"averageOfProperty");
-    return value ? @(*value) : nil;
-}
-
-- (void)deleteObjectsFromRealm {
-    if (_type != RLMPropertyTypeObject) {
-        @throw RLMException(@"Cannot delete objects from RLMArray<%@>: only RLMObjects can be deleted.", RLMTypeToString(_type));
-    }
-    // delete all target rows from the realm
-    RLMTrackDeletions(_realm, ^{
-        translateErrors([&] { _backingList.delete_all(); });
-    });
-}
-
-- (RLMResults *)sortedResultsUsingDescriptors:(NSArray<RLMSortDescriptor *> *)properties {
-    return translateErrors([&] {
-        return [RLMResults resultsWithObjectInfo:*_objectInfo
-                                         results:_backingList.sort(RLMSortDescriptorsToKeypathArray(properties))];
-    });
-}
-
-- (RLMResults *)distinctResultsUsingKeyPaths:(NSArray<NSString *> *)keyPaths {
-    return translateErrors([&] {
-        auto results = [RLMResults resultsWithObjectInfo:*_objectInfo results:_backingList.as_results()];
-        return [results distinctResultsUsingKeyPaths:keyPaths];
-    });
-}
-
-- (RLMResults *)objectsWithPredicate:(NSPredicate *)predicate {
-    if (_type != RLMPropertyTypeObject) {
-        @throw RLMException(@"Querying is currently only implemented for arrays of Realm Objects");
-    }
-    auto query = RLMPredicateToQuery(predicate, _objectInfo->rlmObjectSchema, _realm.schema, _realm.group);
-    auto results = translateErrors([&] { return _backingList.filter(std::move(query)); });
-    return [RLMResults resultsWithObjectInfo:*_objectInfo results:std::move(results)];
-}
-
-- (NSUInteger)indexOfObjectWithPredicate:(NSPredicate *)predicate {
-    if (_type != RLMPropertyTypeObject) {
-        @throw RLMException(@"Querying is currently only implemented for arrays of Realm Objects");
-    }
-    realm::Query query = RLMPredicateToQuery(predicate, _objectInfo->rlmObjectSchema,
-                                             _realm.schema, _realm.group);
-
-    return translateErrors([&] {
-        return RLMConvertNotFound(_backingList.find(std::move(query)));
-    });
-}
-
-- (NSArray *)objectsAtIndexes:(__unused NSIndexSet *)indexes {
-    // FIXME: this is called by KVO when array changes are made. It's not clear
-    // why, and returning nil seems to work fine.
-    return nil;
-}
-
-- (void)addObserver:(id)observer
-         forKeyPath:(NSString *)keyPath
-            options:(NSKeyValueObservingOptions)options
-            context:(void *)context {
-    RLMEnsureArrayObservationInfo(_observationInfo, keyPath, self, self);
-    [super addObserver:observer forKeyPath:keyPath options:options context:context];
-}
-
-- (realm::TableView)tableView {
-    return translateErrors([&] { return _backingList.get_query(); }).find_all();
-}
-
-- (RLMFastEnumerator *)fastEnumerator {
-    return translateErrors([&] {
-        return [[RLMFastEnumerator alloc] initWithList:_backingList collection:self
-                                             classInfo:*_objectInfo];
-    });
-}
-
-- (BOOL)isFrozen {
-    return _realm.isFrozen;
-}
-
-- (instancetype)freeze {
-    if (self.frozen) {
-        return self;
-    }
-
-    RLMRealm *frozenRealm = [_realm freeze];
-    auto& parentInfo = _ownerInfo->freeze(frozenRealm);
-    return translateRLMResultsErrors([&] {
-        return [[self.class alloc] initWithList:_backingList.freeze(frozenRealm->_realm)
-                                     parentInfo:&parentInfo
-                                       property:parentInfo.rlmObjectSchema[_key]];
-    });
-}
-
-// The compiler complains about the method's argument type not matching due to
-// it not having the generic type attached, but it doesn't seem to be possible
-// to actually include the generic type
-// http://www.openradar.me/radar?id=6135653276319744
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wmismatched-parameter-types"
-- (RLMNotificationToken *)addNotificationBlock:(void (^)(RLMArray *, RLMCollectionChange *, NSError *))block {
-    return RLMAddNotificationBlock(self, block, nil);
-}
-- (RLMNotificationToken *)addNotificationBlock:(void (^)(RLMArray *, RLMCollectionChange *, NSError *))block queue:(dispatch_queue_t)queue {
-    return RLMAddNotificationBlock(self, block, queue);
-}
-#pragma clang diagnostic pop
-
-realm::List& RLMGetBackingCollection(RLMManagedArray *self) {
-    return self->_backingList;
-}
-
-#pragma mark - Thread Confined Protocol Conformance
-
-- (realm::ThreadSafeReference)makeThreadSafeReference {
-    return _backingList;
-}
-
-- (RLMManagedArrayHandoverMetadata *)objectiveCMetadata {
-    RLMManagedArrayHandoverMetadata *metadata = [[RLMManagedArrayHandoverMetadata alloc] init];
-    metadata.parentClassName = _ownerInfo->rlmObjectSchema.className;
-    metadata.key = _key;
-    return metadata;
-}
-
-+ (instancetype)objectWithThreadSafeReference:(realm::ThreadSafeReference)reference
-                                     metadata:(RLMManagedArrayHandoverMetadata *)metadata
-                                        realm:(RLMRealm *)realm {
-    auto list = reference.resolve<realm::List>(realm->_realm);
-    if (!list.is_valid()) {
-        return nil;
-    }
-    RLMClassInfo *parentInfo = &realm->_info[metadata.parentClassName];
-    return [[RLMManagedArray alloc] initWithList:std::move(list)
-                                       parentInfo:parentInfo
-                                         property:parentInfo->rlmObjectSchema[metadata.key]];
-}
-
-@end

+ 0 - 127
Carthage/Checkouts/realm-cocoa/Realm/RLMMigration.h

@@ -1,127 +0,0 @@
-////////////////////////////////////////////////////////////////////////////
-//
-// Copyright 2014 Realm Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////
-
-#import <Foundation/Foundation.h>
-
-NS_ASSUME_NONNULL_BEGIN
-
-@class RLMSchema;
-@class RLMArray;
-@class RLMObject;
-
-/**
- A block type which provides both the old and new versions of an object in the Realm. Object
- properties can only be accessed using keyed subscripting.
-
- @see `-[RLMMigration enumerateObjects:block:]`
-
- @param oldObject The object from the original Realm (read-only).
- @param newObject The object from the migrated Realm (read-write).
-*/
-typedef void (^RLMObjectMigrationBlock)(RLMObject * __nullable oldObject, RLMObject * __nullable newObject);
-
-/**
- `RLMMigration` instances encapsulate information intended to facilitate a schema migration.
-
- A `RLMMigration` instance is passed into a user-defined `RLMMigrationBlock` block when updating
- the version of a Realm. This instance provides access to the old and new database schemas, the
- objects in the Realm, and provides functionality for modifying the Realm during the migration.
- */
-@interface RLMMigration : NSObject
-
-#pragma mark - Properties
-
-/**
- Returns the old `RLMSchema`. This is the schema which describes the Realm before the
- migration is applied.
- */
-@property (nonatomic, readonly) RLMSchema *oldSchema;
-
-/**
- Returns the new `RLMSchema`. This is the schema which describes the Realm after the
- migration is applied.
- */
-@property (nonatomic, readonly) RLMSchema *newSchema;
-
-
-#pragma mark - Altering Objects during a Migration
-
-/**
- Enumerates all the objects of a given type in the Realm, providing both the old and new versions
- of each object. Within the block, object properties can only be accessed using keyed subscripting.
-
- @param className   The name of the `RLMObject` class to enumerate.
-
- @warning   All objects returned are of a type specific to the current migration and should not be cast
-            to `className`. Instead, treat them as `RLMObject`s and use keyed subscripting to access
-            properties.
- */
-- (void)enumerateObjects:(NSString *)className block:(__attribute__((noescape)) RLMObjectMigrationBlock)block;
-
-/**
- Creates and returns an `RLMObject` instance of type `className` in the Realm being migrated.
-
- The `value` argument is used to populate the object. It can be a key-value coding compliant object, an array or
- dictionary returned from the methods in `NSJSONSerialization`, or an array containing one element for each managed
- property. An exception will be thrown if any required properties are not present and those properties were not defined
- with default values.
-
- When passing in an `NSArray` as the `value` argument, all properties must be present, valid and in the same order as
- the properties defined in the model.
-
- @param className   The name of the `RLMObject` class to create.
- @param value       The value used to populate the object.
- */
-- (RLMObject *)createObject:(NSString *)className withValue:(id)value;
-
-/**
- Deletes an object from a Realm during a migration.
-
- It is permitted to call this method from within the block passed to `-[enumerateObjects:block:]`.
-
- @param object  Object to be deleted from the Realm being migrated.
- */
-- (void)deleteObject:(RLMObject *)object;
-
-/**
- Deletes the data for the class with the given name.
-
- All objects of the given class will be deleted. If the `RLMObject` subclass no longer exists in your program,
- any remaining metadata for the class will be removed from the Realm file.
-
- @param  name The name of the `RLMObject` class to delete.
-
- @return A Boolean value indicating whether there was any data to delete.
- */
-- (BOOL)deleteDataForClassName:(NSString *)name;
-
-/**
- Renames a property of the given class from `oldName` to `newName`.
-
- @param className The name of the class whose property should be renamed. This class must be present
-                  in both the old and new Realm schemas.
- @param oldName   The old name for the property to be renamed. There must not be a property with this name in the
-                  class as defined by the new Realm schema.
- @param newName   The new name for the property to be renamed. There must not be a property with this name in the
-                  class as defined by the old Realm schema.
- */
-- (void)renamePropertyForClass:(NSString *)className oldName:(NSString *)oldName newName:(NSString *)newName;
-
-@end
-
-NS_ASSUME_NONNULL_END

+ 0 - 170
Carthage/Checkouts/realm-cocoa/Realm/RLMMigration.mm

@@ -1,170 +0,0 @@
-////////////////////////////////////////////////////////////////////////////
-//
-// Copyright 2014 Realm Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////
-
-#import "RLMMigration_Private.h"
-
-#import "RLMAccessor.h"
-#import "RLMObject_Private.h"
-#import "RLMObject_Private.hpp"
-#import "RLMObjectSchema_Private.hpp"
-#import "RLMObjectStore.h"
-#import "RLMProperty_Private.h"
-#import "RLMRealm_Dynamic.h"
-#import "RLMRealm_Private.hpp"
-#import "RLMResults_Private.hpp"
-#import "RLMSchema_Private.hpp"
-#import "RLMUtil.hpp"
-
-#import "object_store.hpp"
-#import "shared_realm.hpp"
-#import "schema.hpp"
-
-#import <realm/table.hpp>
-
-using namespace realm;
-
-// The source realm for a migration has to use a SharedGroup to be able to share
-// the file with the destination realm, but we don't want to let the user call
-// beginWriteTransaction on it as that would make no sense.
-@interface RLMMigrationRealm : RLMRealm
-@end
-
-@implementation RLMMigrationRealm
-- (BOOL)readonly {
-    return YES;
-}
-
-- (void)beginWriteTransaction {
-    @throw RLMException(@"Cannot modify the source Realm in a migration");
-}
-@end
-
-@implementation RLMMigration {
-    realm::Schema *_schema;
-}
-
-- (instancetype)initWithRealm:(RLMRealm *)realm oldRealm:(RLMRealm *)oldRealm schema:(realm::Schema &)schema {
-    self = [super init];
-    if (self) {
-        _realm = realm;
-        _oldRealm = oldRealm;
-        _schema = &schema;
-        object_setClass(_oldRealm, RLMMigrationRealm.class);
-    }
-    return self;
-}
-
-- (RLMSchema *)oldSchema {
-    return self.oldRealm.schema;
-}
-
-- (RLMSchema *)newSchema {
-    return self.realm.schema;
-}
-
-- (void)enumerateObjects:(NSString *)className block:(__attribute__((noescape)) RLMObjectMigrationBlock)block {
-    RLMResults *objects = [_realm.schema schemaForClassName:className] ? [_realm allObjects:className] : nil;
-    RLMResults *oldObjects = [_oldRealm.schema schemaForClassName:className] ? [_oldRealm allObjects:className] : nil;
-
-    // For whatever reason if this is a newly added table we enumerate the
-    // objects in it, while in all other cases we enumerate only the existing
-    // objects. It's unclear how this could be useful, but changing it would
-    // also be a pointless breaking change and it's unlikely to be hurting anyone.
-    if (objects && !oldObjects) {
-        for (RLMObject *object in objects) {
-            @autoreleasepool {
-                block(nil, object);
-            }
-        }
-        return;
-    }
-
-    if (oldObjects.count == 0 || objects.count == 0) {
-        return;
-    }
-
-    auto& info = _realm->_info[className];
-    for (RLMObject *oldObject in oldObjects) {
-        @autoreleasepool {
-            Obj newObj;
-            try {
-                newObj = info.table()->get_object(oldObject->_row.get_key());
-            }
-            catch (InvalidKey const&) {
-                continue;
-            }
-            block(oldObject, (id)RLMCreateObjectAccessor(info, std::move(newObj)));
-        }
-    }
-}
-
-- (void)execute:(RLMMigrationBlock)block {
-    @autoreleasepool {
-        // disable all primary keys for migration and use DynamicObject for all types
-        for (RLMObjectSchema *objectSchema in _realm.schema.objectSchema) {
-            objectSchema.accessorClass = RLMDynamicObject.class;
-            objectSchema.primaryKeyProperty.isPrimary = NO;
-        }
-        for (RLMObjectSchema *objectSchema in _oldRealm.schema.objectSchema) {
-            objectSchema.accessorClass = RLMDynamicObject.class;
-        }
-
-        block(self, _oldRealm->_realm->schema_version());
-
-        _oldRealm = nil;
-        _realm = nil;
-    }
-}
-
-- (RLMObject *)createObject:(NSString *)className withValue:(id)value {
-    return [_realm createObject:className withValue:value];
-}
-
-- (RLMObject *)createObject:(NSString *)className withObject:(id)object {
-    return [self createObject:className withValue:object];
-}
-
-- (void)deleteObject:(RLMObject *)object {
-    [_realm deleteObject:object];
-}
-
-- (BOOL)deleteDataForClassName:(NSString *)name {
-    if (!name) {
-        return false;
-    }
-
-    TableRef table = ObjectStore::table_for_object_type(_realm.group, name.UTF8String);
-    if (!table) {
-        return false;
-    }
-    if ([_realm.schema schemaForClassName:name]) {
-        table->clear();
-    }
-    else {
-        _realm.group.remove_table(table->get_key());
-    }
-
-    return true;
-}
-
-- (void)renamePropertyForClass:(NSString *)className oldName:(NSString *)oldName newName:(NSString *)newName {
-    realm::ObjectStore::rename_property(_realm.group, *_schema, className.UTF8String,
-                                        oldName.UTF8String, newName.UTF8String);
-}
-
-@end

+ 0 - 40
Carthage/Checkouts/realm-cocoa/Realm/RLMMigration_Private.h

@@ -1,40 +0,0 @@
-////////////////////////////////////////////////////////////////////////////
-//
-// Copyright 2014 Realm Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////
-
-#import <Realm/RLMMigration.h>
-#import <Realm/RLMObjectBase.h>
-#import <Realm/RLMRealm.h>
-
-namespace realm {
-    class Schema;
-}
-
-NS_ASSUME_NONNULL_BEGIN
-
-@interface RLMMigration ()
-
-@property (nonatomic, strong) RLMRealm *oldRealm;
-@property (nonatomic, strong) RLMRealm *realm;
-
-- (instancetype)initWithRealm:(RLMRealm *)realm oldRealm:(RLMRealm *)oldRealm schema:(realm::Schema &)schema;
-
-- (void)execute:(RLMMigrationBlock)block;
-
-@end
-
-NS_ASSUME_NONNULL_END

+ 0 - 65
Carthage/Checkouts/realm-cocoa/Realm/RLMNetworkClient.h

@@ -1,65 +0,0 @@
-////////////////////////////////////////////////////////////////////////////
-//
-// Copyright 2016 Realm Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////
-
-#import <Foundation/Foundation.h>
-
-#import "RLMSyncUtil_Private.h"
-
-NS_ASSUME_NONNULL_BEGIN
-
-@interface RLMNetworkRequestOptions : NSObject
-@property (nonatomic, copy, nullable) NSString *authorizationHeaderName;
-@property (nonatomic, copy, nullable) NSDictionary<NSString *, NSString *> *customHeaders;
-@property (nullable, nonatomic, copy) NSDictionary<NSString *, NSURL *> *pinnedCertificatePaths;
-@end
-
-/// An abstract class representing a server endpoint.
-@interface RLMSyncServerEndpoint : NSObject RLM_SYNC_UNINITIALIZABLE
-+ (void)sendRequestToServer:(NSURL *)serverURL
-                       JSON:(NSDictionary *)jsonDictionary
-                 completion:(void (^)(NSError *))completionBlock;
-
-+ (void)sendRequestToServer:(NSURL *)serverURL
-                       JSON:(NSDictionary *)jsonDictionary
-                    timeout:(NSTimeInterval)timeout
-                 completion:(void (^)(NSError *, NSDictionary *))completionBlock;
-@end
-
-@interface RLMSyncAuthEndpoint : RLMSyncServerEndpoint RLM_SYNC_UNINITIALIZABLE
-@end
-@interface RLMSyncChangePasswordEndpoint : RLMSyncServerEndpoint RLM_SYNC_UNINITIALIZABLE
-@end
-@interface RLMSyncUpdateAccountEndpoint : RLMSyncServerEndpoint RLM_SYNC_UNINITIALIZABLE
-@end
-@interface RLMSyncGetUserInfoEndpoint : RLMSyncServerEndpoint RLM_SYNC_UNINITIALIZABLE
-@end
-
-@interface RLMSyncGetPermissionsEndpoint : RLMSyncServerEndpoint RLM_SYNC_UNINITIALIZABLE
-@end
-@interface RLMSyncGetPermissionOffersEndpoint : RLMSyncServerEndpoint RLM_SYNC_UNINITIALIZABLE
-@end
-@interface RLMSyncApplyPermissionsEndpoint : RLMSyncServerEndpoint RLM_SYNC_UNINITIALIZABLE
-@end
-@interface RLMSyncOfferPermissionsEndpoint : RLMSyncServerEndpoint RLM_SYNC_UNINITIALIZABLE
-@end
-@interface RLMSyncAcceptPermissionOfferEndpoint : RLMSyncServerEndpoint RLM_SYNC_UNINITIALIZABLE
-@end
-@interface RLMSyncInvalidatePermissionOfferEndpoint : RLMSyncServerEndpoint RLM_SYNC_UNINITIALIZABLE
-@end
-
-NS_ASSUME_NONNULL_END

+ 0 - 449
Carthage/Checkouts/realm-cocoa/Realm/RLMNetworkClient.mm

@@ -1,449 +0,0 @@
-////////////////////////////////////////////////////////////////////////////
-//
-// Copyright 2016 Realm Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////
-
-#import "RLMNetworkClient.h"
-
-#import "RLMRealmConfiguration.h"
-#import "RLMJSONModels.h"
-#import "RLMSyncUtil_Private.hpp"
-#import "RLMSyncManager_Private.h"
-#import "RLMUtil.hpp"
-
-#import <realm/util/scope_exit.hpp>
-
-typedef void(^RLMServerURLSessionCompletionBlock)(NSData *, NSURLResponse *, NSError *);
-
-static NSUInteger const kHTTPCodeRange = 100;
-
-typedef enum : NSUInteger {
-    Informational       = 1, // 1XX
-    Success             = 2, // 2XX
-    Redirection         = 3, // 3XX
-    ClientError         = 4, // 4XX
-    ServerError         = 5, // 5XX
-} RLMServerHTTPErrorCodeType;
-
-static NSRange rangeForErrorType(RLMServerHTTPErrorCodeType type) {
-    return NSMakeRange(type*100, kHTTPCodeRange);
-}
-
-#pragma mark Network client
-
-@interface RLMSessionDelegate <NSURLSessionDelegate> : NSObject
-+ (instancetype)delegateWithCertificatePaths:(NSDictionary *)paths
-                                  completion:(void (^)(NSError *, NSDictionary *))completion;
-@end
-
-@interface RLMSyncServerEndpoint ()
-/// The HTTP method the endpoint expects. Defaults to POST.
-+ (NSString *)httpMethod;
-
-/// The URL to which the request should be made. Must be implemented.
-+ (NSURL *)urlForAuthServer:(NSURL *)authServerURL payload:(NSDictionary *)json;
-
-/// The body for the request, if any.
-+ (NSData *)httpBodyForPayload:(NSDictionary *)json error:(NSError **)error;
-
-/// The HTTP headers to be added to the request, if any.
-+ (NSDictionary<NSString *, NSString *> *)httpHeadersForPayload:(NSDictionary *)json
-                                                        options:(nullable RLMNetworkRequestOptions *)options;
-@end
-
-@implementation RLMSyncServerEndpoint
-
-+ (void)sendRequestToServer:(NSURL *)serverURL
-                       JSON:(NSDictionary *)jsonDictionary
-                 completion:(void (^)(NSError *))completionBlock {
-    [self sendRequestToServer:serverURL JSON:jsonDictionary timeout:0
-                   completion:^(NSError *error, NSDictionary *) {
-        completionBlock(error);
-    }];
-}
-+ (void)sendRequestToServer:(NSURL *)serverURL
-                       JSON:(NSDictionary *)jsonDictionary
-                    timeout:(NSTimeInterval)timeout
-                 completion:(void (^)(NSError *, NSDictionary *))completionBlock {
-    // If the timeout isn't set then use the timeout set on the sync manager,
-    // or 60 seconds if it isn't set there either.
-    RLMSyncManager *syncManager = RLMSyncManager.sharedManager;
-    if (timeout < 1)
-        timeout = syncManager.timeoutOptions.connectTimeout / 1000.0;
-    if (timeout < 1)
-        timeout = 60.0;
-
-    // Create the request
-    NSError *localError = nil;
-    NSURL *requestURL = [self urlForAuthServer:serverURL payload:jsonDictionary];
-    NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:requestURL];
-    request.HTTPMethod = [self httpMethod];
-    if (![request.HTTPMethod isEqualToString:@"GET"]) {
-        request.HTTPBody = [self httpBodyForPayload:jsonDictionary error:&localError];
-        if (localError) {
-            completionBlock(localError, nil);
-            return;
-        }
-    }
-    request.timeoutInterval = timeout;
-    RLMNetworkRequestOptions *options = syncManager.networkRequestOptions;
-    NSDictionary<NSString *, NSString *> *headers = [self httpHeadersForPayload:jsonDictionary options:options];
-    for (NSString *key in headers) {
-        [request addValue:headers[key] forHTTPHeaderField:key];
-    }
-    id delegate = [RLMSessionDelegate delegateWithCertificatePaths:options.pinnedCertificatePaths
-                                                        completion:completionBlock];
-    auto session = [NSURLSession sessionWithConfiguration:NSURLSessionConfiguration.defaultSessionConfiguration
-                                                 delegate:delegate delegateQueue:nil];
-
-    // Add the request to a task and start it
-    [[session dataTaskWithRequest:request] resume];
-    // Tell the session to destroy itself once it's done with the request
-    [session finishTasksAndInvalidate];
-}
-
-+ (NSString *)httpMethod {
-    return @"POST";
-}
-
-+ (NSURL *)urlForAuthServer:(__unused NSURL *)authServerURL payload:(__unused NSDictionary *)json {
-    NSAssert(NO, @"This method must be overriden by concrete subclasses.");
-    return nil;
-}
-
-+ (NSData *)httpBodyForPayload:(NSDictionary *)json error:(NSError **)error {
-    NSError *localError = nil;
-    NSData *jsonData = [NSJSONSerialization dataWithJSONObject:json
-                                                       options:(NSJSONWritingOptions)0
-                                                         error:&localError];
-    if (jsonData && !localError) {
-        return jsonData;
-    }
-    NSAssert(localError, @"If there isn't a converted data object there must be an error.");
-    if (error) {
-        *error = localError;
-    }
-    return nil;
-}
-
-+ (NSDictionary<NSString *, NSString *> *)httpHeadersForPayload:(NSDictionary *)json
-                                                        options:(nullable RLMNetworkRequestOptions *)options {
-    NSMutableDictionary<NSString *, NSString *> *headers = [[NSMutableDictionary alloc] init];
-    headers[@"Content-Type"] = @"application/json;charset=utf-8";
-    headers[@"Accept"] = @"application/json";
-
-    if (NSDictionary<NSString *, NSString *> *customHeaders = options.customHeaders) {
-        [headers addEntriesFromDictionary:customHeaders];
-    }
-    if (NSString *authToken = [json objectForKey:kRLMSyncTokenKey]) {
-        headers[options.authorizationHeaderName ?: @"Authorization"] = authToken;
-    }
-
-    return headers;
-}
-@end
-
-@implementation RLMSessionDelegate {
-    NSDictionary<NSString *, NSURL *> *_certificatePaths;
-    NSData *_data;
-    void (^_completionBlock)(NSError *, NSDictionary *);
-}
-
-+ (instancetype)delegateWithCertificatePaths:(NSDictionary *)paths
-                                  completion:(void (^)(NSError *, NSDictionary *))completion {
-    RLMSessionDelegate *delegate = [RLMSessionDelegate new];
-    delegate->_certificatePaths = paths;
-    delegate->_completionBlock = completion;
-    return delegate;
-}
-
-- (void)URLSession:(__unused NSURLSession *)session didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge
- completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential *credential))completionHandler {
-    auto protectionSpace = challenge.protectionSpace;
-
-    // Just fall back to the default logic for HTTP basic auth
-    if (protectionSpace.authenticationMethod != NSURLAuthenticationMethodServerTrust || !protectionSpace.serverTrust) {
-        completionHandler(NSURLSessionAuthChallengePerformDefaultHandling, nil);
-        return;
-    }
-
-    // If we have a pinned certificate for this hostname, we want to validate
-    // against that, and otherwise just do the default thing
-    auto certPath = _certificatePaths[protectionSpace.host];
-    if (!certPath) {
-        completionHandler(NSURLSessionAuthChallengePerformDefaultHandling, nil);
-        return;
-    }
-    if ([certPath isKindOfClass:[NSString class]]) {
-        certPath = [NSURL fileURLWithPath:(id)certPath];
-    }
-
-
-    // Reject the server auth and report an error if any errors occur along the way
-    CFArrayRef items = nil;
-    NSError *error;
-    auto reportStatus = realm::util::make_scope_exit([&]() noexcept {
-        if (items) {
-            CFRelease(items);
-        }
-        if (error) {
-            _completionBlock(error, nil);
-            // Don't also report errors about the connection itself failing later
-            _completionBlock = ^(NSError *, id) { };
-            completionHandler(NSURLSessionAuthChallengeRejectProtectionSpace, nil);
-        }
-    });
-
-    NSData *data = [NSData dataWithContentsOfURL:certPath options:0 error:&error];
-    if (!data) {
-        return;
-    }
-
-    // Load our pinned certificate and add it to the anchor set
-#if TARGET_OS_IPHONE
-    id certificate = (__bridge_transfer id)SecCertificateCreateWithData(NULL, (__bridge CFDataRef)data);
-    if (!certificate) {
-        error = [NSError errorWithDomain:NSOSStatusErrorDomain code:errSecUnknownFormat userInfo:nil];
-        return;
-    }
-    items = (CFArrayRef)CFBridgingRetain(@[certificate]);
-#else
-    SecItemImportExportKeyParameters params{
-        .version = SEC_KEY_IMPORT_EXPORT_PARAMS_VERSION
-    };
-    if (OSStatus status = SecItemImport((__bridge CFDataRef)data, (__bridge CFStringRef)certPath.absoluteString,
-                                        nullptr, nullptr, 0, &params, nullptr, &items)) {
-        error = [NSError errorWithDomain:NSOSStatusErrorDomain code:status userInfo:nil];
-        return;
-    }
-#endif
-    SecTrustRef serverTrust = protectionSpace.serverTrust;
-    if (OSStatus status = SecTrustSetAnchorCertificates(serverTrust, items)) {
-        error = [NSError errorWithDomain:NSOSStatusErrorDomain code:status userInfo:nil];
-        return;
-    }
-
-    // Only use our certificate and not the ones from the default CA roots
-    if (OSStatus status = SecTrustSetAnchorCertificatesOnly(serverTrust, true)) {
-        error = [NSError errorWithDomain:NSOSStatusErrorDomain code:status userInfo:nil];
-        return;
-    }
-
-    // Verify that our pinned certificate is valid for this connection
-    SecTrustResultType trustResult;
-    if (OSStatus status = SecTrustEvaluate(serverTrust, &trustResult)) {
-        error = [NSError errorWithDomain:NSOSStatusErrorDomain code:status userInfo:nil];
-        return;
-    }
-    if (trustResult != kSecTrustResultProceed && trustResult != kSecTrustResultUnspecified) {
-        completionHandler(NSURLSessionAuthChallengeRejectProtectionSpace, nil);
-        return;
-    }
-
-    completionHandler(NSURLSessionAuthChallengeUseCredential,
-                      [NSURLCredential credentialForTrust:protectionSpace.serverTrust]);
-}
-
-- (void)URLSession:(__unused NSURLSession *)session
-          dataTask:(__unused NSURLSessionDataTask *)dataTask
-    didReceiveData:(NSData *)data {
-    if (!_data) {
-        _data = data;
-        return;
-    }
-    if (![_data respondsToSelector:@selector(appendData:)]) {
-        _data = [_data mutableCopy];
-    }
-    [(id)_data appendData:data];
-}
-
-- (void)URLSession:(__unused NSURLSession *)session
-              task:(NSURLSessionTask *)task
-didCompleteWithError:(NSError *)error
-{
-    if (error) {
-        _completionBlock(error, nil);
-        return;
-    }
-
-    if (NSError *error = [self validateResponse:task.response data:_data]) {
-        _completionBlock(error, nil);
-        return;
-    }
-
-    id json = [NSJSONSerialization JSONObjectWithData:_data
-                                              options:(NSJSONReadingOptions)0
-                                                error:&error];
-    if (!json) {
-        _completionBlock(error, nil);
-        return;
-    }
-    if (![json isKindOfClass:[NSDictionary class]]) {
-        _completionBlock(make_auth_error_bad_response(json), nil);
-        return;
-    }
-
-    _completionBlock(nil, (NSDictionary *)json);
-}
-
-- (NSError *)validateResponse:(NSURLResponse *)response data:(NSData *)data {
-    if (![response isKindOfClass:[NSHTTPURLResponse class]]) {
-        // FIXME: Provide error message
-        return make_auth_error_bad_response();
-    }
-
-    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)response;
-    BOOL badResponse = (NSLocationInRange(httpResponse.statusCode, rangeForErrorType(ClientError))
-                        || NSLocationInRange(httpResponse.statusCode, rangeForErrorType(ServerError)));
-    if (badResponse) {
-        if (RLMSyncErrorResponseModel *responseModel = [self responseModelFromData:data]) {
-            switch (responseModel.code) {
-                case RLMSyncAuthErrorInvalidParameters:
-                case RLMSyncAuthErrorMissingPath:
-                case RLMSyncAuthErrorInvalidCredential:
-                case RLMSyncAuthErrorUserDoesNotExist:
-                case RLMSyncAuthErrorUserAlreadyExists:
-                case RLMSyncAuthErrorAccessDeniedOrInvalidPath:
-                case RLMSyncAuthErrorInvalidAccessToken:
-                case RLMSyncAuthErrorExpiredPermissionOffer:
-                case RLMSyncAuthErrorAmbiguousPermissionOffer:
-                case RLMSyncAuthErrorFileCannotBeShared:
-                    return make_auth_error(responseModel);
-                default:
-                    // Right now we assume that any codes not described
-                    // above are generic HTTP error codes.
-                    return make_auth_error_http_status(responseModel.status);
-            }
-        }
-        return make_auth_error_http_status(httpResponse.statusCode);
-    }
-
-    if (!data) {
-        // FIXME: provide error message
-        return make_auth_error_bad_response();
-    }
-
-    return nil;
-}
-
-- (RLMSyncErrorResponseModel *)responseModelFromData:(NSData *)data {
-    if (data.length == 0) {
-        return nil;
-    }
-    id json = [NSJSONSerialization JSONObjectWithData:data
-                                              options:(NSJSONReadingOptions)0
-                                                error:nil];
-    if (!json || ![json isKindOfClass:[NSDictionary class]]) {
-        return nil;
-    }
-    return [[RLMSyncErrorResponseModel alloc] initWithDictionary:json];
-}
-
-@end
-
-@implementation RLMNetworkRequestOptions
-@end
-
-#pragma mark - Endpoint Implementations
-
-@implementation RLMSyncAuthEndpoint
-+ (NSURL *)urlForAuthServer:(NSURL *)authServerURL payload:(__unused NSDictionary *)json {
-    return [authServerURL URLByAppendingPathComponent:@"auth"];
-}
-@end
-
-@implementation RLMSyncChangePasswordEndpoint
-+ (NSString *)httpMethod {
-    return @"PUT";
-}
-
-+ (NSURL *)urlForAuthServer:(NSURL *)authServerURL payload:(__unused NSDictionary *)json {
-    return [authServerURL URLByAppendingPathComponent:@"auth/password"];
-}
-@end
-
-@implementation RLMSyncUpdateAccountEndpoint
-+ (NSURL *)urlForAuthServer:(NSURL *)authServerURL payload:(__unused NSDictionary *)json {
-    return [authServerURL URLByAppendingPathComponent:@"auth/password/updateAccount"];
-}
-@end
-
-@implementation RLMSyncGetUserInfoEndpoint
-+ (NSString *)httpMethod {
-    return @"GET";
-}
-
-+ (NSURL *)urlForAuthServer:(NSURL *)authServerURL payload:(NSDictionary *)json {
-    NSString *provider = json[kRLMSyncProviderKey];
-    NSString *providerID = json[kRLMSyncProviderIDKey];
-    NSAssert([provider isKindOfClass:[NSString class]] && [providerID isKindOfClass:[NSString class]],
-             @"malformed request; this indicates a logic error in the binding.");
-    NSCharacterSet *allowed = [NSCharacterSet URLQueryAllowedCharacterSet];
-    NSString *pathComponent = [NSString stringWithFormat:@"auth/users/%@/%@",
-                               [provider stringByAddingPercentEncodingWithAllowedCharacters:allowed],
-                               [providerID stringByAddingPercentEncodingWithAllowedCharacters:allowed]];
-    return [authServerURL URLByAppendingPathComponent:pathComponent];
-}
-
-+ (NSData *)httpBodyForPayload:(__unused NSDictionary *)json error:(__unused NSError **)error {
-    return nil;
-}
-@end
-
-@implementation RLMSyncGetPermissionsEndpoint
-+ (NSString *)httpMethod {
-    return @"GET";
-}
-+ (NSURL *)urlForAuthServer:(NSURL *)authServerURL payload:(__unused NSDictionary *)json {
-    return [authServerURL URLByAppendingPathComponent:@"permissions"];
-}
-@end
-
-@implementation RLMSyncGetPermissionOffersEndpoint
-+ (NSString *)httpMethod {
-    return @"GET";
-}
-+ (NSURL *)urlForAuthServer:(NSURL *)authServerURL payload:(__unused NSDictionary *)json {
-    return [authServerURL URLByAppendingPathComponent:@"permissions/offers"];
-}
-@end
-
-@implementation RLMSyncApplyPermissionsEndpoint
-+ (NSURL *)urlForAuthServer:(NSURL *)authServerURL payload:(__unused NSDictionary *)json {
-    return [authServerURL URLByAppendingPathComponent:@"permissions/apply"];
-}
-@end
-
-@implementation RLMSyncOfferPermissionsEndpoint
-+ (NSURL *)urlForAuthServer:(NSURL *)authServerURL payload:(__unused NSDictionary *)json {
-    return [authServerURL URLByAppendingPathComponent:@"permissions/offers"];
-}
-@end
-
-@implementation RLMSyncAcceptPermissionOfferEndpoint
-+ (NSURL *)urlForAuthServer:(NSURL *)authServerURL payload:(NSDictionary *)json {
-    return [authServerURL URLByAppendingPathComponent:[NSString stringWithFormat:@"permissions/offers/%@/accept", json[@"offerToken"]]];
-}
-@end
-
-@implementation RLMSyncInvalidatePermissionOfferEndpoint
-+ (NSString *)httpMethod {
-    return @"DELETE";
-}
-+ (NSURL *)urlForAuthServer:(NSURL *)authServerURL payload:(NSDictionary *)json {
-    return [authServerURL URLByAppendingPathComponent:[NSString stringWithFormat:@"permissions/offers/%@", json[@"offerToken"]]];
-}
-@end

+ 0 - 712
Carthage/Checkouts/realm-cocoa/Realm/RLMObject.h

@@ -1,712 +0,0 @@
-////////////////////////////////////////////////////////////////////////////
-//
-// Copyright 2014 Realm Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////
-
-#import <Foundation/Foundation.h>
-
-#import <Realm/RLMObjectBase.h>
-#import <Realm/RLMThreadSafeReference.h>
-
-NS_ASSUME_NONNULL_BEGIN
-
-@class RLMNotificationToken;
-@class RLMObjectSchema;
-@class RLMPropertyChange;
-@class RLMPropertyDescriptor;
-@class RLMRealm;
-@class RLMResults<RLMObjectType>;
-
-/**
- `RLMObject` is a base class for model objects representing data stored in Realms.
-
- Define your model classes by subclassing `RLMObject` and adding properties to be managed.
- Then instantiate and use your custom subclasses instead of using the `RLMObject` class directly.
-
-     // Dog.h
-     @interface Dog : RLMObject
-     @property NSString *name;
-     @property BOOL      adopted;
-     @end
-
-     // Dog.m
-     @implementation Dog
-     @end //none needed
-
- ### Supported property types
-
- - `NSString`
- - `NSInteger`, `int`, `long`, `float`, and `double`
- - `BOOL` or `bool`
- - `NSDate`
- - `NSData`
- - `NSNumber<X>`, where `X` is one of `RLMInt`, `RLMFloat`, `RLMDouble` or `RLMBool`, for optional number properties
- - `RLMObject` subclasses, to model many-to-one relationships.
- - `RLMArray<X>`, where `X` is an `RLMObject` subclass, to model many-to-many relationships.
-
- ### Querying
-
- You can initiate queries directly via the class methods: `allObjects`, `objectsWhere:`, and `objectsWithPredicate:`.
- These methods allow you to easily query a custom subclass for instances of that class in the default Realm.
-
- To search in a Realm other than the default Realm, use the `allObjectsInRealm:`, `objectsInRealm:where:`,
- and `objectsInRealm:withPredicate:` class methods.
-
- @see `RLMRealm`
-
- ### Relationships
-
- See our [Cocoa guide](https://realm.io/docs/objc/latest#relationships) for more details.
-
- ### Key-Value Observing
-
- All `RLMObject` properties (including properties you create in subclasses) are
- [Key-Value Observing compliant](https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/KeyValueObserving/KeyValueObserving.html),
- except for `realm` and `objectSchema`.
-
- Keep the following tips in mind when observing Realm objects:
-
- 1. Unlike `NSMutableArray` properties, `RLMArray` properties do not require
-    using the proxy object returned from `-mutableArrayValueForKey:`, or defining
-    KVC mutation methods on the containing class. You can simply call methods on
-    the `RLMArray` directly; any changes will be automatically observed by the containing
-    object.
- 2. Unmanaged `RLMObject` instances cannot be added to a Realm while they have any
-    observed properties.
- 3. Modifying managed `RLMObject`s within `-observeValueForKeyPath:ofObject:change:context:`
-    is not recommended. Properties may change even when the Realm is not in a write
-    transaction (for example, when `-[RLMRealm refresh]` is called after changes
-    are made on a different thread), and notifications sent prior to the change
-    being applied (when `NSKeyValueObservingOptionPrior` is used) may be sent at
-    times when you *cannot* begin a write transaction.
- */
-
-@interface RLMObject : RLMObjectBase <RLMThreadConfined>
-
-#pragma mark - Creating & Initializing Objects
-
-/**
- Creates an unmanaged instance of a Realm object.
-
- Call `addObject:` on an `RLMRealm` instance to add an unmanaged object into that Realm.
-
- @see `[RLMRealm addObject:]`
- */
-- (instancetype)init NS_DESIGNATED_INITIALIZER;
-
-
-/**
- Creates an unmanaged instance of a Realm object.
-
- Pass in an `NSArray` or `NSDictionary` instance to set the values of the object's properties.
-
- Call `addObject:` on an `RLMRealm` instance to add an unmanaged object into that Realm.
-
- @see `[RLMRealm addObject:]`
- */
-- (instancetype)initWithValue:(id)value;
-
-
-/**
- Returns the class name for a Realm object subclass.
-
- @warning Do not override. Realm relies on this method returning the exact class
-          name.
-
- @return  The class name for the model class.
- */
-+ (NSString *)className;
-
-/**
- Creates an instance of a Realm object with a given value, and adds it to the default Realm.
-
- If nested objects are included in the argument, `createInDefaultRealmWithValue:` will be recursively called
- on them.
-
- The `value` argument can be a key-value coding compliant object, an array or dictionary returned from the methods in
- `NSJSONSerialization`, or an array containing one element for each managed property.
-
- An exception will be thrown if any required properties are not present and those properties
- were not defined with default values.
-
- If the `value` argument is an array, all properties must be present, valid and in the same
- order as the properties defined in the model.
-
- @param value    The value used to populate the object.
-
- @see   `defaultPropertyValues`
- */
-+ (instancetype)createInDefaultRealmWithValue:(id)value;
-
-/**
- Creates an instance of a Realm object with a given value, and adds it to the specified Realm.
-
- If nested objects are included in the argument, `createInRealm:withValue:` will be recursively called
- on them.
-
- The `value` argument can be a key-value coding compliant object, an array or dictionary returned from the methods in
- `NSJSONSerialization`, or an array containing one element for each managed property.
-
- An exception will be thrown if any required properties are not present and those properties
- were not defined with default values.
-
- If the `value` argument is an array, all properties must be present, valid and in the same
- order as the properties defined in the model.
-
- @param realm    The Realm which should manage the newly-created object.
- @param value    The value used to populate the object.
-
- @see   `defaultPropertyValues`
- */
-+ (instancetype)createInRealm:(RLMRealm *)realm withValue:(id)value;
-
-/**
- Creates or updates a Realm object within the default Realm.
-
- This method may only be called on Realm object types with a primary key defined. If there is already
- an object with the same primary key value in the default Realm, its values are updated and the object
- is returned. Otherwise, this method creates and populates a new instance of the object in the default Realm.
-
- If nested objects are included in the argument, `createOrUpdateInDefaultRealmWithValue:` will be
- recursively called on them if they have primary keys, `createInDefaultRealmWithValue:` if they do not.
-
- The `value` argument is used to populate the object. It can be a Realm object, a key-value coding
- compliant object, an array or dictionary returned from the methods in `NSJSONSerialization`, or an
- array containing one element for each managed property.
-
- If the object is being created, an exception will be thrown if any required properties
- are not present and those properties were not defined with default values.
-
- If the `value` argument is a Realm object already managed by the default Realm, the
- argument's type is the same as the receiver, and the objects have identical values for
- their managed properties, this method does nothing.
-
- If the object is being updated, each property defined in its schema will be set by copying from
- `value` using key-value coding. If the `value` argument does not respond to `valueForKey:` for a
- given property name (or getter name, if defined), that value will remain untouched.
- Nullable properties on the object can be set to nil by using `NSNull` as the updated value.
- Each property is set even if the existing value is the same as the new value being set, and
- notifications will report them all being changed. See `createOrUpdateModifiedInDefaultRealmWithValue:`
- for a version of this function which only sets the values which have changed.
-
- If the `value` argument is an array, all properties must be present, valid and in the same
- order as the properties defined in the model.
-
- @param value    The value used to populate the object.
-
- @see   `defaultPropertyValues`, `primaryKey`
- */
-+ (instancetype)createOrUpdateInDefaultRealmWithValue:(id)value;
-
-/**
- Creates or updates a Realm object within the default Realm.
-
- This method may only be called on Realm object types with a primary key defined. If there is already
- an object with the same primary key value in the default Realm, its values are updated and the object
- is returned. Otherwise, this method creates and populates a new instance of the object in the default Realm.
-
- If nested objects are included in the argument, `createOrUpdateModifiedInDefaultRealmWithValue:` will be
- recursively called on them if they have primary keys, `createInDefaultRealmWithValue:` if they do not.
-
- The `value` argument is used to populate the object. It can be a Realm object, a key-value coding
- compliant object, an array or dictionary returned from the methods in `NSJSONSerialization`, or an
- array containing one element for each managed property.
-
- If the object is being created, an exception will be thrown if any required properties
- are not present and those properties were not defined with default values.
-
- If the `value` argument is a Realm object already managed by the default Realm, the
- argument's type is the same as the receiver, and the objects have identical values for
- their managed properties, this method does nothing.
-
- If the object is being updated, each property defined in its schema will be set by copying from
- `value` using key-value coding. If the `value` argument does not respond to `valueForKey:` for a
- given property name (or getter name, if defined), that value will remain untouched.
- Nullable properties on the object can be set to nil by using `NSNull` as the updated value.
- Unlike `createOrUpdateInDefaultRealmWithValue:`, only properties which have changed in value are
- set, and any change notifications produced by this call will report only which properies have
- actually changed.
-
- Checking which properties have changed imposes a small amount of overhead, and so this method
- may be slower when all or nearly all of the properties being set have changed. If most or all
- of the properties being set have not changed, this method will be much faster than unconditionally
- setting all of them, and will also reduce how much data has to be written to the Realm, saving
- both i/o time and disk space.
-
- If the `value` argument is an array, all properties must be present, valid and in the same
- order as the properties defined in the model.
-
- @param value    The value used to populate the object.
-
- @see   `defaultPropertyValues`, `primaryKey`
- */
-+ (instancetype)createOrUpdateModifiedInDefaultRealmWithValue:(id)value;
-
-/**
- Creates or updates an Realm object within a specified Realm.
-
- This method may only be called on Realm object types with a primary key defined. If there is already
- an object with the same primary key value in the given Realm, its values are updated and the object
- is returned. Otherwise this method creates and populates a new instance of this object in the given Realm.
-
- If nested objects are included in the argument, `createOrUpdateInRealm:withValue:` will be
- recursively called on them if they have primary keys, `createInRealm:withValue:` if they do not.
-
- The `value` argument is used to populate the object. It can be a Realm object, a key-value coding
- compliant object, an array or dictionary returned from the methods in `NSJSONSerialization`, or an
- array containing one element for each managed property.
-
- If the object is being created, an exception will be thrown if any required properties
- are not present and those properties were not defined with default values.
-
- If the `value` argument is a Realm object already managed by the given Realm, the
- argument's type is the same as the receiver, and the objects have identical values for
- their managed properties, this method does nothing.
-
- If the object is being updated, each property defined in its schema will be set by copying from
- `value` using key-value coding. If the `value` argument does not respond to `valueForKey:` for a
- given property name (or getter name, if defined), that value will remain untouched.
- Nullable properties on the object can be set to nil by using `NSNull` as the updated value.
- Each property is set even if the existing value is the same as the new value being set, and
- notifications will report them all being changed. See `createOrUpdateModifiedInRealm:withValue:`
- for a version of this function which only sets the values which have changed.
-
- If the `value` argument is an array, all properties must be present, valid and in the same
- order as the properties defined in the model.
-
- @param realm    The Realm which should own the object.
- @param value    The value used to populate the object.
-
- @see   `defaultPropertyValues`, `primaryKey`
- */
-+ (instancetype)createOrUpdateInRealm:(RLMRealm *)realm withValue:(id)value;
-
-/**
- Creates or updates an Realm object within a specified Realm.
-
- This method may only be called on Realm object types with a primary key defined. If there is already
- an object with the same primary key value in the given Realm, its values are updated and the object
- is returned. Otherwise this method creates and populates a new instance of this object in the given Realm.
-
- If nested objects are included in the argument, `createOrUpdateInRealm:withValue:` will be
- recursively called on them if they have primary keys, `createInRealm:withValue:` if they do not.
-
- The `value` argument is used to populate the object. It can be a Realm object, a key-value coding
- compliant object, an array or dictionary returned from the methods in `NSJSONSerialization`, or an
- array containing one element for each managed property.
-
- If the object is being created, an exception will be thrown if any required properties
- are not present and those properties were not defined with default values.
-
- If the `value` argument is a Realm object already managed by the given Realm, the
- argument's type is the same as the receiver, and the objects have identical values for
- their managed properties, this method does nothing.
-
- If the object is being updated, each property defined in its schema will be set by copying from
- `value` using key-value coding. If the `value` argument does not respond to `valueForKey:` for a
- given property name (or getter name, if defined), that value will remain untouched.
- Nullable properties on the object can be set to nil by using `NSNull` as the updated value.
- Unlike `createOrUpdateInRealm:withValue:`, only properties which have changed in value are
- set, and any change notifications produced by this call will report only which properies have
- actually changed.
-
- Checking which properties have changed imposes a small amount of overhead, and so this method
- may be slower when all or nearly all of the properties being set have changed. If most or all
- of the properties being set have not changed, this method will be much faster than unconditionally
- setting all of them, and will also reduce how much data has to be written to the Realm, saving
- both i/o time and disk space.
-
- If the `value` argument is an array, all properties must be present, valid and in the same
- order as the properties defined in the model.
-
- @param realm    The Realm which should own the object.
- @param value    The value used to populate the object.
-
- @see   `defaultPropertyValues`, `primaryKey`
- */
-+ (instancetype)createOrUpdateModifiedInRealm:(RLMRealm *)realm withValue:(id)value;
-
-#pragma mark - Properties
-
-/**
- The Realm which manages the object, or `nil` if the object is unmanaged.
- */
-@property (nonatomic, readonly, nullable) RLMRealm *realm;
-
-/**
- The object schema which lists the managed properties for the object.
- */
-@property (nonatomic, readonly) RLMObjectSchema *objectSchema;
-
-/**
- Indicates if the object can no longer be accessed because it is now invalid.
-
- An object can no longer be accessed if the object has been deleted from the Realm that manages it, or
- if `invalidate` is called on that Realm.
- */
-@property (nonatomic, readonly, getter = isInvalidated) BOOL invalidated;
-
-/**
- Indicates if this object is frozen.
-
- @see `-[RLMObject freeze]`
- */
-@property (nonatomic, readonly, getter = isFrozen) BOOL frozen;
-
-
-#pragma mark - Customizing your Objects
-
-/**
- Returns an array of property names for properties which should be indexed.
-
- Only string, integer, boolean, and `NSDate` properties are supported.
-
- @return    An array of property names.
- */
-+ (NSArray<NSString *> *)indexedProperties;
-
-/**
- Override this method to specify the default values to be used for each property.
-
- @return    A dictionary mapping property names to their default values.
- */
-+ (nullable NSDictionary *)defaultPropertyValues;
-
-/**
- Override this method to specify the name of a property to be used as the primary key.
-
- Only properties of types `RLMPropertyTypeString` and `RLMPropertyTypeInt` can be designated as the primary key.
- Primary key properties enforce uniqueness for each value whenever the property is set, which incurs minor overhead.
- Indexes are created automatically for primary key properties.
-
- @return    The name of the property designated as the primary key.
- */
-+ (nullable NSString *)primaryKey;
-
-/**
- Override this method to specify the names of properties to ignore. These properties will not be managed by the Realm
- that manages the object.
-
- @return    An array of property names to ignore.
- */
-+ (nullable NSArray<NSString *> *)ignoredProperties;
-
-/**
- Override this method to specify the names of properties that are non-optional (i.e. cannot be assigned a `nil` value).
-
- By default, all properties of a type whose values can be set to `nil` are considered optional properties.
- To require that an object in a Realm always store a non-`nil` value for a property,
- add the name of the property to the array returned from this method.
-
- Properties of `RLMObject` type cannot be non-optional. Array and `NSNumber` properties
- can be non-optional, but there is no reason to do so: arrays do not support storing nil, and
- if you want a non-optional number you should instead use the primitive type.
-
- @return    An array of property names that are required.
- */
-+ (NSArray<NSString *> *)requiredProperties;
-
-/**
- Override this method to provide information related to properties containing linking objects.
-
- Each property of type `RLMLinkingObjects` must have a key in the dictionary returned by this method consisting
- of the property name. The corresponding value must be an instance of `RLMPropertyDescriptor` that describes the class
- and property that the property is linked to.
-
-     return @{ @"owners": [RLMPropertyDescriptor descriptorWithClass:Owner.class propertyName:@"dogs"] };
-
- @return     A dictionary mapping property names to `RLMPropertyDescriptor` instances.
- */
-+ (NSDictionary<NSString *, RLMPropertyDescriptor *> *)linkingObjectsProperties;
-
-
-#pragma mark - Getting & Querying Objects from the Default Realm
-
-/**
- Returns all objects of this object type from the default Realm.
-
- @return    An `RLMResults` containing all objects of this type in the default Realm.
- */
-+ (RLMResults *)allObjects;
-
-/**
- Returns all objects of this object type matching the given predicate from the default Realm.
-
- @param predicateFormat A predicate format string, optionally followed by a variable number of arguments.
-
- @return    An `RLMResults` containing all objects of this type in the default Realm that match the given predicate.
- */
-+ (RLMResults *)objectsWhere:(NSString *)predicateFormat, ...;
-
-/// :nodoc:
-+ (RLMResults<__kindof RLMObject *> *)objectsWhere:(NSString *)predicateFormat args:(va_list)args;
-
-
-/**
- Returns all objects of this object type matching the given predicate from the default Realm.
-
- @param predicate   The predicate with which to filter the objects.
-
- @return    An `RLMResults` containing all objects of this type in the default Realm that match the given predicate.
- */
-+ (RLMResults *)objectsWithPredicate:(nullable NSPredicate *)predicate;
-
-/**
- Retrieves the single instance of this object type with the given primary key from the default Realm.
-
- Returns the object from the default Realm which has the given primary key, or
- `nil` if the object does not exist. This is slightly faster than the otherwise
- equivalent `[[SubclassName objectsWhere:@"primaryKeyPropertyName = %@", key] firstObject]`.
-
- This method requires that `primaryKey` be overridden on the receiving subclass.
-
- @return    An object of this object type, or `nil` if an object with the given primary key does not exist.
- @see       `-primaryKey`
- */
-+ (nullable instancetype)objectForPrimaryKey:(nullable id)primaryKey NS_SWIFT_NAME(object(forPrimaryKey:));
-
-
-#pragma mark - Querying Specific Realms
-
-/**
- Returns all objects of this object type from the specified Realm.
-
- @param realm   The Realm to query.
-
- @return        An `RLMResults` containing all objects of this type in the specified Realm.
- */
-+ (RLMResults *)allObjectsInRealm:(RLMRealm *)realm;
-
-/**
- Returns all objects of this object type matching the given predicate from the specified Realm.
-
- @param predicateFormat A predicate format string, optionally followed by a variable number of arguments.
- @param realm           The Realm to query.
-
- @return    An `RLMResults` containing all objects of this type in the specified Realm that match the given predicate.
- */
-+ (RLMResults *)objectsInRealm:(RLMRealm *)realm where:(NSString *)predicateFormat, ...;
-
-/// :nodoc:
-+ (RLMResults<__kindof RLMObject *> *)objectsInRealm:(RLMRealm *)realm where:(NSString *)predicateFormat args:(va_list)args;
-
-/**
- Returns all objects of this object type matching the given predicate from the specified Realm.
-
- @param predicate   A predicate to use to filter the elements.
- @param realm       The Realm to query.
-
- @return    An `RLMResults` containing all objects of this type in the specified Realm that match the given predicate.
- */
-+ (RLMResults *)objectsInRealm:(RLMRealm *)realm withPredicate:(nullable NSPredicate *)predicate;
-
-/**
- Retrieves the single instance of this object type with the given primary key from the specified Realm.
-
- Returns the object from the specified Realm which has the given primary key, or
- `nil` if the object does not exist. This is slightly faster than the otherwise
- equivalent `[[SubclassName objectsInRealm:realm where:@"primaryKeyPropertyName = %@", key] firstObject]`.
-
- This method requires that `primaryKey` be overridden on the receiving subclass.
-
- @return    An object of this object type, or `nil` if an object with the given primary key does not exist.
- @see       `-primaryKey`
- */
-+ (nullable instancetype)objectInRealm:(RLMRealm *)realm forPrimaryKey:(nullable id)primaryKey NS_SWIFT_NAME(object(in:forPrimaryKey:));
-
-#pragma mark - Notifications
-
-/**
- A callback block for `RLMObject` notifications.
-
- If the object is deleted from the managing Realm, the block is called with
- `deleted` set to `YES` and the other two arguments are `nil`. The block will
- never be called again after this.
-
- If the object is modified, the block will be called with `deleted` set to
- `NO`, a `nil` error, and an array of `RLMPropertyChange` objects which
- indicate which properties of the objects were modified.
-
- If an error occurs, `deleted` will be `NO`, `changes` will be `nil`, and
- `error` will include information about the error. The block will never be
- called again after an error occurs.
- */
-typedef void (^RLMObjectChangeBlock)(BOOL deleted,
-                                     NSArray<RLMPropertyChange *> *_Nullable changes,
-                                     NSError *_Nullable error);
-
-/**
- Registers a block to be called each time the object changes.
-
- The block will be asynchronously called after each write transaction which
- deletes the object or modifies any of the managed properties of the object,
- including self-assignments that set a property to its existing value.
-
- For write transactions performed on different threads or in different
- processes, the block will be called when the managing Realm is
- (auto)refreshed to a version including the changes, while for local write
- transactions it will be called at some point in the future after the write
- transaction is committed.
-
- Notifications are delivered via the standard run loop, and so can't be
- delivered while the run loop is blocked by other activity. When notifications
- can't be delivered instantly, multiple notifications may be coalesced into a
- single notification.
-
- Unlike with `RLMArray` and `RLMResults`, there is no "initial" callback made
- after you add a new notification block.
-
- Only objects which are managed by a Realm can be observed in this way. You
- must retain the returned token for as long as you want updates to be sent to
- the block. To stop receiving updates, call `-invalidate` on the token.
-
- It is safe to capture a strong reference to the observed object within the
- callback block. There is no retain cycle due to that the callback is retained
- by the returned token and not by the object itself.
-
- @warning This method cannot be called during a write transaction, when the
-          containing Realm is read-only, or on an unmanaged object.
-
- @param block The block to be called whenever a change occurs.
- @return A token which must be held for as long as you want updates to be delivered.
- */
-- (RLMNotificationToken *)addNotificationBlock:(RLMObjectChangeBlock)block;
-
-/**
- Registers a block to be called each time the object changes.
-
- The block will be asynchronously called after each write transaction which
- deletes the object or modifies any of the managed properties of the object,
- including self-assignments that set a property to its existing value.
-
- For write transactions performed on different threads or in different
- processes, the block will be called when the managing Realm is
- (auto)refreshed to a version including the changes, while for local write
- transactions it will be called at some point in the future after the write
- transaction is committed.
-
- Notifications are delivered on the given queue. If the queue is blocked and
- notifications can't be delivered instantly, multiple notifications may be
- coalesced into a single notification.
-
- Unlike with `RLMArray` and `RLMResults`, there is no "initial" callback made
- after you add a new notification block.
-
- Only objects which are managed by a Realm can be observed in this way. You
- must retain the returned token for as long as you want updates to be sent to
- the block. To stop receiving updates, call `-invalidate` on the token.
-
- It is safe to capture a strong reference to the observed object within the
- callback block. There is no retain cycle due to that the callback is retained
- by the returned token and not by the object itself.
-
- @warning This method cannot be called during a write transaction, when the
-          containing Realm is read-only, or on an unmanaged object.
- @warning The queue must be a serial queue.
-
- @param block The block to be called whenever a change occurs.
- @param queue The serial queue to deliver notifications to.
- @return A token which must be held for as long as you want updates to be delivered.
- */
-- (RLMNotificationToken *)addNotificationBlock:(RLMObjectChangeBlock)block queue:(dispatch_queue_t)queue;
-
-#pragma mark - Other Instance Methods
-
-/**
- Returns YES if another Realm object instance points to the same object as the receiver in the Realm managing
- the receiver.
-
- For frozen objects and object types with a primary key, `isEqual:` is
- overridden to use the same logic as this method (along with a corresponding
- implementation for `hash`). Non-frozen objects without primary keys use
- pointer identity for `isEqual:` and `hash`.
-
- @param object  The object to compare the receiver to.
-
- @return    Whether the object represents the same object as the receiver.
- */
-- (BOOL)isEqualToObject:(RLMObject *)object;
-
-/**
- Returns a frozen (immutable) snapshot of this object.
-
- The frozen copy is an immutable object which contains the same data as this
- object currently contains, but will not update when writes are made to the
- containing Realm. Unlike live objects, frozen objects can be accessed from any
- thread.
-
- - warning: Holding onto a frozen object for an extended period while performing write
- transaction on the Realm may result in the Realm file growing to large sizes. See
- `Realm.Configuration.maximumNumberOfActiveVersions` for more information.
- - warning: This method can only be called on a managed object.
- */
-- (instancetype)freeze NS_RETURNS_RETAINED;
-
-#pragma mark - Dynamic Accessors
-
-/// :nodoc:
-- (nullable id)objectForKeyedSubscript:(NSString *)key;
-
-/// :nodoc:
-- (void)setObject:(nullable id)obj forKeyedSubscript:(NSString *)key;
-
-@end
-
-/**
- Information about a specific property which changed in an `RLMObject` change notification.
- */
-@interface RLMPropertyChange : NSObject
-
-/**
- The name of the property which changed.
- */
-@property (nonatomic, readonly, strong) NSString *name;
-
-/**
- The value of the property before the change occurred. This will always be `nil`
- if the change happened on the same thread as the notification and for `RLMArray`
- properties.
-
- For object properties this will give the object which was previously linked to,
- but that object will have its new values and not the values it had before the
- changes. This means that `previousValue` may be a deleted object, and you will
- need to check `invalidated` before accessing any of its properties.
- */
-@property (nonatomic, readonly, strong, nullable) id previousValue;
-
-/**
- The value of the property after the change occurred. This will always be `nil`
- for `RLMArray` properties.
- */
-@property (nonatomic, readonly, strong, nullable) id value;
-@end
-
-#pragma mark - RLMArray Property Declaration
-
-/**
- Properties on `RLMObject`s of type `RLMArray` must have an associated type. A type is associated
- with an `RLMArray` property by defining a protocol for the object type that the array should contain.
- To define the protocol for an object, you can use the macro RLM_ARRAY_TYPE:
-
-     RLM_ARRAY_TYPE(ObjectType)
-     ...
-     @property RLMArray<ObjectType *><ObjectType> *arrayOfObjectTypes;
-  */
-#define RLM_ARRAY_TYPE(RLM_OBJECT_SUBCLASS)\
-@protocol RLM_OBJECT_SUBCLASS <NSObject>   \
-@end
-
-NS_ASSUME_NONNULL_END

+ 0 - 238
Carthage/Checkouts/realm-cocoa/Realm/RLMObject.mm

@@ -1,238 +0,0 @@
-////////////////////////////////////////////////////////////////////////////
-//
-// Copyright 2014 Realm Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////
-
-#import "RLMObject_Private.hpp"
-
-#import "RLMAccessor.h"
-#import "RLMArray.h"
-#import "RLMCollection_Private.hpp"
-#import "RLMObjectBase_Private.h"
-#import "RLMObjectSchema_Private.hpp"
-#import "RLMObjectStore.h"
-#import "RLMProperty_Private.h"
-#import "RLMQueryUtil.hpp"
-#import "RLMRealm_Private.hpp"
-#import "RLMSchema_Private.h"
-
-#import "object.hpp"
-
-// We declare things in RLMObject which are actually implemented in RLMObjectBase
-// for documentation's sake, which leads to -Wunimplemented-method warnings.
-// Other alternatives to this would be to disable -Wunimplemented-method for this
-// file (but then we could miss legitimately missing things), or declaring the
-// inherited things in a category (but they currently aren't nicely grouped for
-// that).
-@implementation RLMObject
-
-// synthesized in RLMObjectBase
-@dynamic invalidated, realm, objectSchema;
-
-#pragma mark - Designated Initializers
-
-- (instancetype)init {
-    return [super init];
-}
-
-#pragma mark - Convenience Initializers
-
-- (instancetype)initWithValue:(id)value {
-    if (!(self = [self init])) {
-        return nil;
-    }
-    RLMInitializeWithValue(self, value, RLMSchema.partialPrivateSharedSchema);
-    return self;
-}
-
-#pragma mark - Class-based Object Creation
-
-+ (instancetype)createInDefaultRealmWithValue:(id)value {
-    return (RLMObject *)RLMCreateObjectInRealmWithValue([RLMRealm defaultRealm], [self className], value, RLMUpdatePolicyError);
-}
-
-+ (instancetype)createInRealm:(RLMRealm *)realm withValue:(id)value {
-    return (RLMObject *)RLMCreateObjectInRealmWithValue(realm, [self className], value, RLMUpdatePolicyError);
-}
-
-+ (instancetype)createOrUpdateInDefaultRealmWithValue:(id)value {
-    return [self createOrUpdateInRealm:[RLMRealm defaultRealm] withValue:value];
-}
-
-+ (instancetype)createOrUpdateModifiedInDefaultRealmWithValue:(id)value {
-    return [self createOrUpdateModifiedInRealm:[RLMRealm defaultRealm] withValue:value];
-}
-
-+ (instancetype)createOrUpdateInRealm:(RLMRealm *)realm withValue:(id)value {
-    RLMVerifyHasPrimaryKey(self);
-    return (RLMObject *)RLMCreateObjectInRealmWithValue(realm, [self className], value, RLMUpdatePolicyUpdateAll);
-}
-
-+ (instancetype)createOrUpdateModifiedInRealm:(RLMRealm *)realm withValue:(id)value {
-    RLMVerifyHasPrimaryKey(self);
-    return (RLMObject *)RLMCreateObjectInRealmWithValue(realm, [self className], value, RLMUpdatePolicyUpdateChanged);
-}
-
-#pragma mark - Subscripting
-
-- (id)objectForKeyedSubscript:(NSString *)key {
-    return RLMObjectBaseObjectForKeyedSubscript(self, key);
-}
-
-- (void)setObject:(id)obj forKeyedSubscript:(NSString *)key {
-    RLMObjectBaseSetObjectForKeyedSubscript(self, key, obj);
-}
-
-#pragma mark - Getting & Querying
-
-+ (RLMResults *)allObjects {
-    return RLMGetObjects(RLMRealm.defaultRealm, self.className, nil);
-}
-
-+ (RLMResults *)allObjectsInRealm:(__unsafe_unretained RLMRealm *const)realm {
-    return RLMGetObjects(realm, self.className, nil);
-}
-
-+ (RLMResults *)objectsWhere:(NSString *)predicateFormat, ... {
-    va_list args;
-    va_start(args, predicateFormat);
-    RLMResults *results = [self objectsWhere:predicateFormat args:args];
-    va_end(args);
-    return results;
-}
-
-+ (RLMResults *)objectsWhere:(NSString *)predicateFormat args:(va_list)args {
-    return [self objectsWithPredicate:[NSPredicate predicateWithFormat:predicateFormat arguments:args]];
-}
-
-+ (RLMResults *)objectsInRealm:(RLMRealm *)realm where:(NSString *)predicateFormat, ... {
-    va_list args;
-    va_start(args, predicateFormat);
-    RLMResults *results = [self objectsInRealm:realm where:predicateFormat args:args];
-    va_end(args);
-    return results;
-}
-
-+ (RLMResults *)objectsInRealm:(RLMRealm *)realm where:(NSString *)predicateFormat args:(va_list)args {
-    return [self objectsInRealm:realm withPredicate:[NSPredicate predicateWithFormat:predicateFormat arguments:args]];
-}
-
-+ (RLMResults *)objectsWithPredicate:(NSPredicate *)predicate {
-    return RLMGetObjects(RLMRealm.defaultRealm, self.className, predicate);
-}
-
-+ (RLMResults *)objectsInRealm:(RLMRealm *)realm withPredicate:(NSPredicate *)predicate {
-    return RLMGetObjects(realm, self.className, predicate);
-}
-
-+ (instancetype)objectForPrimaryKey:(id)primaryKey {
-    return RLMGetObject(RLMRealm.defaultRealm, self.className, primaryKey);
-}
-
-+ (instancetype)objectInRealm:(RLMRealm *)realm forPrimaryKey:(id)primaryKey {
-    return RLMGetObject(realm, self.className, primaryKey);
-}
-
-#pragma mark - Other Instance Methods
-
-- (BOOL)isEqualToObject:(RLMObject *)object {
-    return [object isKindOfClass:RLMObject.class] && RLMObjectBaseAreEqual(self, object);
-}
-
-- (instancetype)freeze {
-    return RLMObjectFreeze(self);
-}
-
-- (BOOL)isFrozen {
-    return _realm.isFrozen;
-}
-
-- (RLMNotificationToken *)addNotificationBlock:(RLMObjectChangeBlock)block {
-    return RLMObjectAddNotificationBlock(self, block, nil);
-}
-
-- (RLMNotificationToken *)addNotificationBlock:(RLMObjectChangeBlock)block
-                                         queue:(nonnull dispatch_queue_t)queue {
-    return RLMObjectAddNotificationBlock(self, block, queue);
-}
-
-+ (NSString *)className {
-    return [super className];
-}
-
-#pragma mark - Default values for schema definition
-
-+ (NSArray *)indexedProperties {
-    return @[];
-}
-
-+ (NSDictionary *)linkingObjectsProperties {
-    return @{};
-}
-
-+ (NSDictionary *)defaultPropertyValues {
-    return nil;
-}
-
-+ (NSString *)primaryKey {
-    return nil;
-}
-
-+ (NSArray *)ignoredProperties {
-    return nil;
-}
-
-+ (NSArray *)requiredProperties {
-    return @[];
-}
-
-+ (bool)_realmIgnoreClass {
-    return false;
-}
-
-@end
-
-@implementation RLMDynamicObject
-
-+ (bool)_realmIgnoreClass {
-    return true;
-}
-
-+ (BOOL)shouldIncludeInDefaultSchema {
-    return NO;
-}
-
-- (id)valueForUndefinedKey:(NSString *)key {
-    return RLMDynamicGetByName(self, key);
-}
-
-- (void)setValue:(id)value forUndefinedKey:(NSString *)key {
-    RLMDynamicValidatedSet(self, key, value);
-}
-
-+ (RLMObjectSchema *)sharedSchema {
-    return nil;
-}
-
-@end
-
-BOOL RLMIsObjectOrSubclass(Class klass) {
-    return RLMIsKindOfClass(klass, RLMObjectBase.class);
-}
-
-BOOL RLMIsObjectSubclass(Class klass) {
-    return RLMIsKindOfClass(class_getSuperclass(class_getSuperclass(klass)), RLMObjectBase.class);
-}

+ 0 - 44
Carthage/Checkouts/realm-cocoa/Realm/RLMObjectBase.h

@@ -1,44 +0,0 @@
-////////////////////////////////////////////////////////////////////////////
-//
-// Copyright 2014 Realm Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////
-
-#import <Foundation/Foundation.h>
-
-NS_ASSUME_NONNULL_BEGIN
-
-@class RLMRealm;
-@class RLMSchema;
-@class RLMObjectSchema;
-
-/// :nodoc:
-@interface RLMObjectBase : NSObject
-
-@property (nonatomic, readonly, getter = isInvalidated) BOOL invalidated;
-
-- (instancetype)init NS_DESIGNATED_INITIALIZER;
-
-+ (NSString *)className;
-
-// Returns whether the class is included in the default set of classes managed by a Realm.
-+ (BOOL)shouldIncludeInDefaultSchema;
-
-+ (nullable NSString *)_realmObjectName;
-+ (nullable NSDictionary<NSString *, NSString *> *)_realmColumnNames;
-
-@end
-
-NS_ASSUME_NONNULL_END

+ 0 - 710
Carthage/Checkouts/realm-cocoa/Realm/RLMObjectBase.mm

@@ -1,710 +0,0 @@
-////////////////////////////////////////////////////////////////////////////
-//
-// Copyright 2014 Realm Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////
-
-#import "RLMObject_Private.hpp"
-
-#import "RLMAccessor.h"
-#import "RLMArray_Private.hpp"
-#import "RLMListBase.h"
-#import "RLMObjectSchema_Private.hpp"
-#import "RLMObjectStore.h"
-#import "RLMObservation.hpp"
-#import "RLMOptionalBase.h"
-#import "RLMProperty_Private.h"
-#import "RLMRealm_Private.hpp"
-#import "RLMSchema_Private.h"
-#import "RLMSwiftSupport.h"
-#import "RLMThreadSafeReference_Private.hpp"
-#import "RLMUtil.hpp"
-
-#import "object.hpp"
-#import "object_schema.hpp"
-#import "shared_realm.hpp"
-
-using namespace realm;
-
-const NSUInteger RLMDescriptionMaxDepth = 5;
-
-
-static bool isManagedAccessorClass(Class cls) {
-    const char *className = class_getName(cls);
-    const char accessorClassPrefix[] = "RLM:Managed";
-    return strncmp(className, accessorClassPrefix, sizeof(accessorClassPrefix) - 1) == 0;
-}
-
-static bool maybeInitObjectSchemaForUnmanaged(RLMObjectBase *obj) {
-    Class cls = obj.class;
-    if (isManagedAccessorClass(cls)) {
-        return false;
-    }
-
-    obj->_objectSchema = [cls sharedSchema];
-    if (!obj->_objectSchema) {
-        return false;
-    }
-
-    // set default values
-    if (!obj->_objectSchema.isSwiftClass) {
-        NSDictionary *dict = RLMDefaultValuesForObjectSchema(obj->_objectSchema);
-        for (NSString *key in dict) {
-            [obj setValue:dict[key] forKey:key];
-        }
-    }
-
-    // set unmanaged accessor class
-    object_setClass(obj, obj->_objectSchema.unmanagedClass);
-    return true;
-}
-
-@interface RLMObjectBase () <RLMThreadConfined, RLMThreadConfined_Private>
-@end
-
-@implementation RLMObjectBase
-// unmanaged init
-- (instancetype)init {
-    if ((self = [super init])) {
-        maybeInitObjectSchemaForUnmanaged(self);
-    }
-    return self;
-}
-
-- (void)dealloc {
-    // This can't be a unique_ptr because associated objects are removed
-    // *after* c++ members are destroyed and dealloc is called, and we need it
-    // to be in a validish state when that happens
-    delete _observationInfo;
-    _observationInfo = nullptr;
-}
-
-static id coerceToObjectType(id obj, Class cls, RLMSchema *schema) {
-    if ([obj isKindOfClass:cls]) {
-        return obj;
-    }
-    id value = [[cls alloc] init];
-    RLMInitializeWithValue(value, obj, schema);
-    return value;
-}
-
-static id validatedObjectForProperty(__unsafe_unretained id const obj,
-                                     __unsafe_unretained RLMObjectSchema *const objectSchema,
-                                     __unsafe_unretained RLMProperty *const prop,
-                                     __unsafe_unretained RLMSchema *const schema) {
-    RLMValidateValueForProperty(obj, objectSchema, prop);
-    if (!obj || obj == NSNull.null) {
-        return nil;
-    }
-    if (prop.type == RLMPropertyTypeObject) {
-        Class objectClass = schema[prop.objectClassName].objectClass;
-        if (prop.array) {
-            NSMutableArray *ret = [[NSMutableArray alloc] init];
-            for (id el in obj) {
-                [ret addObject:coerceToObjectType(el, objectClass, schema)];
-            }
-            return ret;
-        }
-        return coerceToObjectType(obj, objectClass, schema);
-    }
-    return obj;
-}
-
-void RLMInitializeWithValue(RLMObjectBase *self, id value, RLMSchema *schema) {
-    if (!value || value == NSNull.null) {
-        @throw RLMException(@"Must provide a non-nil value.");
-    }
-
-    RLMObjectSchema *objectSchema = self->_objectSchema;
-    if (!objectSchema) {
-        // Will be nil if we're called during schema init, when we don't want
-        // to actually populate the object anyway
-        return;
-    }
-
-    NSArray *properties = objectSchema.properties;
-    if (NSArray *array = RLMDynamicCast<NSArray>(value)) {
-        if (array.count > properties.count) {
-            @throw RLMException(@"Invalid array input: more values (%llu) than properties (%llu).",
-                                (unsigned long long)array.count, (unsigned long long)properties.count);
-        }
-        NSUInteger i = 0;
-        for (id val in array) {
-            RLMProperty *prop = properties[i++];
-            [self setValue:validatedObjectForProperty(RLMCoerceToNil(val), objectSchema, prop, schema)
-                    forKey:prop.name];
-        }
-    }
-    else {
-        // assume our object is an NSDictionary or an object with kvc properties
-        for (RLMProperty *prop in properties) {
-            id obj = RLMValidatedValueForProperty(value, prop.name, objectSchema.className);
-
-            // don't set unspecified properties
-            if (!obj) {
-                continue;
-            }
-
-            [self setValue:validatedObjectForProperty(RLMCoerceToNil(obj), objectSchema, prop, schema)
-                    forKey:prop.name];
-        }
-    }
-}
-
-id RLMCreateManagedAccessor(Class cls, RLMClassInfo *info) {
-    RLMObjectBase *obj = [[cls alloc] init];
-    obj->_info = info;
-    obj->_realm = info->realm;
-    obj->_objectSchema = info->rlmObjectSchema;
-    return obj;
-}
-
-- (id)valueForKey:(NSString *)key {
-    if (_observationInfo) {
-        return _observationInfo->valueForKey(key);
-    }
-    return [super valueForKey:key];
-}
-
-// Generic Swift properties can't be dynamic, so KVO doesn't work for them by default
-- (id)valueForUndefinedKey:(NSString *)key {
-    RLMProperty *prop = _objectSchema[key];
-    if (Class accessor = prop.swiftAccessor) {
-        return [accessor get:(char *)(__bridge void *)self + ivar_getOffset(prop.swiftIvar)];
-    }
-    if (Ivar ivar = prop.swiftIvar) {
-        return RLMCoerceToNil(object_getIvar(self, ivar));
-    }
-    return [super valueForUndefinedKey:key];
-}
-
-- (void)setValue:(id)value forUndefinedKey:(NSString *)key {
-    value = RLMCoerceToNil(value);
-    RLMProperty *property = _objectSchema[key];
-    if (Ivar ivar = property.swiftIvar) {
-        if (property.array) {
-            value = RLMAsFastEnumeration(value);
-            RLMArray *array = [object_getIvar(self, ivar) _rlmArray];
-            [array removeAllObjects];
-
-            if (value) {
-                [array addObjects:validatedObjectForProperty(value, _objectSchema, property,
-                                                             RLMSchema.partialPrivateSharedSchema)];
-            }
-        }
-        else if (property.optional) {
-            RLMSetOptional(object_getIvar(self, ivar), value);
-        }
-        return;
-    }
-    [super setValue:value forUndefinedKey:key];
-}
-
-// overridden at runtime per-class for performance
-+ (NSString *)className {
-    NSString *className = NSStringFromClass(self);
-    if ([RLMSwiftSupport isSwiftClassName:className]) {
-        className = [RLMSwiftSupport demangleClassName:className];
-    }
-    return className;
-}
-
-// overridden at runtime per-class for performance
-+ (RLMObjectSchema *)sharedSchema {
-    return [RLMSchema sharedSchemaForClass:self.class];
-}
-
-+ (void)initializeLinkedObjectSchemas {
-    for (RLMProperty *prop in self.sharedSchema.properties) {
-        if (prop.type == RLMPropertyTypeObject && !RLMSchema.partialPrivateSharedSchema[prop.objectClassName]) {
-            [[RLMSchema classForString:prop.objectClassName] initializeLinkedObjectSchemas];
-        }
-    }
-}
-
-+ (nullable NSArray<RLMProperty *> *)_getPropertiesWithInstance:(__unused id)obj {
-    return nil;
-}
-
-- (NSString *)description {
-    if (self.isInvalidated) {
-        return @"[invalid object]";
-    }
-
-    return [self descriptionWithMaxDepth:RLMDescriptionMaxDepth];
-}
-
-- (NSString *)descriptionWithMaxDepth:(NSUInteger)depth {
-    if (depth == 0) {
-        return @"<Maximum depth exceeded>";
-    }
-
-    NSString *baseClassName = _objectSchema.className;
-    NSMutableString *mString = [NSMutableString stringWithFormat:@"%@ {\n", baseClassName];
-
-    for (RLMProperty *property in _objectSchema.properties) {
-        id object = [(id)self objectForKeyedSubscript:property.name];
-        NSString *sub;
-        if ([object respondsToSelector:@selector(descriptionWithMaxDepth:)]) {
-            sub = [object descriptionWithMaxDepth:depth - 1];
-        }
-        else if (property.type == RLMPropertyTypeData) {
-            static NSUInteger maxPrintedDataLength = 24;
-            NSData *data = object;
-            NSUInteger length = data.length;
-            if (length > maxPrintedDataLength) {
-                data = [NSData dataWithBytes:data.bytes length:maxPrintedDataLength];
-            }
-            NSString *dataDescription = [data description];
-            sub = [NSString stringWithFormat:@"<%@ — %lu total bytes>", [dataDescription substringWithRange:NSMakeRange(1, dataDescription.length - 2)], (unsigned long)length];
-        }
-        else {
-            sub = [object description];
-        }
-        [mString appendFormat:@"\t%@ = %@;\n", property.name, [sub stringByReplacingOccurrencesOfString:@"\n" withString:@"\n\t"]];
-    }
-    [mString appendString:@"}"];
-
-    return [NSString stringWithString:mString];
-}
-
-- (RLMRealm *)realm {
-    return _realm;
-}
-
-- (RLMObjectSchema *)objectSchema {
-    return _objectSchema;
-}
-
-- (BOOL)isInvalidated {
-    // if not unmanaged and our accessor has been detached, we have been deleted
-    return self.class == _objectSchema.accessorClass && !_row.is_valid();
-}
-
-- (BOOL)isEqual:(id)object {
-    if (RLMObjectBase *other = RLMDynamicCast<RLMObjectBase>(object)) {
-        if (_objectSchema.primaryKeyProperty || _realm.isFrozen) {
-            return RLMObjectBaseAreEqual(self, other);
-        }
-    }
-    return [super isEqual:object];
-}
-
-- (NSUInteger)hash {
-    if (_objectSchema.primaryKeyProperty) {
-        // If we have a primary key property, that's an immutable value which we
-        // can use as the identity of the object.
-        id primaryProperty = [self valueForKey:_objectSchema.primaryKeyProperty.name];
-
-        // modify the hash of our primary key value to avoid potential (although unlikely) collisions
-        return [primaryProperty hash] ^ 1;
-    }
-    else if (_realm.isFrozen) {
-        // The object key can never change for frozen objects, so that's usable
-        // for objects without primary keys
-        return _row.get_key().value;
-    }
-    else {
-        // Non-frozen objects without primary keys don't have any immutable
-        // concept of identity that we can hash so we have to fall back to
-        // pointer equality
-        return [super hash];
-    }
-}
-
-+ (BOOL)shouldIncludeInDefaultSchema {
-    return RLMIsObjectSubclass(self);
-}
-
-+ (NSString *)_realmObjectName {
-    return nil;
-}
-
-+ (NSDictionary *)_realmColumnNames {
-    return nil;
-}
-
-+ (bool)_realmIgnoreClass {
-    return false;
-}
-
-- (id)mutableArrayValueForKey:(NSString *)key {
-    id obj = [self valueForKey:key];
-    if ([obj isKindOfClass:[RLMArray class]]) {
-        return obj;
-    }
-    return [super mutableArrayValueForKey:key];
-}
-
-- (void)addObserver:(id)observer
-         forKeyPath:(NSString *)keyPath
-            options:(NSKeyValueObservingOptions)options
-            context:(void *)context {
-    if (!_observationInfo) {
-        _observationInfo = new RLMObservationInfo(self);
-    }
-    _observationInfo->recordObserver(_row, _info, _objectSchema, keyPath);
-
-    [super addObserver:observer forKeyPath:keyPath options:options context:context];
-}
-
-- (void)removeObserver:(NSObject *)observer forKeyPath:(NSString *)keyPath {
-    [super removeObserver:observer forKeyPath:keyPath];
-    if (_observationInfo)
-        _observationInfo->removeObserver();
-}
-
-+ (BOOL)automaticallyNotifiesObserversForKey:(NSString *)key {
-    if (isManagedAccessorClass(self) && [class_getSuperclass(self.class) sharedSchema][key]) {
-        return NO;
-    }
-
-    return [super automaticallyNotifiesObserversForKey:key];
-}
-
-#pragma mark - Thread Confined Protocol Conformance
-
-- (realm::ThreadSafeReference)makeThreadSafeReference {
-    return Object(_realm->_realm, *_info->objectSchema, _row);
-}
-
-- (id)objectiveCMetadata {
-    return nil;
-}
-
-+ (instancetype)objectWithThreadSafeReference:(realm::ThreadSafeReference)reference
-                                     metadata:(__unused id)metadata
-                                        realm:(RLMRealm *)realm {
-    Object object = reference.resolve<Object>(realm->_realm);
-    if (!object.is_valid()) {
-        return nil;
-    }
-    NSString *objectClassName = @(object.get_object_schema().name.c_str());
-    return RLMCreateObjectAccessor(realm->_info[objectClassName], object.obj());
-}
-
-@end
-
-RLMRealm *RLMObjectBaseRealm(__unsafe_unretained RLMObjectBase *object) {
-    return object ? object->_realm : nil;
-}
-
-RLMObjectSchema *RLMObjectBaseObjectSchema(__unsafe_unretained RLMObjectBase *object) {
-    return object ? object->_objectSchema : nil;
-}
-
-id RLMObjectBaseObjectForKeyedSubscript(RLMObjectBase *object, NSString *key) {
-    if (!object) {
-        return nil;
-    }
-
-    if (object->_realm) {
-        return RLMDynamicGetByName(object, key);
-    }
-    else {
-        return [object valueForKey:key];
-    }
-}
-
-void RLMObjectBaseSetObjectForKeyedSubscript(RLMObjectBase *object, NSString *key, id obj) {
-    if (!object) {
-        return;
-    }
-
-    if (object->_realm || object.class == object->_objectSchema.accessorClass) {
-        RLMDynamicValidatedSet(object, key, obj);
-    }
-    else {
-        [object setValue:obj forKey:key];
-    }
-}
-
-
-BOOL RLMObjectBaseAreEqual(RLMObjectBase *o1, RLMObjectBase *o2) {
-    // if not the correct types throw
-    if ((o1 && ![o1 isKindOfClass:RLMObjectBase.class]) || (o2 && ![o2 isKindOfClass:RLMObjectBase.class])) {
-        @throw RLMException(@"Can only compare objects of class RLMObjectBase");
-    }
-    // if identical object (or both are nil)
-    if (o1 == o2) {
-        return YES;
-    }
-    // if one is nil
-    if (o1 == nil || o2 == nil) {
-        return NO;
-    }
-    // if not in realm or differing realms
-    if (o1->_realm == nil || o1->_realm != o2->_realm) {
-        return NO;
-    }
-    // if either are detached
-    if (!o1->_row.is_valid() || !o2->_row.is_valid()) {
-        return NO;
-    }
-    // if table and index are the same
-    return o1->_row.get_table() == o2->_row.get_table()
-        && o1->_row.get_key() == o2->_row.get_key();
-}
-
-id RLMObjectFreeze(RLMObjectBase *obj) {
-    if (!obj->_realm && !obj.isInvalidated) {
-        @throw RLMException(@"Unmanaged objects cannot be frozen.");
-    }
-    RLMVerifyAttached(obj);
-    if (obj->_realm.frozen) {
-        return obj;
-    }
-    RLMRealm *frozenRealm = [obj->_realm freeze];
-    RLMObjectBase *frozen = RLMCreateManagedAccessor(obj.class, &frozenRealm->_info[obj->_info->rlmObjectSchema.className]);
-    frozen->_row = frozenRealm->_realm->import_copy_of(obj->_row);
-    if (!frozen->_row.is_valid()) {
-        @throw RLMException(@"Cannot freeze an object in the same write transaction as it was created in.");
-    }
-    RLMInitializeSwiftAccessorGenerics(frozen);
-    return frozen;
-}
-
-id RLMValidatedValueForProperty(id object, NSString *key, NSString *className) {
-    @try {
-        return [object valueForKey:key];
-    }
-    @catch (NSException *e) {
-        if ([e.name isEqualToString:NSUndefinedKeyException]) {
-            @throw RLMException(@"Invalid value '%@' to initialize object of type '%@': missing key '%@'",
-                                object, className, key);
-        }
-        @throw;
-    }
-}
-
-#pragma mark - Notifications
-
-namespace {
-struct ObjectChangeCallbackWrapper {
-    RLMObjectNotificationCallback block;
-    RLMObjectBase *object;
-
-    NSArray<NSString *> *propertyNames = nil;
-    NSArray *oldValues = nil;
-    bool deleted = false;
-
-    void populateProperties(realm::CollectionChangeSet const& c) {
-        if (propertyNames) {
-            return;
-        }
-        if (!c.deletions.empty()) {
-            deleted = true;
-            return;
-        }
-        if (c.columns.empty()) {
-            return;
-        }
-
-        auto properties = [NSMutableArray new];
-        for (RLMProperty *property in object->_info->rlmObjectSchema.properties) {
-            if (c.columns.count(object->_info->tableColumn(property).value)) {
-                [properties addObject:property.name];
-            }
-        }
-        if (properties.count) {
-            propertyNames = properties;
-        }
-    }
-
-    NSArray *readValues(realm::CollectionChangeSet const& c) {
-        if (c.empty()) {
-            return nil;
-        }
-        populateProperties(c);
-        if (!propertyNames) {
-            return nil;
-        }
-
-        auto values = [NSMutableArray arrayWithCapacity:propertyNames.count];
-        for (NSString *name in propertyNames) {
-            id value = [object valueForKey:name];
-            if (!value || [value isKindOfClass:[RLMArray class]]) {
-                [values addObject:NSNull.null];
-            }
-            else {
-                [values addObject:value];
-            }
-        }
-        return values;
-    }
-
-    void before(realm::CollectionChangeSet const& c) {
-        @autoreleasepool {
-            oldValues = readValues(c);
-        }
-    }
-
-    void after(realm::CollectionChangeSet const& c) {
-        @autoreleasepool {
-            auto newValues = readValues(c);
-            if (deleted) {
-                block(nil, nil, nil, nil, nil);
-            }
-            else if (newValues) {
-                block(object, propertyNames, oldValues, newValues, nil);
-            }
-            propertyNames = nil;
-            oldValues = nil;
-        }
-    }
-
-    void error(std::exception_ptr err) {
-        @autoreleasepool {
-            try {
-                rethrow_exception(err);
-            }
-            catch (...) {
-                NSError *error = nil;
-                RLMRealmTranslateException(&error);
-                block(nil, nil, nil, nil, error);
-            }
-        }
-    }
-};
-} // anonymous namespace
-
-@interface RLMPropertyChange ()
-@property (nonatomic, readwrite, strong) NSString *name;
-@property (nonatomic, readwrite, strong, nullable) id previousValue;
-@property (nonatomic, readwrite, strong, nullable) id value;
-@end
-
-@implementation RLMPropertyChange
-- (NSString *)description {
-    return [NSString stringWithFormat:@"<RLMPropertyChange: %p> %@ %@ -> %@",
-            (__bridge void *)self, _name, _previousValue, _value];
-}
-@end
-@interface RLMObjectNotificationToken : RLMNotificationToken
-@end
-
-@implementation RLMObjectNotificationToken {
-    std::mutex _mutex;
-    __unsafe_unretained RLMRealm *_realm;
-    realm::Object _object;
-    realm::NotificationToken _token;
-}
-
-- (RLMRealm *)realm {
-    return _realm;
-}
-
-- (void)suppressNextNotification {
-    std::lock_guard<std::mutex> lock(_mutex);
-    if (_object.is_valid()) {
-        _token.suppress_next();
-    }
-}
-
-- (void)invalidate {
-    std::lock_guard<std::mutex> lock(_mutex);
-    _realm = nil;
-    _token = {};
-    _object = {};
-}
-
-- (void)addNotificationBlock:(RLMObjectNotificationCallback)block
-         threadSafeReference:(RLMThreadSafeReference *)tsr
-                      config:(RLMRealmConfiguration *)config
-                       queue:(dispatch_queue_t)queue {
-    std::lock_guard<std::mutex> lock(_mutex);
-    if (!_realm) {
-        // Token was invalidated before we got this far
-        return;
-    }
-
-    NSError *error;
-    RLMRealm *realm = _realm = [RLMRealm realmWithConfiguration:config queue:queue error:&error];
-    if (!realm) {
-        block(nil, nil, nil, nil, error);
-        return;
-    }
-    RLMObjectBase *obj = [realm resolveThreadSafeReference:tsr];
-
-    _object = realm::Object(obj->_realm->_realm, *obj->_info->objectSchema, obj->_row);
-    _token = _object.add_notification_callback(ObjectChangeCallbackWrapper{block, obj});
-}
-
-- (void)addNotificationBlock:(RLMObjectNotificationCallback)block object:(RLMObjectBase *)obj {
-    _object = realm::Object(obj->_realm->_realm, *obj->_info->objectSchema, obj->_row);
-    _realm = obj->_realm;
-    _token = _object.add_notification_callback(ObjectChangeCallbackWrapper{block, obj});
-}
-
-RLMNotificationToken *RLMObjectBaseAddNotificationBlock(RLMObjectBase *obj, dispatch_queue_t queue,
-                                                        RLMObjectNotificationCallback block) {
-    if (!obj->_realm) {
-        @throw RLMException(@"Only objects which are managed by a Realm support change notifications");
-    }
-
-    if (!queue) {
-        [obj->_realm verifyNotificationsAreSupported:true];
-        auto token = [[RLMObjectNotificationToken alloc] init];
-        token->_realm = obj->_realm;
-        [token addNotificationBlock:block object:obj];
-        return token;
-    }
-
-    RLMThreadSafeReference *tsr = [RLMThreadSafeReference referenceWithThreadConfined:(id)obj];
-    auto token = [[RLMObjectNotificationToken alloc] init];
-    token->_realm = obj->_realm;
-    RLMRealmConfiguration *config = obj->_realm.configuration;
-    dispatch_async(queue, ^{
-        @autoreleasepool {
-            [token addNotificationBlock:block threadSafeReference:tsr config:config queue:queue];
-        }
-    });
-    return token;
-}
-
-@end
-
-RLMNotificationToken *RLMObjectAddNotificationBlock(RLMObjectBase *obj, RLMObjectChangeBlock block, dispatch_queue_t queue) {
-    return RLMObjectBaseAddNotificationBlock(obj, queue, ^(RLMObjectBase *, NSArray<NSString *> *propertyNames,
-                                                           NSArray *oldValues, NSArray *newValues, NSError *error) {
-        if (error) {
-            block(false, nil, error);
-        }
-        else if (!propertyNames) {
-            block(true, nil, nil);
-        }
-        else {
-            auto properties = [NSMutableArray arrayWithCapacity:propertyNames.count];
-            for (NSUInteger i = 0, count = propertyNames.count; i < count; ++i) {
-                auto prop = [RLMPropertyChange new];
-                prop.name = propertyNames[i];
-                prop.previousValue = RLMCoerceToNil(oldValues[i]);
-                prop.value = RLMCoerceToNil(newValues[i]);
-                [properties addObject:prop];
-            }
-            block(false, properties, nil);
-        }
-    });
-}
-
-uint64_t RLMObjectBaseGetCombineId(__unsafe_unretained RLMObjectBase *const obj) {
-    if (obj.invalidated) {
-        RLMVerifyAttached(obj);
-    }
-    if (obj->_realm) {
-        return obj->_row.get_key().value;
-    }
-    return reinterpret_cast<uint64_t>((__bridge void *)obj);
-}

+ 0 - 82
Carthage/Checkouts/realm-cocoa/Realm/RLMObjectBase_Dynamic.h

@@ -1,82 +0,0 @@
-////////////////////////////////////////////////////////////////////////////
-//
-// Copyright 2014 Realm Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////
-
-#import <Realm/RLMObject.h>
-
-@class RLMObjectSchema, RLMRealm;
-
-NS_ASSUME_NONNULL_BEGIN
-
-/**
- Returns the Realm that manages the object, if one exists.
-
- @warning  This function is useful only in specialized circumstances, for example, when building components
-           that integrate with Realm. If you are simply building an app on Realm, it is
-           recommended to retrieve the Realm that manages the object via `RLMObject`.
-
- @param object	An `RLMObjectBase` obtained via a Swift `Object` or `RLMObject`.
-
- @return The Realm which manages this object. Returns `nil `for unmanaged objects.
- */
-FOUNDATION_EXTERN RLMRealm * _Nullable RLMObjectBaseRealm(RLMObjectBase * _Nullable object);
-
-/**
- Returns an `RLMObjectSchema` which describes the managed properties of the object.
-
- @warning  This function is useful only in specialized circumstances, for example, when building components
-           that integrate with Realm. If you are simply building an app on Realm, it is
-           recommended to retrieve `objectSchema` via `RLMObject`.
-
- @param object	An `RLMObjectBase` obtained via a Swift `Object` or `RLMObject`.
-
- @return The object schema which lists the managed properties for the object.
- */
-FOUNDATION_EXTERN RLMObjectSchema * _Nullable RLMObjectBaseObjectSchema(RLMObjectBase * _Nullable object);
-
-/**
- Returns the object corresponding to a key value.
-
- @warning  This function is useful only in specialized circumstances, for example, when building components
-           that integrate with Realm. If you are simply building an app on Realm, it is
-           recommended to retrieve key values via `RLMObject`.
-
- @warning Will throw an `NSUndefinedKeyException` if `key` is not present on the object.
-
- @param object	An `RLMObjectBase` obtained via a Swift `Object` or `RLMObject`.
- @param key		The name of the property.
-
- @return The object for the property requested.
- */
-FOUNDATION_EXTERN id _Nullable RLMObjectBaseObjectForKeyedSubscript(RLMObjectBase * _Nullable object, NSString *key);
-
-/**
- Sets a value for a key on the object.
-
- @warning  This function is useful only in specialized circumstances, for example, when building components
-           that integrate with Realm. If you are simply building an app on Realm, it is
-           recommended to set key values via `RLMObject`.
-
- @warning Will throw an `NSUndefinedKeyException` if `key` is not present on the object.
-
- @param object	An `RLMObjectBase` obtained via a Swift `Object` or `RLMObject`.
- @param key		The name of the property.
- @param obj		The object to set as the value of the key.
- */
-FOUNDATION_EXTERN void RLMObjectBaseSetObjectForKeyedSubscript(RLMObjectBase * _Nullable object, NSString *key, id _Nullable obj);
-
-NS_ASSUME_NONNULL_END

+ 0 - 30
Carthage/Checkouts/realm-cocoa/Realm/RLMObjectBase_Private.h

@@ -1,30 +0,0 @@
-////////////////////////////////////////////////////////////////////////////
-//
-// Copyright 2017 Realm Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////
-
-#import <Realm/RLMObjectBase.h>
-
-@class RLMArray<RLMObjectType>;
-
-NS_ASSUME_NONNULL_BEGIN
-
-// RLMObjectBase private
-@interface RLMObjectBase ()
-+ (void)initializeLinkedObjectSchemas;
-@end
-
-NS_ASSUME_NONNULL_END

+ 0 - 72
Carthage/Checkouts/realm-cocoa/Realm/RLMObjectSchema.h

@@ -1,72 +0,0 @@
-////////////////////////////////////////////////////////////////////////////
-//
-// Copyright 2014 Realm Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////
-
-#import <Foundation/Foundation.h>
-
-NS_ASSUME_NONNULL_BEGIN
-
-@class RLMProperty;
-
-/**
- This class represents Realm model object schemas.
-
- When using Realm, `RLMObjectSchema` instances allow performing migrations and
- introspecting the database's schema.
-
- Object schemas map to tables in the core database.
- */
-@interface RLMObjectSchema : NSObject<NSCopying>
-
-#pragma mark - Properties
-
-/**
- An array of `RLMProperty` instances representing the managed properties of a class described by the schema.
-
- @see `RLMProperty`
- */
-@property (nonatomic, readonly, copy) NSArray<RLMProperty *> *properties;
-
-/**
- The name of the class the schema describes.
- */
-@property (nonatomic, readonly) NSString *className;
-
-/**
- The property which serves as the primary key for the class the schema describes, if any.
- */
-@property (nonatomic, readonly, nullable) RLMProperty *primaryKeyProperty;
-
-#pragma mark - Methods
-
-/**
- Retrieves an `RLMProperty` object by the property name.
-
- @param propertyName The property's name.
-
- @return An `RLMProperty` object, or `nil` if there is no property with the given name.
- */
-- (nullable RLMProperty *)objectForKeyedSubscript:(NSString *)propertyName;
-
-/**
- Returns whether two `RLMObjectSchema` instances are equal.
- */
-- (BOOL)isEqualToObjectSchema:(RLMObjectSchema *)objectSchema;
-
-@end
-
-NS_ASSUME_NONNULL_END

+ 0 - 364
Carthage/Checkouts/realm-cocoa/Realm/RLMObjectSchema.mm

@@ -1,364 +0,0 @@
-////////////////////////////////////////////////////////////////////////////
-//
-// Copyright 2014 Realm Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////
-
-#import "RLMObjectSchema_Private.hpp"
-
-#import "RLMArray.h"
-#import "RLMListBase.h"
-#import "RLMObject_Private.h"
-#import "RLMProperty_Private.hpp"
-#import "RLMRealm_Dynamic.h"
-#import "RLMRealm_Private.hpp"
-#import "RLMSchema_Private.h"
-#import "RLMSwiftSupport.h"
-#import "RLMUtil.hpp"
-
-#import "object_schema.hpp"
-#import "object_store.hpp"
-
-using namespace realm;
-
-// private properties
-@interface RLMObjectSchema ()
-@property (nonatomic, readwrite) NSDictionary<id, RLMProperty *> *allPropertiesByName;
-@property (nonatomic, readwrite) NSString *className;
-@end
-
-@implementation RLMObjectSchema {
-    NSArray *_swiftGenericProperties;
-}
-
-- (instancetype)initWithClassName:(NSString *)objectClassName objectClass:(Class)objectClass properties:(NSArray *)properties {
-    self = [super init];
-    self.className = objectClassName;
-    self.properties = properties;
-    self.objectClass = objectClass;
-    self.accessorClass = objectClass;
-    self.unmanagedClass = objectClass;
-    return self;
-}
-
-// return properties by name
-- (RLMProperty *)objectForKeyedSubscript:(__unsafe_unretained NSString *const)key {
-    return _allPropertiesByName[key];
-}
-
-// create property map when setting property array
-- (void)setProperties:(NSArray *)properties {
-    _properties = properties;
-    [self _propertiesDidChange];
-}
-
-- (void)setComputedProperties:(NSArray *)computedProperties {
-    _computedProperties = computedProperties;
-    [self _propertiesDidChange];
-}
-
-- (void)_propertiesDidChange {
-    NSMutableDictionary *map = [NSMutableDictionary dictionaryWithCapacity:_properties.count + _computedProperties.count];
-    NSUInteger index = 0;
-    for (RLMProperty *prop in _properties) {
-        prop.index = index++;
-        map[prop.name] = prop;
-        if (prop.isPrimary) {
-            self.primaryKeyProperty = prop;
-        }
-    }
-    index = 0;
-    for (RLMProperty *prop in _computedProperties) {
-        prop.index = index++;
-        map[prop.name] = prop;
-    }
-    _allPropertiesByName = map;
-}
-
-
-- (void)setPrimaryKeyProperty:(RLMProperty *)primaryKeyProperty {
-    _primaryKeyProperty.isPrimary = NO;
-    primaryKeyProperty.isPrimary = YES;
-    _primaryKeyProperty = primaryKeyProperty;
-}
-
-+ (instancetype)schemaForObjectClass:(Class)objectClass {
-    RLMObjectSchema *schema = [RLMObjectSchema new];
-
-    // determine classname from objectclass as className method has not yet been updated
-    NSString *className = NSStringFromClass(objectClass);
-    bool hasSwiftName = [RLMSwiftSupport isSwiftClassName:className];
-    if (hasSwiftName) {
-        className = [RLMSwiftSupport demangleClassName:className];
-    }
-
-    static Class s_swiftObjectClass = NSClassFromString(@"RealmSwiftObject");
-    bool isSwift = hasSwiftName || [objectClass isSubclassOfClass:s_swiftObjectClass];
-
-    schema.className = className;
-    schema.objectClass = objectClass;
-    schema.accessorClass = objectClass;
-    schema.isSwiftClass = isSwift;
-
-    // create array of RLMProperties, inserting properties of superclasses first
-    Class cls = objectClass;
-    Class superClass = class_getSuperclass(cls);
-    NSArray *allProperties = @[];
-    while (superClass && superClass != RLMObjectBase.class) {
-        allProperties = [[RLMObjectSchema propertiesForClass:cls isSwift:isSwift]
-                         arrayByAddingObjectsFromArray:allProperties];
-        cls = superClass;
-        superClass = class_getSuperclass(superClass);
-    }
-    NSArray *persistedProperties = [allProperties filteredArrayUsingPredicate:[NSPredicate predicateWithBlock:^BOOL(RLMProperty *property, NSDictionary *) {
-        return !RLMPropertyTypeIsComputed(property.type);
-    }]];
-    schema.properties = persistedProperties;
-
-    NSArray *computedProperties = [allProperties filteredArrayUsingPredicate:[NSPredicate predicateWithBlock:^BOOL(RLMProperty *property, NSDictionary *) {
-        return RLMPropertyTypeIsComputed(property.type);
-    }]];
-    schema.computedProperties = computedProperties;
-
-    // verify that we didn't add any properties twice due to inheritance
-    if (allProperties.count != [NSSet setWithArray:[allProperties valueForKey:@"name"]].count) {
-        NSCountedSet *countedPropertyNames = [NSCountedSet setWithArray:[allProperties valueForKey:@"name"]];
-        NSArray *duplicatePropertyNames = [countedPropertyNames filteredSetUsingPredicate:[NSPredicate predicateWithBlock:^BOOL(id object, NSDictionary *) {
-            return [countedPropertyNames countForObject:object] > 1;
-        }]].allObjects;
-
-        if (duplicatePropertyNames.count == 1) {
-            @throw RLMException(@"Property '%@' is declared multiple times in the class hierarchy of '%@'", duplicatePropertyNames.firstObject, className);
-        } else {
-            @throw RLMException(@"Object '%@' has properties that are declared multiple times in its class hierarchy: '%@'", className, [duplicatePropertyNames componentsJoinedByString:@"', '"]);
-        }
-    }
-
-    if (NSString *primaryKey = [objectClass primaryKey]) {
-        for (RLMProperty *prop in schema.properties) {
-            if ([primaryKey isEqualToString:prop.name]) {
-                prop.indexed = YES;
-                schema.primaryKeyProperty = prop;
-                break;
-            }
-        }
-
-        if (!schema.primaryKeyProperty) {
-            @throw RLMException(@"Primary key property '%@' does not exist on object '%@'", primaryKey, className);
-        }
-        if (schema.primaryKeyProperty.type != RLMPropertyTypeInt && schema.primaryKeyProperty.type != RLMPropertyTypeString) {
-            @throw RLMException(@"Property '%@' cannot be made the primary key of '%@' because it is not a 'string' or 'int' property.",
-                                primaryKey, className);
-        }
-    }
-
-    for (RLMProperty *prop in schema.properties) {
-        if (prop.optional && prop.array && (prop.type == RLMPropertyTypeObject || prop.type == RLMPropertyTypeLinkingObjects)) {
-            // FIXME: message is awkward
-            @throw RLMException(@"Property '%@.%@' cannot be made optional because optional '%@' properties are not supported.",
-                                className, prop.name, RLMTypeToString(prop.type));
-        }
-    }
-
-    return schema;
-}
-
-+ (NSArray *)propertiesForClass:(Class)objectClass isSwift:(bool)isSwiftClass {
-    // For Swift classes we need an instance of the object when parsing properties
-    id swiftObjectInstance = isSwiftClass ? [[objectClass alloc] init] : nil;
-
-    if (NSArray<RLMProperty *> *props = [objectClass _getPropertiesWithInstance:swiftObjectInstance]) {
-        return props;
-    }
-
-    NSArray *ignoredProperties = [objectClass ignoredProperties];
-    NSDictionary *linkingObjectsProperties = [objectClass linkingObjectsProperties];
-    NSDictionary *columnNameMap = [objectClass _realmColumnNames];
-
-    unsigned int count;
-    std::unique_ptr<objc_property_t[], decltype(&free)> props(class_copyPropertyList(objectClass, &count), &free);
-    NSMutableArray<RLMProperty *> *propArray = [NSMutableArray arrayWithCapacity:count];
-    NSSet *indexed = [[NSSet alloc] initWithArray:[objectClass indexedProperties]];
-    for (unsigned int i = 0; i < count; i++) {
-        NSString *propertyName = @(property_getName(props[i]));
-        if ([ignoredProperties containsObject:propertyName]) {
-            continue;
-        }
-
-        RLMProperty *prop = nil;
-        if (isSwiftClass) {
-            prop = [[RLMProperty alloc] initSwiftPropertyWithName:propertyName
-                                                          indexed:[indexed containsObject:propertyName]
-                                           linkPropertyDescriptor:linkingObjectsProperties[propertyName]
-                                                         property:props[i]
-                                                         instance:swiftObjectInstance];
-        }
-        else {
-            prop = [[RLMProperty alloc] initWithName:propertyName
-                                             indexed:[indexed containsObject:propertyName]
-                              linkPropertyDescriptor:linkingObjectsProperties[propertyName]
-                                            property:props[i]];
-        }
-
-        if (prop) {
-            if (columnNameMap) {
-                prop.columnName = columnNameMap[prop.name];
-            }
-            [propArray addObject:prop];
-        }
-    }
-
-    if (auto requiredProperties = [objectClass requiredProperties]) {
-        for (RLMProperty *property in propArray) {
-            bool required = [requiredProperties containsObject:property.name];
-            if (required && property.type == RLMPropertyTypeObject && !property.array) {
-                @throw RLMException(@"Object properties cannot be made required, "
-                                    "but '+[%@ requiredProperties]' included '%@'", objectClass, property.name);
-            }
-            property.optional &= !required;
-        }
-    }
-
-    for (RLMProperty *property in propArray) {
-        if (!property.optional && property.type == RLMPropertyTypeObject && !property.array) {
-            @throw RLMException(@"The `%@.%@` property must be marked as being optional.",
-                                [objectClass className], property.name);
-        }
-    }
-
-    return propArray;
-}
-
-- (id)copyWithZone:(NSZone *)zone {
-    RLMObjectSchema *schema = [[RLMObjectSchema allocWithZone:zone] init];
-    schema->_objectClass = _objectClass;
-    schema->_className = _className;
-    schema->_objectClass = _objectClass;
-    schema->_accessorClass = _objectClass;
-    schema->_unmanagedClass = _unmanagedClass;
-    schema->_isSwiftClass = _isSwiftClass;
-
-    // call property setter to reset map and primary key
-    schema.properties = [[NSArray allocWithZone:zone] initWithArray:_properties copyItems:YES];
-    schema.computedProperties = [[NSArray allocWithZone:zone] initWithArray:_computedProperties copyItems:YES];
-
-    return schema;
-}
-
-- (BOOL)isEqualToObjectSchema:(RLMObjectSchema *)objectSchema {
-    if (objectSchema.properties.count != _properties.count) {
-        return NO;
-    }
-
-    if (![_properties isEqualToArray:objectSchema.properties]) {
-        return NO;
-    }
-    if (![_computedProperties isEqualToArray:objectSchema.computedProperties]) {
-        return NO;
-    }
-
-    return YES;
-}
-
-- (NSString *)description {
-    NSMutableString *propertiesString = [NSMutableString string];
-    for (RLMProperty *property in self.properties) {
-        [propertiesString appendFormat:@"\t%@\n", [property.description stringByReplacingOccurrencesOfString:@"\n" withString:@"\n\t"]];
-    }
-    for (RLMProperty *property in self.computedProperties) {
-        [propertiesString appendFormat:@"\t%@\n", [property.description stringByReplacingOccurrencesOfString:@"\n" withString:@"\n\t"]];
-    }
-    return [NSString stringWithFormat:@"%@ {\n%@}", self.className, propertiesString];
-}
-
-- (NSString *)objectName {
-    return [self.objectClass _realmObjectName] ?: _className;
-}
-
-- (realm::ObjectSchema)objectStoreCopy:(RLMSchema *)schema {
-    ObjectSchema objectSchema;
-    objectSchema.name = self.objectName.UTF8String;
-    objectSchema.primary_key = _primaryKeyProperty ? _primaryKeyProperty.columnName.UTF8String : "";
-    for (RLMProperty *prop in _properties) {
-        Property p = [prop objectStoreCopy:schema];
-        p.is_primary = (prop == _primaryKeyProperty);
-        objectSchema.persisted_properties.push_back(std::move(p));
-    }
-    for (RLMProperty *prop in _computedProperties) {
-        objectSchema.computed_properties.push_back([prop objectStoreCopy:schema]);
-    }
-    return objectSchema;
-}
-
-+ (instancetype)objectSchemaForObjectStoreSchema:(realm::ObjectSchema const&)objectSchema {
-    RLMObjectSchema *schema = [RLMObjectSchema new];
-    schema.className = @(objectSchema.name.c_str());
-
-    // create array of RLMProperties
-    NSMutableArray *properties = [NSMutableArray arrayWithCapacity:objectSchema.persisted_properties.size()];
-    for (const Property &prop : objectSchema.persisted_properties) {
-        RLMProperty *property = [RLMProperty propertyForObjectStoreProperty:prop];
-        property.isPrimary = (prop.name == objectSchema.primary_key);
-        [properties addObject:property];
-    }
-    schema.properties = properties;
-
-    NSMutableArray *computedProperties = [NSMutableArray arrayWithCapacity:objectSchema.computed_properties.size()];
-    for (const Property &prop : objectSchema.computed_properties) {
-        [computedProperties addObject:[RLMProperty propertyForObjectStoreProperty:prop]];
-    }
-    schema.computedProperties = computedProperties;
-
-    // get primary key from realm metadata
-    if (objectSchema.primary_key.length()) {
-        NSString *primaryKeyString = [NSString stringWithUTF8String:objectSchema.primary_key.c_str()];
-        schema.primaryKeyProperty = schema[primaryKeyString];
-        if (!schema.primaryKeyProperty) {
-            @throw RLMException(@"No property matching primary key '%@'", primaryKeyString);
-        }
-    }
-
-    // for dynamic schema use vanilla RLMDynamicObject accessor classes
-    schema.objectClass = RLMObject.class;
-    schema.accessorClass = RLMDynamicObject.class;
-    schema.unmanagedClass = RLMObject.class;
-
-    return schema;
-}
-
-- (NSArray *)swiftGenericProperties {
-    if (_swiftGenericProperties) {
-        return _swiftGenericProperties;
-    }
-
-    // Check if it's a swift class using the obj-c API
-    static Class s_swiftObjectClass = NSClassFromString(@"RealmSwiftObject");
-    if (![_accessorClass isSubclassOfClass:s_swiftObjectClass]) {
-        return _swiftGenericProperties = @[];
-    }
-
-    NSMutableArray *genericProperties = [NSMutableArray new];
-    for (RLMProperty *prop in _properties) {
-        if (prop->_swiftIvar) {
-            [genericProperties addObject:prop];
-        }
-    }
-    // Currently all computed properties are Swift generics
-    [genericProperties addObjectsFromArray:_computedProperties];
-
-    return _swiftGenericProperties = genericProperties;
-}
-
-@end

+ 0 - 71
Carthage/Checkouts/realm-cocoa/Realm/RLMObjectSchema_Private.h

@@ -1,71 +0,0 @@
-////////////////////////////////////////////////////////////////////////////
-//
-// Copyright 2014 Realm Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////
-
-#import <Realm/RLMObjectSchema.h>
-
-#import <objc/runtime.h>
-
-NS_ASSUME_NONNULL_BEGIN
-
-// RLMObjectSchema private
-@interface RLMObjectSchema () {
-@public
-    bool _isSwiftClass;
-}
-
-/// The object type name reported to the object store and core.
-@property (nonatomic, readonly) NSString *objectName;
-
-// writable redeclaration
-@property (nonatomic, readwrite, copy) NSArray<RLMProperty *> *properties;
-@property (nonatomic, readwrite, assign) bool isSwiftClass;
-
-// class used for this object schema
-@property (nonatomic, readwrite, assign) Class objectClass;
-@property (nonatomic, readwrite, assign) Class accessorClass;
-@property (nonatomic, readwrite, assign) Class unmanagedClass;
-
-@property (nonatomic, readwrite, nullable) RLMProperty *primaryKeyProperty;
-
-@property (nonatomic, copy) NSArray<RLMProperty *> *computedProperties;
-@property (nonatomic, readonly) NSArray<RLMProperty *> *swiftGenericProperties;
-
-// returns a cached or new schema for a given object class
-+ (instancetype)schemaForObjectClass:(Class)objectClass;
-@end
-
-@interface RLMObjectSchema (Dynamic)
-/**
- This method is useful only in specialized circumstances, for example, when accessing objects
- in a Realm produced externally. If you are simply building an app on Realm, it is not recommended
- to use this method as an [RLMObjectSchema](RLMObjectSchema) is generated automatically for every [RLMObject](RLMObject) subclass.
-
- Initialize an RLMObjectSchema with classname, objectClass, and an array of properties
-
- @warning This method is useful only in specialized circumstances.
-
- @param objectClassName     The name of the class used to refer to objects of this type.
- @param objectClass         The Objective-C class used when creating instances of this type.
- @param properties          An array of RLMProperty instances describing the managed properties for this type.
-
- @return    An initialized instance of RLMObjectSchema.
- */
-- (instancetype)initWithClassName:(NSString *)objectClassName objectClass:(Class)objectClass properties:(NSArray *)properties;
-@end
-
-NS_ASSUME_NONNULL_END

+ 0 - 32
Carthage/Checkouts/realm-cocoa/Realm/RLMObjectSchema_Private.hpp

@@ -1,32 +0,0 @@
-////////////////////////////////////////////////////////////////////////////
-//
-// Copyright 2014 Realm Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////
-
-#import "RLMObjectSchema_Private.h"
-
-namespace realm {
-    class ObjectSchema;
-}
-@class RLMSchema;
-
-@interface RLMObjectSchema ()
-// create realm::ObjectSchema copy
-- (realm::ObjectSchema)objectStoreCopy:(RLMSchema *)schema;
-
-// initialize with realm::ObjectSchema
-+ (instancetype)objectSchemaForObjectStoreSchema:(realm::ObjectSchema const&)objectSchema;
-@end

+ 0 - 92
Carthage/Checkouts/realm-cocoa/Realm/RLMObjectStore.h

@@ -1,92 +0,0 @@
-////////////////////////////////////////////////////////////////////////////
-//
-// Copyright 2014 Realm Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////
-
-#import <Foundation/Foundation.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-@class RLMRealm, RLMSchema, RLMObjectBase, RLMResults, RLMProperty;
-
-typedef NS_ENUM(NSUInteger, RLMUpdatePolicy) {
-    RLMUpdatePolicyError = 1,
-    RLMUpdatePolicyUpdateChanged = 3,
-    RLMUpdatePolicyUpdateAll = 2,
-};
-
-NS_ASSUME_NONNULL_BEGIN
-
-void RLMVerifyHasPrimaryKey(Class cls);
-
-//
-// Accessor Creation
-//
-
-// create or get cached accessors for the given schema
-void RLMRealmCreateAccessors(RLMSchema *schema);
-
-
-//
-// Adding, Removing, Getting Objects
-//
-
-// add an object to the given realm
-void RLMAddObjectToRealm(RLMObjectBase *object, RLMRealm *realm, RLMUpdatePolicy);
-
-// delete an object from its realm
-void RLMDeleteObjectFromRealm(RLMObjectBase *object, RLMRealm *realm);
-
-// deletes all objects from a realm
-void RLMDeleteAllObjectsFromRealm(RLMRealm *realm);
-
-// get objects of a given class
-RLMResults *RLMGetObjects(RLMRealm *realm, NSString *objectClassName, NSPredicate * _Nullable predicate)
-NS_RETURNS_RETAINED;
-
-// get an object with the given primary key
-id _Nullable RLMGetObject(RLMRealm *realm, NSString *objectClassName, id _Nullable key) NS_RETURNS_RETAINED;
-
-// create object from array or dictionary
-RLMObjectBase *RLMCreateObjectInRealmWithValue(RLMRealm *realm, NSString *className,
-                                               id _Nullable value, RLMUpdatePolicy updatePolicy)
-NS_RETURNS_RETAINED;
-
-//
-// Accessor Creation
-//
-
-
-// switch List<> properties from being backed by unmanaged RLMArrays to RLMManagedArray
-void RLMInitializeSwiftAccessorGenerics(RLMObjectBase *object);
-
-#ifdef __cplusplus
-}
-
-namespace realm {
-    class Table;
-    class Obj;
-}
-class RLMClassInfo;
-
-// Create accessors
-RLMObjectBase *RLMCreateObjectAccessor(RLMClassInfo& info, int64_t key) NS_RETURNS_RETAINED;
-RLMObjectBase *RLMCreateObjectAccessor(RLMClassInfo& info, realm::Obj&& obj) NS_RETURNS_RETAINED;
-#endif
-
-NS_ASSUME_NONNULL_END

+ 0 - 278
Carthage/Checkouts/realm-cocoa/Realm/RLMObjectStore.mm

@@ -1,278 +0,0 @@
-////////////////////////////////////////////////////////////////////////////
-//
-// Copyright 2014 Realm Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////
-
-#import "RLMObjectStore.h"
-
-#import "RLMAccessor.hpp"
-#import "RLMArray_Private.hpp"
-#import "RLMListBase.h"
-#import "RLMObservation.hpp"
-#import "RLMObject_Private.hpp"
-#import "RLMObjectSchema_Private.hpp"
-#import "RLMOptionalBase.h"
-#import "RLMProperty_Private.h"
-#import "RLMQueryUtil.hpp"
-#import "RLMRealm_Private.hpp"
-#import "RLMSchema_Private.h"
-#import "RLMSwiftSupport.h"
-#import "RLMUtil.hpp"
-
-#import "object_store.hpp"
-#import "results.hpp"
-#import "shared_realm.hpp"
-
-#import <realm/group.hpp>
-
-#import <objc/message.h>
-
-using namespace realm;
-
-static_assert(RLMUpdatePolicyError == static_cast<int>(CreatePolicy::ForceCreate), "");
-static_assert(RLMUpdatePolicyUpdateAll == static_cast<int>(CreatePolicy::UpdateAll), "");
-static_assert(RLMUpdatePolicyUpdateChanged == static_cast<int>(CreatePolicy::UpdateModified), "");
-
-void RLMRealmCreateAccessors(RLMSchema *schema) {
-    const size_t bufferSize = sizeof("RLM:Managed  ") // includes null terminator
-                            + std::numeric_limits<unsigned long long>::digits10
-                            + realm::Group::max_table_name_length;
-
-    char className[bufferSize] = "RLM:Managed ";
-    char *const start = className + strlen(className);
-
-    for (RLMObjectSchema *objectSchema in schema.objectSchema) {
-        if (objectSchema.accessorClass != objectSchema.objectClass) {
-            continue;
-        }
-
-        static unsigned long long count = 0;
-        sprintf(start, "%llu %s", count++, objectSchema.className.UTF8String);
-        objectSchema.accessorClass = RLMManagedAccessorClassForObjectClass(objectSchema.objectClass, objectSchema, className);
-    }
-}
-
-static inline void RLMVerifyRealmRead(__unsafe_unretained RLMRealm *const realm) {
-    if (!realm) {
-        @throw RLMException(@"Realm must not be nil");
-    }
-    [realm verifyThread];
-    if (realm->_realm->is_closed()) {
-        // This message may seem overly specific, but frozen Realms are currently
-        // the only ones which we outright close.
-        @throw RLMException(@"Cannot read from a frozen Realm which has been invalidated.");
-    }
-}
-
-static inline void RLMVerifyInWriteTransaction(__unsafe_unretained RLMRealm *const realm) {
-    RLMVerifyRealmRead(realm);
-    // if realm is not writable throw
-    if (!realm.inWriteTransaction) {
-        @throw RLMException(@"Can only add, remove, or create objects in a Realm in a write transaction - call beginWriteTransaction on an RLMRealm instance first.");
-    }
-}
-
-void RLMInitializeSwiftAccessorGenerics(__unsafe_unretained RLMObjectBase *const object) {
-    if (!object || !object->_row || !object->_objectSchema->_isSwiftClass) {
-        return;
-    }
-    if (![object isKindOfClass:object->_objectSchema.objectClass]) {
-        // It can be a different class if it's a dynamic object, and those don't
-        // require any init here (and would crash since they don't have the ivars)
-        return;
-    }
-
-    for (RLMProperty *prop in object->_objectSchema.swiftGenericProperties) {
-        if (prop.type == RLMPropertyTypeLinkingObjects) {
-            [prop.swiftAccessor initializeObject:(char *)(__bridge void *)object + ivar_getOffset(prop.swiftIvar)
-                                          parent:object property:prop];
-        }
-        else if (prop.array) {
-            id ivar = object_getIvar(object, prop.swiftIvar);
-            RLMArray *array = [[RLMManagedArray alloc] initWithParent:object property:prop];
-            [ivar set_rlmArray:array];
-        }
-        else {
-            id ivar = object_getIvar(object, prop.swiftIvar);
-            RLMInitializeManagedOptional(ivar, object, prop);
-        }
-    }
-}
-
-void RLMVerifyHasPrimaryKey(Class cls) {
-    RLMObjectSchema *schema = [cls sharedSchema];
-    if (!schema.primaryKeyProperty) {
-        NSString *reason = [NSString stringWithFormat:@"'%@' does not have a primary key and can not be updated", schema.className];
-        @throw [NSException exceptionWithName:@"RLMException" reason:reason userInfo:nil];
-    }
-}
-
-void RLMAddObjectToRealm(__unsafe_unretained RLMObjectBase *const object,
-                         __unsafe_unretained RLMRealm *const realm,
-                         RLMUpdatePolicy updatePolicy) {
-    RLMVerifyInWriteTransaction(realm);
-
-    // verify that object is unmanaged
-    if (object.invalidated) {
-        @throw RLMException(@"Adding a deleted or invalidated object to a Realm is not permitted");
-    }
-    if (object->_realm) {
-        if (object->_realm == realm) {
-            // Adding an object to the Realm it's already manged by is a no-op
-            return;
-        }
-        // for differing realms users must explicitly create the object in the second realm
-        @throw RLMException(@"Object is already managed by another Realm. Use create instead to copy it into this Realm.");
-    }
-    if (object->_observationInfo && object->_observationInfo->hasObservers()) {
-        @throw RLMException(@"Cannot add an object with observers to a Realm");
-    }
-
-    auto& info = realm->_info[object->_objectSchema.className];
-    RLMAccessorContext c{info, true};
-    object->_info = &info;
-    object->_realm = realm;
-    object->_objectSchema = info.rlmObjectSchema;
-    try {
-        realm::Object::create(c, realm->_realm, *info.objectSchema, (id)object,
-                              static_cast<CreatePolicy>(updatePolicy),
-                              {}, &object->_row);
-    }
-    catch (std::exception const& e) {
-        @throw RLMException(e);
-    }
-    object_setClass(object, info.rlmObjectSchema.accessorClass);
-    RLMInitializeSwiftAccessorGenerics(object);
-}
-
-RLMObjectBase *RLMCreateObjectInRealmWithValue(RLMRealm *realm, NSString *className,
-                                               id value, RLMUpdatePolicy updatePolicy) {
-    RLMVerifyInWriteTransaction(realm);
-
-    if (updatePolicy != RLMUpdatePolicyError && RLMIsObjectSubclass([value class])) {
-        RLMObjectBase *obj = value;
-        if (obj->_realm == realm && [obj->_objectSchema.className isEqualToString:className]) {
-            // This is a no-op if value is an RLMObject of the same type already backed by the target realm.
-            return value;
-        }
-    }
-
-    if (!value || value == NSNull.null) {
-        @throw RLMException(@"Must provide a non-nil value.");
-    }
-
-    auto& info = realm->_info[className];
-    if ([value isKindOfClass:[NSArray class]] && [value count] > info.objectSchema->persisted_properties.size()) {
-        @throw RLMException(@"Invalid array input: more values (%llu) than properties (%llu).",
-                            (unsigned long long)[value count],
-                            (unsigned long long)info.objectSchema->persisted_properties.size());
-    }
-
-    RLMAccessorContext c{info, false};
-    RLMObjectBase *object = RLMCreateManagedAccessor(info.rlmObjectSchema.accessorClass, &info);
-    try {
-        object->_row = realm::Object::create(c, realm->_realm, *info.objectSchema, (id)value,
-                                             static_cast<CreatePolicy>(updatePolicy)).obj();
-    }
-    catch (std::exception const& e) {
-        @throw RLMException(e);
-    }
-    RLMInitializeSwiftAccessorGenerics(object);
-    return object;
-}
-
-void RLMDeleteObjectFromRealm(__unsafe_unretained RLMObjectBase *const object,
-                              __unsafe_unretained RLMRealm *const realm) {
-    if (realm != object->_realm) {
-        @throw RLMException(@"Can only delete an object from the Realm it belongs to.");
-    }
-
-    RLMVerifyInWriteTransaction(object->_realm);
-
-    // move last row to row we are deleting
-    if (object->_row.is_valid()) {
-        RLMTrackDeletions(realm, ^{
-            object->_row.remove();
-        });
-    }
-
-    // set realm to nil
-    object->_realm = nil;
-}
-
-void RLMDeleteAllObjectsFromRealm(RLMRealm *realm) {
-    RLMVerifyInWriteTransaction(realm);
-
-    // clear table for each object schema
-    for (auto& info : realm->_info) {
-        RLMClearTable(info.second);
-    }
-}
-
-RLMResults *RLMGetObjects(__unsafe_unretained RLMRealm *const realm,
-                          NSString *objectClassName,
-                          NSPredicate *predicate) {
-    RLMVerifyRealmRead(realm);
-
-    // create view from table and predicate
-    RLMClassInfo& info = realm->_info[objectClassName];
-    if (!info.table()) {
-        // read-only realms may be missing tables since we can't add any
-        // missing ones on init
-        return [RLMResults resultsWithObjectInfo:info results:{}];
-    }
-
-    if (predicate) {
-        realm::Query query = RLMPredicateToQuery(predicate, info.rlmObjectSchema, realm.schema, realm.group);
-        return [RLMResults resultsWithObjectInfo:info
-                                         results:realm::Results(realm->_realm, std::move(query))];
-    }
-
-    return [RLMResults resultsWithObjectInfo:info
-                                     results:realm::Results(realm->_realm, info.table())];
-}
-
-id RLMGetObject(RLMRealm *realm, NSString *objectClassName, id key) {
-    RLMVerifyRealmRead(realm);
-
-    auto& info = realm->_info[objectClassName];
-    if (RLMProperty *prop = info.propertyForPrimaryKey()) {
-        RLMValidateValueForProperty(key, info.rlmObjectSchema, prop);
-    }
-    try {
-        RLMAccessorContext c{info};
-        auto obj = realm::Object::get_for_primary_key(c, realm->_realm, *info.objectSchema,
-                                                      key ?: NSNull.null);
-        if (!obj.is_valid())
-            return nil;
-        return RLMCreateObjectAccessor(info, obj.obj());
-    }
-    catch (std::exception const& e) {
-        @throw RLMException(e);
-    }
-}
-
-RLMObjectBase *RLMCreateObjectAccessor(RLMClassInfo& info, int64_t key) {
-    return RLMCreateObjectAccessor(info, info.table()->get_object(realm::ObjKey(key)));
-}
-
-// Create accessor and register with realm
-RLMObjectBase *RLMCreateObjectAccessor(RLMClassInfo& info, realm::Obj&& obj) {
-    RLMObjectBase *accessor = RLMCreateManagedAccessor(info.rlmObjectSchema.accessorClass, &info);
-    accessor->_row = std::move(obj);
-    RLMInitializeSwiftAccessorGenerics(accessor);
-    return accessor;
-}

+ 0 - 83
Carthage/Checkouts/realm-cocoa/Realm/RLMObject_Private.h

@@ -1,83 +0,0 @@
-////////////////////////////////////////////////////////////////////////////
-//
-// Copyright 2014 Realm Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////
-
-#import <Realm/RLMObjectBase_Dynamic.h>
-
-NS_ASSUME_NONNULL_BEGIN
-
-@class RLMProperty, RLMArray;
-typedef NS_ENUM(int32_t, RLMPropertyType);
-
-FOUNDATION_EXTERN void RLMInitializeWithValue(RLMObjectBase *, id, RLMSchema *);
-
-// RLMObject accessor and read/write realm
-@interface RLMObjectBase () {
-@public
-    RLMRealm *_realm;
-    __unsafe_unretained RLMObjectSchema *_objectSchema;
-}
-
-// shared schema for this class
-+ (nullable RLMObjectSchema *)sharedSchema;
-
-+ (nullable NSArray<RLMProperty *> *)_getPropertiesWithInstance:(id)obj;
-+ (bool)_realmIgnoreClass;
-
-@end
-
-@interface RLMDynamicObject : RLMObject
-
-@end
-
-// Calls valueForKey: and re-raises NSUndefinedKeyExceptions
-FOUNDATION_EXTERN id _Nullable RLMValidatedValueForProperty(id object, NSString *key, NSString *className);
-
-// Compare two RLObjectBases
-FOUNDATION_EXTERN BOOL RLMObjectBaseAreEqual(RLMObjectBase * _Nullable o1, RLMObjectBase * _Nullable o2);
-
-typedef void (^RLMObjectNotificationCallback)(RLMObjectBase *_Nullable object,
-                                              NSArray<NSString *> *_Nullable propertyNames,
-                                              NSArray *_Nullable oldValues,
-                                              NSArray *_Nullable newValues,
-                                              NSError *_Nullable error);
-FOUNDATION_EXTERN RLMNotificationToken *RLMObjectBaseAddNotificationBlock(RLMObjectBase *obj,
-                                                                          dispatch_queue_t _Nullable queue,
-                                                                          RLMObjectNotificationCallback block);
-RLMNotificationToken *RLMObjectAddNotificationBlock(RLMObjectBase *obj, RLMObjectChangeBlock block,
-                                                    dispatch_queue_t _Nullable queue);
-
-// Returns whether the class is a descendent of RLMObjectBase
-FOUNDATION_EXTERN BOOL RLMIsObjectOrSubclass(Class klass);
-
-// Returns whether the class is an indirect descendant of RLMObjectBase
-FOUNDATION_EXTERN BOOL RLMIsObjectSubclass(Class klass);
-
-FOUNDATION_EXTERN const NSUInteger RLMDescriptionMaxDepth;
-
-FOUNDATION_EXTERN id RLMObjectFreeze(RLMObjectBase *obj) NS_RETURNS_RETAINED;
-
-// Gets an object identifier suitable for use with Combine. This value may
-// change when an unmanaged object is added to the Realm.
-FOUNDATION_EXTERN uint64_t RLMObjectBaseGetCombineId(RLMObjectBase *);
-
-@interface RLMManagedPropertyAccessor : NSObject
-+ (void)initializeObject:(void *)object parent:(RLMObjectBase *)parent property:(RLMProperty *)property;
-+ (id)get:(void *)pointer;
-@end
-
-NS_ASSUME_NONNULL_END

+ 0 - 55
Carthage/Checkouts/realm-cocoa/Realm/RLMObject_Private.hpp

@@ -1,55 +0,0 @@
-////////////////////////////////////////////////////////////////////////////
-//
-// Copyright 2014 Realm Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////
-
-#import "RLMObject_Private.h"
-
-#import "RLMRealm_Private.hpp"
-#import "RLMUtil.hpp"
-
-#import <realm/obj.hpp>
-
-class RLMObservationInfo;
-
-// RLMObject accessor and read/write realm
-@interface RLMObjectBase () {
-    @public
-    realm::Obj _row;
-    RLMObservationInfo *_observationInfo;
-    RLMClassInfo *_info;
-}
-@end
-
-id RLMCreateManagedAccessor(Class cls, RLMClassInfo *info) NS_RETURNS_RETAINED;
-
-// throw an exception if the object is invalidated or on the wrong thread
-static inline void RLMVerifyAttached(__unsafe_unretained RLMObjectBase *const obj) {
-    if (!obj->_row.is_valid()) {
-        @throw RLMException(@"Object has been deleted or invalidated.");
-    }
-    [obj->_realm verifyThread];
-}
-
-// throw an exception if the object can't be modified for any reason
-static inline void RLMVerifyInWriteTransaction(__unsafe_unretained RLMObjectBase *const obj) {
-    // first verify is attached
-    RLMVerifyAttached(obj);
-
-    if (!obj->_realm.inWriteTransaction) {
-        @throw RLMException(@"Attempting to modify object outside of a write transaction - call beginWriteTransaction on an RLMRealm instance first.");
-    }
-}

+ 0 - 153
Carthage/Checkouts/realm-cocoa/Realm/RLMObservation.hpp

@@ -1,153 +0,0 @@
-////////////////////////////////////////////////////////////////////////////
-//
-// Copyright 2015 Realm Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////
-
-#import <Foundation/Foundation.h>
-
-#import "binding_context.hpp"
-
-#import <realm/obj.hpp>
-#import <realm/table.hpp>
-
-#import <unordered_map>
-
-@class RLMObjectBase, RLMRealm, RLMSchema, RLMProperty, RLMObjectSchema;
-class RLMClassInfo;
-class RLMSchemaInfo;
-
-namespace realm {
-    class History;
-    class SharedGroup;
-}
-
-// RLMObservationInfo stores all of the KVO-related data for RLMObjectBase and
-// RLMArray. There is a one-to-one relationship between observed objects and
-// RLMObservationInfo instances, so it could be folded into RLMObjectBase, and
-// is a separate class mostly to avoid making all accessor objects far larger.
-//
-// RLMClassInfo stores a vector of pointers to the first observation info
-// created for each row. If there are multiple observation infos for a single
-// row (such as if there are multiple observed objects backed by a single row,
-// or if both an object and an array property of that object are observed),
-// they're stored in an intrusive doubly-linked-list in the `next` and `prev`
-// members. This is done primarily to make it simpler and faster to loop over
-// all of the observed objects for a single row, as that needs to be done for
-// every change.
-class RLMObservationInfo {
-public:
-    RLMObservationInfo(id object);
-    RLMObservationInfo(RLMClassInfo &objectSchema, realm::ObjKey row, id object);
-    ~RLMObservationInfo();
-
-    realm::ConstObj const& getRow() const {
-        return row;
-    }
-
-    NSString *columnName(realm::ColKey col) const noexcept;
-
-    // Send willChange/didChange notifications to all observers for this object/row
-    // Sends the array versions if indexes is non-nil, normal versions otherwise
-    void willChange(NSString *key, NSKeyValueChange kind=NSKeyValueChangeSetting, NSIndexSet *indexes=nil) const;
-    void didChange(NSString *key, NSKeyValueChange kind=NSKeyValueChangeSetting, NSIndexSet *indexes=nil) const;
-
-    bool isForRow(realm::ObjKey key) const {
-        return row.get_key() == key;
-    }
-
-    void recordObserver(realm::Obj& row, RLMClassInfo *objectInfo, RLMObjectSchema *objectSchema, NSString *keyPath);
-    void removeObserver();
-    bool hasObservers() const { return observerCount > 0; }
-
-    // valueForKey: on observed object and array properties needs to return the
-    // same object each time for KVO to work at all. Doing this all the time
-    // requires some odd semantics to avoid reference cycles, so instead we do
-    // it only to the extent specifically required by KVO. In addition, we
-    // need to continue to return the same object even if this row is deleted,
-    // or deleting an object with active observers will explode horribly.
-    // Once prepareForInvalidation() is called, valueForKey() will always return
-    // the cached value for object and array properties without checking the
-    // backing row to verify it's up-to-date.
-    //
-    // prepareForInvalidation() must be called on the head of the linked list
-    // (i.e. on the object pointed to directly by the object schema)
-    id valueForKey(NSString *key);
-
-    void prepareForInvalidation();
-
-private:
-    // Doubly-linked-list of observed objects for the same row as this
-    RLMObservationInfo *next = nullptr;
-    RLMObservationInfo *prev = nullptr;
-
-    // Row being observed
-    realm::ConstObj row;
-    RLMClassInfo *objectSchema = nullptr;
-
-    // Object doing the observing
-    __unsafe_unretained id object = nil;
-
-    // valueForKey: hack
-    bool invalidated = false;
-    size_t observerCount = 0;
-    NSString *lastKey = nil;
-    __unsafe_unretained RLMProperty *lastProp = nil;
-
-    // objects returned from valueForKey() to keep them alive in case observers
-    // are added and so that they can still be accessed after row is detached
-    NSMutableDictionary *cachedObjects;
-
-    void setRow(realm::Table const& table, realm::ObjKey newRow);
-
-    template<typename F>
-    void forEach(F&& f) const {
-        // The user's observation handler may release their last reference to
-        // the object being observed, which will result in the RLMObservationInfo
-        // being destroyed. As a result, we need to retain the object which owns
-        // both `this` and the current info we're looking at.
-        __attribute__((objc_precise_lifetime)) id self = object, current;
-        for (auto info = prev; info; info = info->prev) {
-            current = info->object;
-            f(info->object);
-        }
-        for (auto info = this; info; info = info->next) {
-            current = info->object;
-            f(info->object);
-        }
-    }
-
-    // Default move/copy constructors don't work due to the intrusive linked
-    // list and we don't need them
-    RLMObservationInfo(RLMObservationInfo const&) = delete;
-    RLMObservationInfo(RLMObservationInfo&&) = delete;
-    RLMObservationInfo& operator=(RLMObservationInfo const&) = delete;
-    RLMObservationInfo& operator=(RLMObservationInfo&&) = delete;
-};
-
-// Get the the observation info chain for the given row
-// Will simply return info if it's non-null, and will search ojectSchema's array
-// for a matching one otherwise, and return null if there are none
-RLMObservationInfo *RLMGetObservationInfo(RLMObservationInfo *info, realm::ObjKey row, RLMClassInfo& objectSchema);
-
-// delete all objects from a single table with change notifications
-void RLMClearTable(RLMClassInfo &realm);
-
-// invoke the block, sending notifications for cascading deletes/link nullifications
-void RLMTrackDeletions(RLMRealm *realm, dispatch_block_t block);
-
-std::vector<realm::BindingContext::ObserverState> RLMGetObservedRows(RLMSchemaInfo const& schema);
-void RLMWillChange(std::vector<realm::BindingContext::ObserverState> const& observed, std::vector<void *> const& invalidated);
-void RLMDidChange(std::vector<realm::BindingContext::ObserverState> const& observed, std::vector<void *> const& invalidated);

+ 0 - 523
Carthage/Checkouts/realm-cocoa/Realm/RLMObservation.mm

@@ -1,523 +0,0 @@
-////////////////////////////////////////////////////////////////////////////
-//
-// Copyright 2015 Realm Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////
-
-#import "RLMObservation.hpp"
-
-#import "RLMAccessor.h"
-#import "RLMArray_Private.hpp"
-#import "RLMListBase.h"
-#import "RLMObjectSchema_Private.hpp"
-#import "RLMObject_Private.hpp"
-#import "RLMProperty_Private.h"
-#import "RLMRealm_Private.hpp"
-
-#import <realm/group.hpp>
-
-using namespace realm;
-
-namespace {
-    template<typename Iterator>
-    struct IteratorPair {
-        Iterator first;
-        Iterator second;
-    };
-    template<typename Iterator>
-    Iterator begin(IteratorPair<Iterator> const& p) {
-        return p.first;
-    }
-    template<typename Iterator>
-    Iterator end(IteratorPair<Iterator> const& p) {
-        return p.second;
-    }
-
-    template<typename Container>
-    auto reverse(Container const& c) {
-        return IteratorPair<typename Container::const_reverse_iterator>{c.rbegin(), c.rend()};
-    }
-}
-
-RLMObservationInfo::RLMObservationInfo(RLMClassInfo &objectSchema, realm::ObjKey row, id object)
-: object(object)
-, objectSchema(&objectSchema)
-{
-    setRow(*objectSchema.table(), row);
-}
-
-RLMObservationInfo::RLMObservationInfo(id object)
-: object(object)
-{
-}
-
-RLMObservationInfo::~RLMObservationInfo() {
-    if (prev) {
-        // Not the head of the linked list, so just detach from the list
-        REALM_ASSERT_DEBUG(prev->next == this);
-        prev->next = next;
-        if (next) {
-            REALM_ASSERT_DEBUG(next->prev == this);
-            next->prev = prev;
-        }
-    }
-    else if (objectSchema) {
-        // The head of the list, so remove self from the object schema's array
-        // of observation info, either replacing self with the next info or
-        // removing entirely if there is no next
-        auto end = objectSchema->observedObjects.end();
-        auto it = find(objectSchema->observedObjects.begin(), end, this);
-        if (it != end) {
-            if (next) {
-                *it = next;
-                next->prev = nullptr;
-            }
-            else {
-                iter_swap(it, std::prev(end));
-                objectSchema->observedObjects.pop_back();
-            }
-        }
-    }
-    // Otherwise the observed object was unmanaged, so nothing to do
-
-#ifdef DEBUG
-    // ensure that incorrect cleanup fails noisily
-    object = (__bridge id)(void *)-1;
-    prev = (RLMObservationInfo *)-1;
-    next = (RLMObservationInfo *)-1;
-#endif
-}
-
-NSString *RLMObservationInfo::columnName(realm::ColKey col) const noexcept {
-    return objectSchema->propertyForTableColumn(col).name;
-}
-
-void RLMObservationInfo::willChange(NSString *key, NSKeyValueChange kind, NSIndexSet *indexes) const {
-    if (indexes) {
-        forEach([=](__unsafe_unretained auto o) {
-            [o willChange:kind valuesAtIndexes:indexes forKey:key];
-        });
-    }
-    else {
-        forEach([=](__unsafe_unretained auto o) {
-            [o willChangeValueForKey:key];
-        });
-    }
-}
-
-void RLMObservationInfo::didChange(NSString *key, NSKeyValueChange kind, NSIndexSet *indexes) const {
-    if (indexes) {
-        forEach([=](__unsafe_unretained auto o) {
-            [o didChange:kind valuesAtIndexes:indexes forKey:key];
-        });
-    }
-    else {
-        forEach([=](__unsafe_unretained auto o) {
-            [o didChangeValueForKey:key];
-        });
-    }
-}
-
-void RLMObservationInfo::prepareForInvalidation() {
-    REALM_ASSERT_DEBUG(objectSchema);
-    REALM_ASSERT_DEBUG(!prev);
-    for (auto info = this; info; info = info->next)
-        info->invalidated = true;
-}
-
-void RLMObservationInfo::setRow(realm::Table const& table, realm::ObjKey key) {
-    REALM_ASSERT_DEBUG(!row);
-    REALM_ASSERT_DEBUG(objectSchema);
-    row = table.get_object(key);
-    for (auto info : objectSchema->observedObjects) {
-        if (info->row && info->row.get_key() == key) {
-            prev = info;
-            next = info->next;
-            if (next)
-                next->prev = this;
-            info->next = this;
-            return;
-        }
-    }
-    objectSchema->observedObjects.push_back(this);
-}
-
-void RLMObservationInfo::recordObserver(realm::Obj& objectRow, RLMClassInfo *objectInfo,
-                                        __unsafe_unretained RLMObjectSchema *const objectSchema,
-                                        __unsafe_unretained NSString *const keyPath) {
-    ++observerCount;
-    if (row) {
-        return;
-    }
-
-    // add ourselves to the list of observed objects if this is the first time
-    // an observer is being added to a managed object
-    if (objectRow) {
-        this->objectSchema = objectInfo;
-        setRow(*objectRow.get_table(), objectRow.get_key());
-        return;
-    }
-
-    // Arrays need a reference to their containing object to avoid having to
-    // go through the awful proxy object from mutableArrayValueForKey.
-    // For managed objects we do this when the object is added or created
-    // (and have to to support notifications from modifying an object which
-    // was never observed), but for Swift classes (both RealmSwift and
-    // RLMObject) we can't do it then because we don't know what the parent
-    // object is.
-
-    NSUInteger sep = [keyPath rangeOfString:@"."].location;
-    NSString *key = sep == NSNotFound ? keyPath : [keyPath substringToIndex:sep];
-    RLMProperty *prop = objectSchema[key];
-    if (prop && prop.array) {
-        id value = valueForKey(key);
-        RLMArray *array = [value isKindOfClass:[RLMListBase class]] ? [value _rlmArray] : value;
-        array->_key = key;
-        array->_parentObject = object;
-    }
-    else if (auto swiftIvar = prop.swiftIvar) {
-        if (auto optional = RLMDynamicCast<RLMOptionalBase>(object_getIvar(object, swiftIvar))) {
-            RLMInitializeUnmanagedOptional(optional, object, prop);
-        }
-    }
-}
-
-void RLMObservationInfo::removeObserver() {
-    --observerCount;
-}
-
-id RLMObservationInfo::valueForKey(NSString *key) {
-    if (invalidated) {
-        if ([key isEqualToString:RLMInvalidatedKey]) {
-            return @YES;
-        }
-        return cachedObjects[key];
-    }
-
-    if (key != lastKey) {
-        lastKey = key;
-        lastProp = objectSchema ? objectSchema->rlmObjectSchema[key] : nil;
-    }
-
-    static auto superValueForKey = reinterpret_cast<id(*)(id, SEL, NSString *)>([NSObject methodForSelector:@selector(valueForKey:)]);
-    if (!lastProp) {
-        // Not a managed property, so use NSObject's implementation of valueForKey:
-        return RLMCoerceToNil(superValueForKey(object, @selector(valueForKey:), key));
-    }
-
-    auto getSuper = [&] {
-        return row ? RLMDynamicGet(object, lastProp) : RLMCoerceToNil(superValueForKey(object, @selector(valueForKey:), key));
-    };
-
-    // We need to return the same object each time for observing over keypaths
-    // to work, so we store a cache of them here. We can't just cache them on
-    // the object as that leads to retain cycles.
-    if (lastProp.array) {
-        RLMArray *value = cachedObjects[key];
-        if (!value) {
-            value = getSuper();
-            if (!cachedObjects) {
-                cachedObjects = [NSMutableDictionary new];
-            }
-            cachedObjects[key] = value;
-        }
-        return value;
-    }
-
-    if (lastProp.type == RLMPropertyTypeObject) {
-        auto col = row.get_table()->get_column_key(lastProp.name.UTF8String);
-        if (row.is_null(col)) {
-            [cachedObjects removeObjectForKey:key];
-            return nil;
-        }
-
-        RLMObjectBase *value = cachedObjects[key];
-        if (value && value->_row.get_key() == row.get<realm::ObjKey>(col)) {
-            return value;
-        }
-        value = getSuper();
-        if (!cachedObjects) {
-            cachedObjects = [NSMutableDictionary new];
-        }
-        cachedObjects[key] = value;
-        return value;
-    }
-
-    return getSuper();
-}
-
-RLMObservationInfo *RLMGetObservationInfo(RLMObservationInfo *info, realm::ObjKey row,
-                                          RLMClassInfo& objectSchema) {
-    if (info) {
-        return info;
-    }
-
-    for (RLMObservationInfo *info : objectSchema.observedObjects) {
-        if (info->isForRow(row)) {
-            return info;
-        }
-    }
-
-    return nullptr;
-}
-
-void RLMClearTable(RLMClassInfo &objectSchema) {
-    for (auto info : objectSchema.observedObjects) {
-        info->willChange(RLMInvalidatedKey);
-    }
-
-    RLMTrackDeletions(objectSchema.realm, ^{
-        Results(objectSchema.realm->_realm, objectSchema.table()).clear();
-
-        for (auto info : objectSchema.observedObjects) {
-            info->prepareForInvalidation();
-        }
-    });
-
-    for (auto info : reverse(objectSchema.observedObjects)) {
-        info->didChange(RLMInvalidatedKey);
-    }
-
-    objectSchema.observedObjects.clear();
-}
-
-void RLMTrackDeletions(__unsafe_unretained RLMRealm *const realm, dispatch_block_t block) {
-    std::vector<std::vector<RLMObservationInfo *> *> observedTables;
-
-    for (auto& info : realm->_info) {
-        if (!info.second.observedObjects.empty()) {
-            observedTables.push_back(&info.second.observedObjects);
-        }
-    }
-
-    // No need for change tracking if no objects are observed
-    if (observedTables.empty()) {
-        block();
-        return;
-    }
-
-    struct change {
-        RLMObservationInfo *info;
-        __unsafe_unretained NSString *property;
-        NSMutableIndexSet *indexes;
-    };
-
-    std::vector<change> changes;
-    std::vector<RLMObservationInfo *> invalidated;
-    size_t changeCount = 0, invalidatedCount = 0;
-
-    // This callback is called by core with a list of row deletions and
-    // resulting link nullifications immediately before things are deleted and nullified
-    realm.group.set_cascade_notification_handler([&](realm::Group::CascadeNotification const& cs) {
-        if (cs.rows.empty() && cs.links.empty()) {
-            return;
-        }
-
-        auto tableKey = [](RLMObservationInfo *info) {
-            return info->getRow().get_table()->get_key();
-        };
-        std::sort(begin(observedTables), end(observedTables),
-                  [=](auto a, auto b) { return tableKey(a->front()) < tableKey(b->front()); });
-        for (auto const& link : cs.links) {
-            auto table = std::find_if(observedTables.begin(), observedTables.end(), [&](auto table) {
-                return tableKey(table->front()) == link.origin_table;
-            });
-            if (table == observedTables.end()) {
-                continue;
-            }
-
-            for (auto observer : **table) {
-                if (!observer->isForRow(link.origin_key)) {
-                    continue;
-                }
-
-                NSString *name = observer->columnName(link.origin_col_key);
-                if (observer->getRow().get_table()->get_column_type(link.origin_col_key) != type_LinkList) {
-                    changes.push_back({observer, name});
-                    continue;
-                }
-
-                auto c = find_if(begin(changes), end(changes), [&](auto const& c) {
-                    return c.info == observer && c.property == name;
-                });
-                if (c == end(changes)) {
-                    changes.push_back({observer, name, [NSMutableIndexSet new]});
-                    c = prev(end(changes));
-                }
-
-                // We know what row index is being removed from the LinkView,
-                // but what we actually want is the indexes in the LinkView that
-                // are going away
-                auto linkview = observer->getRow().get_linklist(link.origin_col_key);
-                linkview.find_all(link.old_target_key, [&](size_t index) {
-                    [c->indexes addIndex:index];
-                });
-            }
-        }
-        if (!cs.rows.empty()) {
-            using Row = realm::Group::CascadeNotification::row;
-            auto begin = cs.rows.begin();
-            for (auto table : observedTables) {
-                auto currentTableKey = tableKey(table->front());
-                if (begin->table_key < currentTableKey) {
-                    // Find the first deleted object in or after this table
-                    begin = std::lower_bound(begin, cs.rows.end(), Row{currentTableKey, realm::ObjKey(0)});
-                }
-                if (begin == cs.rows.end()) {
-                    // No more deleted objects
-                    break;
-                }
-                if (currentTableKey < begin->table_key) {
-                    // Next deleted object is in a table after this one
-                    continue;
-                }
-
-                // Find the end of the deletions in this table
-                auto end = std::lower_bound(begin, cs.rows.end(), Row{realm::TableKey(currentTableKey.value + 1), realm::ObjKey(0)});
-
-                // Check each observed object to see if it's in the deleted rows
-                for (auto info : *table) {
-                    if (std::binary_search(begin, end, Row{currentTableKey, info->getRow().get_key()})) {
-                        invalidated.push_back(info);
-                    }
-                }
-
-                // Advance the begin iterator to the start of the next table
-                begin = end;
-                if (begin == cs.rows.end()) {
-                    break;
-                }
-            }
-        }
-
-        // The relative order of these loops is very important
-        for (size_t i = invalidatedCount; i < invalidated.size(); ++i) {
-            invalidated[i]->willChange(RLMInvalidatedKey);
-        }
-        for (size_t i = changeCount; i < changes.size(); ++i) {
-            auto const& change = changes[i];
-            change.info->willChange(change.property, NSKeyValueChangeRemoval, change.indexes);
-        }
-        for (size_t i = invalidatedCount; i < invalidated.size(); ++i) {
-            invalidated[i]->prepareForInvalidation();
-        }
-        invalidatedCount = invalidated.size();
-        changeCount = changes.size();
-    });
-
-    try {
-        block();
-    }
-    catch (...) {
-        realm.group.set_cascade_notification_handler(nullptr);
-        throw;
-    }
-
-    for (auto const& change : reverse(changes)) {
-        change.info->didChange(change.property, NSKeyValueChangeRemoval, change.indexes);
-    }
-    for (auto info : reverse(invalidated)) {
-        info->didChange(RLMInvalidatedKey);
-    }
-
-    realm.group.set_cascade_notification_handler(nullptr);
-}
-
-namespace {
-template<typename Func>
-void forEach(realm::BindingContext::ObserverState const& state, Func&& func) {
-    for (auto& change : state.changes) {
-        func(realm::ColKey(change.first), change.second, static_cast<RLMObservationInfo *>(state.info));
-    }
-}
-}
-
-std::vector<realm::BindingContext::ObserverState> RLMGetObservedRows(RLMSchemaInfo const& schema) {
-    std::vector<realm::BindingContext::ObserverState> observers;
-    for (auto& table : schema) {
-        for (auto info : table.second.observedObjects) {
-            auto const& row = info->getRow();
-            if (!row.is_valid())
-                continue;
-            observers.push_back({
-                row.get_table()->get_key(),
-                row.get_key().value,
-                info});
-        }
-    }
-    sort(begin(observers), end(observers));
-    return observers;
-}
-
-static NSKeyValueChange convert(realm::BindingContext::ColumnInfo::Kind kind) {
-    switch (kind) {
-        case realm::BindingContext::ColumnInfo::Kind::None:
-        case realm::BindingContext::ColumnInfo::Kind::SetAll:
-            return NSKeyValueChangeSetting;
-        case realm::BindingContext::ColumnInfo::Kind::Set:
-            return NSKeyValueChangeReplacement;
-        case realm::BindingContext::ColumnInfo::Kind::Insert:
-            return NSKeyValueChangeInsertion;
-        case realm::BindingContext::ColumnInfo::Kind::Remove:
-            return NSKeyValueChangeRemoval;
-    }
-}
-
-static NSIndexSet *convert(realm::IndexSet const& in, NSMutableIndexSet *out) {
-    if (in.empty()) {
-        return nil;
-    }
-
-    [out removeAllIndexes];
-    for (auto range : in) {
-        [out addIndexesInRange:{range.first, range.second - range.first}];
-    }
-    return out;
-}
-
-void RLMWillChange(std::vector<realm::BindingContext::ObserverState> const& observed,
-                   std::vector<void *> const& invalidated) {
-    for (auto info : invalidated) {
-        static_cast<RLMObservationInfo *>(info)->willChange(RLMInvalidatedKey);
-    }
-    if (!observed.empty()) {
-        NSMutableIndexSet *indexes = [NSMutableIndexSet new];
-        for (auto const& o : observed) {
-            forEach(o, [&](realm::ColKey colKey, auto const& change, RLMObservationInfo *info) {
-                info->willChange(info->columnName(colKey),
-                                 convert(change.kind), convert(change.indices, indexes));
-            });
-        }
-    }
-    for (auto info : invalidated) {
-        static_cast<RLMObservationInfo *>(info)->prepareForInvalidation();
-    }
-}
-
-void RLMDidChange(std::vector<realm::BindingContext::ObserverState> const& observed,
-                  std::vector<void *> const& invalidated) {
-    if (!observed.empty()) {
-        // Loop in reverse order to avoid O(N^2) behavior in Foundation
-        NSMutableIndexSet *indexes = [NSMutableIndexSet new];
-        for (auto const& o : reverse(observed)) {
-            forEach(o, [&](realm::ColKey col, auto const& change, RLMObservationInfo *info) {
-                info->didChange(info->columnName(col), convert(change.kind), convert(change.indices, indexes));
-            });
-        }
-    }
-    for (auto const& info : reverse(invalidated)) {
-        static_cast<RLMObservationInfo *>(info)->didChange(RLMInvalidatedKey);
-    }
-}

+ 0 - 36
Carthage/Checkouts/realm-cocoa/Realm/RLMOptionalBase.h

@@ -1,36 +0,0 @@
-////////////////////////////////////////////////////////////////////////////
-//
-// Copyright 2015 Realm Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////
-
-#import <Foundation/Foundation.h>
-#import <Realm/RLMConstants.h>
-
-NS_ASSUME_NONNULL_BEGIN
-
-@class RLMObjectBase, RLMProperty;
-
-@interface RLMOptionalBase : NSProxy
-- (instancetype)init;
-@end
-
-FOUNDATION_EXTERN id _Nullable RLMGetOptional(RLMOptionalBase *);
-FOUNDATION_EXTERN void RLMSetOptional(RLMOptionalBase *, id _Nullable);
-
-void RLMInitializeManagedOptional(RLMOptionalBase *, RLMObjectBase *parent, RLMProperty *prop);
-void RLMInitializeUnmanagedOptional(RLMOptionalBase *, RLMObjectBase *parent, RLMProperty *prop);
-
-NS_ASSUME_NONNULL_END

+ 0 - 163
Carthage/Checkouts/realm-cocoa/Realm/RLMOptionalBase.mm

@@ -1,163 +0,0 @@
-////////////////////////////////////////////////////////////////////////////
-//
-// Copyright 2015 Realm Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////
-
-#import "RLMOptionalBase.h"
-
-#import "RLMAccessor.hpp"
-#import "RLMObject_Private.hpp"
-#import "RLMProperty.h"
-#import "RLMUtil.hpp"
-#import "object.hpp"
-
-namespace {
-struct OptionalBase {
-    virtual id get() = 0;
-    virtual void set(id) = 0;
-    virtual ~OptionalBase() = default;
-};
-
-class UnmanagedOptional : public OptionalBase {
-public:
-    id get() override {
-        return _value;
-    }
-
-    void set(__unsafe_unretained const id newValue) override {
-        @autoreleasepool {
-            RLMObjectBase *object = _parent;
-            [object willChangeValueForKey:_property];
-            _value = newValue;
-            [object didChangeValueForKey:_property];
-        }
-    }
-
-    void attach(__unsafe_unretained RLMObjectBase *const obj, NSString *property) {
-        if (!_property) {
-            _property = property;
-            _parent = obj;
-        }
-    }
-
-private:
-    id _value;
-    NSString *_property;
-    __weak RLMObjectBase *_parent;
-
-};
-
-class ManagedOptional : public OptionalBase {
-public:
-    ManagedOptional(RLMObjectBase *obj, RLMProperty *prop)
-    : _realm(obj->_realm)
-    , _object(obj->_realm->_realm, *obj->_info->objectSchema, obj->_row)
-    , _propertyName(prop.name.UTF8String)
-    , _ctx(*obj->_info)
-    {
-    }
-
-    id get() override {
-        return _object.get_property_value<id>(_ctx, _propertyName);
-    }
-
-    void set(__unsafe_unretained id const value) override {
-        _object.set_property_value(_ctx, _propertyName, value ?: NSNull.null);
-    }
-
-private:
-    // We have to hold onto a strong reference to the Realm as
-    // RLMAccessorContext holds a non-retaining one.
-    __unused RLMRealm *_realm;
-    realm::Object _object;
-    std::string _propertyName;
-    RLMAccessorContext _ctx;
-};
-} // anonymous namespace
-
-@interface RLMOptionalBase () {
-    std::unique_ptr<OptionalBase> _impl;
-}
-@end
-
-@implementation RLMOptionalBase
-- (instancetype)init {
-    return self;
-}
-
-- (BOOL)isKindOfClass:(Class)aClass {
-    return [RLMGetOptional(self) isKindOfClass:aClass] || RLMIsKindOfClass(object_getClass(self), aClass);
-}
-
-- (NSMethodSignature *)methodSignatureForSelector:(SEL)sel {
-    return [RLMGetOptional(self) methodSignatureForSelector:sel];
-}
-
-- (void)forwardInvocation:(NSInvocation *)invocation {
-    [invocation invokeWithTarget:RLMGetOptional(self)];
-}
-
-- (id)forwardingTargetForSelector:(__unused SEL)sel {
-    return RLMGetOptional(self);
-}
-
-- (BOOL)respondsToSelector:(SEL)aSelector {
-    return [RLMGetOptional(self) respondsToSelector:aSelector];
-}
-
-- (void)doesNotRecognizeSelector:(SEL)aSelector {
-    [RLMGetOptional(self) doesNotRecognizeSelector:aSelector];
-}
-
-id RLMGetOptional(__unsafe_unretained RLMOptionalBase *const self) {
-    try {
-        return self->_impl ? RLMCoerceToNil(self->_impl->get()) : nil;
-    }
-    catch (std::exception const& err) {
-        @throw RLMException(err);
-    }
-}
-
-void RLMSetOptional(__unsafe_unretained RLMOptionalBase *const self, __unsafe_unretained const id value) {
-    try {
-        if (!self->_impl && value) {
-            self->_impl.reset(new UnmanagedOptional);
-        }
-        if (self->_impl) {
-            self->_impl->set(value);
-        }
-    }
-    catch (std::exception const& err) {
-        @throw RLMException(err);
-    }
-}
-
-void RLMInitializeManagedOptional(__unsafe_unretained RLMOptionalBase *const self,
-                                  __unsafe_unretained RLMObjectBase *const parent,
-                                  __unsafe_unretained RLMProperty *const prop) {
-    REALM_ASSERT(parent->_realm);
-    self->_impl.reset(new ManagedOptional(parent, prop));
-}
-
-void RLMInitializeUnmanagedOptional(__unsafe_unretained RLMOptionalBase *const self,
-                                    __unsafe_unretained RLMObjectBase *const parent,
-                                    __unsafe_unretained RLMProperty *const prop) {
-    if (!self->_impl) {
-        self->_impl.reset(new UnmanagedOptional);
-    }
-    static_cast<UnmanagedOptional&>(*self->_impl).attach(parent, prop.name);
-}
-@end

+ 0 - 47
Carthage/Checkouts/realm-cocoa/Realm/RLMPlatform.h.in

@@ -1,47 +0,0 @@
-////////////////////////////////////////////////////////////////////////////
-//
-// Copyright 2014 Realm Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////
-
-#ifdef REALM_BUILDING_FOR_MACOS
-#if !__is_target_os(macosx)
-#error Attempting to use Realm''s macOS framework in a non-macOS target.
-#endif
-#endif
-
-#ifdef REALM_BUILDING_FOR_MACCATALYST
-#if !__is_target_os(ios) || !__is_target_environment(macabi)
-#error Attempting to use Realm''s Catalyst framework in a non-Catalyst target.
-#endif
-#endif
-
-#ifdef REALM_BUILDING_FOR_IOS
-#if !__is_target_os(ios) || __is_target_environment(macabi)
-#error Attempting to use Realm''s iOS framework in a non-iOS target.
-#endif
-#endif
-
-#ifdef REALM_BUILDING_FOR_TVOS
-#if !__is_target_os(tvos)
-#error Attempting to use Realm''s tvOS framework in a non-tvOS target.
-#endif
-#endif
-
-#ifdef REALM_BUILDING_FOR_WATCHOS
-#if !__is_target_os(watchos)
-#error Attempting to use Realm''s watchOS framework in a non-watchOS target.
-#endif
-#endif

+ 0 - 22
Carthage/Checkouts/realm-cocoa/Realm/RLMPredicateUtil.hpp

@@ -1,22 +0,0 @@
-////////////////////////////////////////////////////////////////////////////
-//
-// Copyright 2015 Realm Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#import <Foundation/Foundation.h>
-#import <functional>
-
-using ExpressionVisitor = std::function<NSExpression *(NSExpression *)>;
-NSPredicate *transformPredicate(NSPredicate *, ExpressionVisitor);

Some files were not shown because too many files changed in this diff